Download presentation
Presentation is loading. Please wait.
1
SNSCT_CSE_PROGRAMMING PARADIGM_CS206
OOPS-FUNDAMENTALS OOPS Review 9/15/2018 SNSCT_CSE_PROGRAMMING PARADIGM_CS206
2
CSE_PROGRAMMING PARADIGM_CS206
9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
3
CSE_PROGRAMMING PARADIGM_CS206
RECAP CSE_PROGRAMMING PARADIGM_CS206
4
CSE_PROGRAMMING PARADIGM_CS206
Recap What is an Attribute? What is an Operation? What is an Object and what is a Class? What is the difference between them? What is an Object? 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
5
Object-Oriented Programming Revisited
Key OOP Concepts Object, Class Instantiation, Constructors Encapsulation Inheritance and Subclasses Abstraction Reuse Polymorphism, Dynamic Binding Object-Oriented Design and Modeling 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
6
CSE_PROGRAMMING PARADIGM_CS206
OOPS-FUNDAMENTALS Object Definition: a thing that has identity, state, and behavior identity: a distinguished instance of a class state: collection of values for its variables behavior: capability to execute methods * variables and methods are defined in a class 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
7
CSE_PROGRAMMING PARADIGM_CS206
Class Definition: a collection of data (fields/ variables) and methods that operate on that data define the contents/capabilities of the instances (objects) of the class a class can be viewed as a factory for objects a class defines a recipe for its objects 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
8
CSE_PROGRAMMING PARADIGM_CS206
Instantiation Object creation Memory is allocated for the object’s fields as defined in the class Initialization is specified through a constructor a special method invoked when objects are created 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
9
CSE_PROGRAMMING PARADIGM_CS206
Encapsulation A key OO concept: “Information Hiding” Key points The user of an object should have access only to those methods (or data) that are essential Unnecessary implementation details should be hidden from the user In Java/C++, use classes and access modifiers (public, private, protected) 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
10
CSE_PROGRAMMING PARADIGM_CS206
Inheritance Inheritance: programming language feature that allows for the implicit definition of variables/methods for a class through an existing class Subclass relationship B is a subclass of A B inherits all definitions (variables/methods) in A 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
11
CSE_PROGRAMMING PARADIGM_CS206
Abstraction OOP is about abstraction Encapsulation and Inheritance are examples of abstraction What does the verb “abstract” mean? 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
12
CSE_PROGRAMMING PARADIGM_CS206
Reuse Inheritance encourages software reuse Existing code need not be rewritten Successful reuse occurs only through careful planning and design when defining classes, anticipate future modifications and extensions 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
13
CSE_PROGRAMMING PARADIGM_CS206
Polymorphism “Many forms” allow several definitions under a single method name Example: “move” means something for a person object but means something else for a car object Dynamic binding: capability of an implementation to distinguish between the different forms during run-time 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
14
Building Complex Systems
From Software Engineering: complex systems are difficult to manage Proper use of OOP aids in managing this complexity The analysis and design of OO systems require corresponding modeling techniques 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
15
Object-Oriented Modeling
UML: Unified Modeling Language OO Modeling Standard Booch, Jacobson, Rumbaugh What is depicted? Class details and static relationships System functionality Object interaction State transition within an object 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
16
Some UML Modeling Techniques
Class Diagrams Use Cases/Use Case Diagrams Interaction Diagrams State Diagrams 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
17
Example: Class Diagram
Borrower Book 0..1 0..3 currBorr bk[] public class Borrower { Book bk[]; … public Borrower() { bk = new Book[3]; } public class Book { Borrower currBorr; … } 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
18
Example: Use Case Diagram
LIBRARY SYSTEM Facilitate Checkout Search for Book Borrower Librarian Facilitate Return 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
19
Example: Interaction Diagram
2: isAvailable() Checkout Screen :Book 1: borrowAllowed() 3: borrowBook() 4: setBorrower() :Borrower 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
20
Example: State Diagram (Book)
start Reserved Borrowed New Librarian activates book as available Borrower returns book Available 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
21
Object-Oriented Design Models
Static Model Class Diagrams Dynamic Model Use Cases, Interaction Diagrams, State Diagrams, others 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
22
CSE_PROGRAMMING PARADIGM_CS206
OO Static Model Classes and Class Diagrams Relationships Association Aggregation/Composition Inheritance Dependencies Attribute and Method names 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
23
CSE_PROGRAMMING PARADIGM_CS206
OO Dynamic Model Goal: Represent Object behavior Object interaction Traditional/Procedural Dynamic Modeling Data Flow Diagrams (DFDs) Problem: Processes separate from data Need modeling notation that highlight tight relationship between data & processes 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
24
DFD Example (Inventory Management)
Accept and Post Delivery Delivery info Transaction Item Master 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
25
OO Counterpart: Object Interaction
new (delivery info) Encoder :Transaction post (item count) :Item Master 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
26
Building an OO Dynamic Model
Identify use cases Describe each use case through an interaction diagram For more complex objects, provide a state diagram per class Derive implied methods (and attributes) 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
27
CSE_PROGRAMMING PARADIGM_CS206
What’s Next? Need to understand the notation Make sure it helps the software development process When to use the UML techniques Primarily when specifying OO design Formal means of communication across the different software development stages 9/15/2018 CSE_PROGRAMMING PARADIGM_CS206
28
CSE_PROGRAMMING PARADIGM_CS206
ACTIVITY CSE_PROGRAMMING PARADIGM_CS206
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.