SlideShare a Scribd company logo
1 of 24
OOP Review
CS 124
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
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
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
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
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)
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
Abstraction
 OOP is about abstraction
 Encapsulation and Inheritance are examples
of abstraction
 What does the verb “abstract” mean?
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
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
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
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
Some UML Modeling
Techniques
 Class Diagrams
 Use Cases/Use Case Diagrams
 Interaction Diagrams
 State Diagrams
Example:
Class Diagram
Borrower Book
currBorr bk[]
0..3
0..1
public class Borrower {
Book bk[];
…
public Borrower() {
bk = new Book[3];
}
}
public class Book {
Borrower currBorr;
…
}
Example:
Use Case Diagram
Facilitate Checkout
Facilitate Return
Search for Book
LIBRARY SYSTEM
Borrower
Librarian
Example:
Interaction Diagram
Checkout
Screen
:Borrower
:Book
1: borrowAllowed()
3: borrowBook()
2: isAvailable()
4: setBorrower()
Example:
State Diagram (Book)
New
Available
Reserved
Borrowed
start
Librarian activates
book as available
Borrower returns book
Object-Oriented Design
Models
 Static Model
 Class Diagrams
 Dynamic Model
 Use Cases, Interaction Diagrams, State
Diagrams, others
OO Static Model
 Classes and Class Diagrams
 Relationships
 Association
 Aggregation/Composition
 Inheritance
 Dependencies
 Attribute and Method names
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
DFD Example
(Inventory Management)
Accept and Post
Delivery
Item Master
Transaction
Delivery info
OO Counterpart:
Object Interaction
Encoder
:Item Master
:Transaction
new (delivery info)
post (item count)
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)
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

More Related Content

Similar to CS124-L1-OOP.ppt

Software enginering.group-no-11 (1)
Software enginering.group-no-11 (1)Software enginering.group-no-11 (1)
Software enginering.group-no-11 (1)riarana10
 
implementing oop_concept
 implementing oop_concept implementing oop_concept
implementing oop_conceptAmit Gupta
 
Interview preparation for programming.pptx
Interview preparation for programming.pptxInterview preparation for programming.pptx
Interview preparation for programming.pptxBilalHussainShah5
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1Geophery sanga
 
Modeling- Object, Dynamic and Functional
Modeling- Object, Dynamic and FunctionalModeling- Object, Dynamic and Functional
Modeling- Object, Dynamic and FunctionalRajani Bhandari
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on lineMilind Patil
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .NetGreg Sohl
 
CS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IICS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IIpkaviya
 
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.pptChishaleFriday
 
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptxRokaKaram
 
ArchitectureOfAOMsWICSA3
ArchitectureOfAOMsWICSA3ArchitectureOfAOMsWICSA3
ArchitectureOfAOMsWICSA3Erdem Sahin
 
P Training Presentation
P Training PresentationP Training Presentation
P Training PresentationGaurav Tyagi
 
Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindiappsdevelopment
 
Overview of Object-Oriented Concepts Characteristics by vikas jagtap
Overview of Object-Oriented Concepts Characteristics by vikas jagtapOverview of Object-Oriented Concepts Characteristics by vikas jagtap
Overview of Object-Oriented Concepts Characteristics by vikas jagtapVikas Jagtap
 
oops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfoops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfArpitaJana28
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 

Similar to CS124-L1-OOP.ppt (20)

Software enginering.group-no-11 (1)
Software enginering.group-no-11 (1)Software enginering.group-no-11 (1)
Software enginering.group-no-11 (1)
 
implementing oop_concept
 implementing oop_concept implementing oop_concept
implementing oop_concept
 
Interview preparation for programming.pptx
Interview preparation for programming.pptxInterview preparation for programming.pptx
Interview preparation for programming.pptx
 
34. uml
34. uml34. uml
34. uml
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
 
Modeling- Object, Dynamic and Functional
Modeling- Object, Dynamic and FunctionalModeling- Object, Dynamic and Functional
Modeling- Object, Dynamic and Functional
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on line
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
CS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IICS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT II
 
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.ppt
 
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx
 
ArchitectureOfAOMsWICSA3
ArchitectureOfAOMsWICSA3ArchitectureOfAOMsWICSA3
ArchitectureOfAOMsWICSA3
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Oops
OopsOops
Oops
 
Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1
 
OCL3_10_05.pptx
OCL3_10_05.pptxOCL3_10_05.pptx
OCL3_10_05.pptx
 
Overview of Object-Oriented Concepts Characteristics by vikas jagtap
Overview of Object-Oriented Concepts Characteristics by vikas jagtapOverview of Object-Oriented Concepts Characteristics by vikas jagtap
Overview of Object-Oriented Concepts Characteristics by vikas jagtap
 
oops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfoops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdf
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Introduction of C# & MVC
Introduction of C# & MVCIntroduction of C# & MVC
Introduction of C# & MVC
 

More from MonishaAb1

css-presentation.ppt
css-presentation.pptcss-presentation.ppt
css-presentation.pptMonishaAb1
 
WHO-MSD-QR-19.2-eng.pptx
WHO-MSD-QR-19.2-eng.pptxWHO-MSD-QR-19.2-eng.pptx
WHO-MSD-QR-19.2-eng.pptxMonishaAb1
 
introduction_OO.pptx
introduction_OO.pptxintroduction_OO.pptx
introduction_OO.pptxMonishaAb1
 
003 OOP Concepts.ppt
003 OOP Concepts.ppt003 OOP Concepts.ppt
003 OOP Concepts.pptMonishaAb1
 
komlenov01.ppt
komlenov01.pptkomlenov01.ppt
komlenov01.pptMonishaAb1
 
Every_Mind_Matters_Dealing_with_change_KS34_presentation.pdf
Every_Mind_Matters_Dealing_with_change_KS34_presentation.pdfEvery_Mind_Matters_Dealing_with_change_KS34_presentation.pdf
Every_Mind_Matters_Dealing_with_change_KS34_presentation.pdfMonishaAb1
 
EmbeddedJavaSmall.ppt
EmbeddedJavaSmall.pptEmbeddedJavaSmall.ppt
EmbeddedJavaSmall.pptMonishaAb1
 

More from MonishaAb1 (9)

css-presentation.ppt
css-presentation.pptcss-presentation.ppt
css-presentation.ppt
 
WHO-MSD-QR-19.2-eng.pptx
WHO-MSD-QR-19.2-eng.pptxWHO-MSD-QR-19.2-eng.pptx
WHO-MSD-QR-19.2-eng.pptx
 
introduction_OO.pptx
introduction_OO.pptxintroduction_OO.pptx
introduction_OO.pptx
 
003 OOP Concepts.ppt
003 OOP Concepts.ppt003 OOP Concepts.ppt
003 OOP Concepts.ppt
 
komlenov01.ppt
komlenov01.pptkomlenov01.ppt
komlenov01.ppt
 
session07.ppt
session07.pptsession07.ppt
session07.ppt
 
chap11.ppt
chap11.pptchap11.ppt
chap11.ppt
 
Every_Mind_Matters_Dealing_with_change_KS34_presentation.pdf
Every_Mind_Matters_Dealing_with_change_KS34_presentation.pdfEvery_Mind_Matters_Dealing_with_change_KS34_presentation.pdf
Every_Mind_Matters_Dealing_with_change_KS34_presentation.pdf
 
EmbeddedJavaSmall.ppt
EmbeddedJavaSmall.pptEmbeddedJavaSmall.ppt
EmbeddedJavaSmall.ppt
 

Recently uploaded

Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsCharles Obaleagbon
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Rndexperts
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CANestorGamez6
 
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiVIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)jennyeacort
 
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
PORTAFOLIO   2024_  ANASTASIYA  KUDINOVAPORTAFOLIO   2024_  ANASTASIYA  KUDINOVA
PORTAFOLIO 2024_ ANASTASIYA KUDINOVAAnastasiya Kudinova
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdfSwaraliBorhade
 
Introduction-to-Canva-and-Graphic-Design-Basics.pptx
Introduction-to-Canva-and-Graphic-Design-Basics.pptxIntroduction-to-Canva-and-Graphic-Design-Basics.pptx
Introduction-to-Canva-and-Graphic-Design-Basics.pptxnewslab143
 
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Narsimha murthy
 
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Roomdivyansh0kumar0
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Sitegalleryaagency
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证nhjeo1gg
 
Housewife Call Girls NRI Layout - Call 7001305949 Rs-3500 with A/C Room Cash ...
Housewife Call Girls NRI Layout - Call 7001305949 Rs-3500 with A/C Room Cash ...Housewife Call Girls NRI Layout - Call 7001305949 Rs-3500 with A/C Room Cash ...
Housewife Call Girls NRI Layout - Call 7001305949 Rs-3500 with A/C Room Cash ...narwatsonia7
 
Kindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpKindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpmainac1
 
ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case StudySophia Viganò
 
Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full NightCall Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 

Recently uploaded (20)

Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
 
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past Questions
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
 
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiVIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
 
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
 
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
PORTAFOLIO   2024_  ANASTASIYA  KUDINOVAPORTAFOLIO   2024_  ANASTASIYA  KUDINOVA
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf
 
Introduction-to-Canva-and-Graphic-Design-Basics.pptx
Introduction-to-Canva-and-Graphic-Design-Basics.pptxIntroduction-to-Canva-and-Graphic-Design-Basics.pptx
Introduction-to-Canva-and-Graphic-Design-Basics.pptx
 
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
 
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Site
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
 
Housewife Call Girls NRI Layout - Call 7001305949 Rs-3500 with A/C Room Cash ...
Housewife Call Girls NRI Layout - Call 7001305949 Rs-3500 with A/C Room Cash ...Housewife Call Girls NRI Layout - Call 7001305949 Rs-3500 with A/C Room Cash ...
Housewife Call Girls NRI Layout - Call 7001305949 Rs-3500 with A/C Room Cash ...
 
Kindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpKindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUp
 
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonCheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
 
ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case Study
 
Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full NightCall Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
 

CS124-L1-OOP.ppt

  • 2. 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
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. 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)
  • 7. 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
  • 8. Abstraction  OOP is about abstraction  Encapsulation and Inheritance are examples of abstraction  What does the verb “abstract” mean?
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. Some UML Modeling Techniques  Class Diagrams  Use Cases/Use Case Diagrams  Interaction Diagrams  State Diagrams
  • 14. Example: Class Diagram Borrower Book currBorr bk[] 0..3 0..1 public class Borrower { Book bk[]; … public Borrower() { bk = new Book[3]; } } public class Book { Borrower currBorr; … }
  • 15. Example: Use Case Diagram Facilitate Checkout Facilitate Return Search for Book LIBRARY SYSTEM Borrower Librarian
  • 17. Example: State Diagram (Book) New Available Reserved Borrowed start Librarian activates book as available Borrower returns book
  • 18. Object-Oriented Design Models  Static Model  Class Diagrams  Dynamic Model  Use Cases, Interaction Diagrams, State Diagrams, others
  • 19. OO Static Model  Classes and Class Diagrams  Relationships  Association  Aggregation/Composition  Inheritance  Dependencies  Attribute and Method names
  • 20. 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
  • 21. DFD Example (Inventory Management) Accept and Post Delivery Item Master Transaction Delivery info
  • 22. OO Counterpart: Object Interaction Encoder :Item Master :Transaction new (delivery info) post (item count)
  • 23. 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)
  • 24. 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