SlideShare une entreprise Scribd logo
1  sur  42
By:
Altaf Hussain
SS KRL
BS(CS), AU Peshawar, MS(CSE), NUST Islamabad
 Understand the basic principles of object orientation
 Understand the basic concepts and terms of object
 Basic Principles of Object Orientation
 Basic Concepts of Object Orientation
Object Orientation
Encapsulation
Abstraction
Hierarchy
Modularity
5
 Abstraction allows us to manage complexity by
concentrating on essential aspects making an entity
different from others.
 A process allowing to focus on most important aspects
while ignoring less important details.
Salesperson
Not saying Which
salesperson – just
a salesperson in
general!!!
Customer
Product
Manages Complexity
 Hide implementation from clients
• Clients depend on interface
How does an object encapsulate?
What does it encapsulate?
 The breaking up of something complex into
manageable pieces
Order Processing
System
Order Entry
Order Fulfillment
Billing
Decreasing
abstraction
Increasing
abstraction
Asset
RealEstate
Savings
BankAccount
Checking Stock
Security
Bond
Elements at the same level of the hierarchy
should be at the same level of abstraction
 Levels of abstraction – ordering of abstraction in a tree
like structure
 Basic Principles of Object Orientation
 Basic Concepts of Object Orientation
 Object
 Class
 Attribute
 Operation
 Interface
 Implementation
 Association
 Aggregation
 Composition
 Generalization
 Super-Class
 Sub-Class
 Abstract Class
 Concrete Class
 Discriminator
 Polymorphism
Truck
Chemical Process
Linked List
 Informally, an object represents an entity, either
physical, conceptual, or software
• Physical entity
• Conceptual entity
• Software entity
 An object is a concept, abstraction, or thing with sharp
boundaries and meaning for an application
 An object is something that has:
• State
• Behavior
• Identity
14
 Object-oriented programming supports the view that
programs are composed of objects that interact with
one another.
 How would you describe an object?
 Using its characteristics (has a ----?) and its behaviors
(can do ----?)
 Object must have unique identity (name) : Basketball,
Blue ball
 Consider a ball:
• Color and diameter are characteristics (Data
Declarations)
• throw, bounce, roll are behaviors (Methods)
15
 A class defines the general nature of a collection of
objects of the same type.
 The process creating an object from a class is called
instantiation.
 Every object is an instance of a particular class.
 There can be many instances of objects from the same
class possible with different values for data.
Objects Example
16
class Rose
blueRose
redRose
class
objects
Object
References
OO Principle: Abstraction
 A class is a description of a group of objects with
common properties (attributes), behavior (operations),
relationships, and semantics
• An object is an instance of a class
 A class is an abstraction in that it:
• Emphasizes relevant characteristics
• Suppresses other characteristics
a + b = 10
Class
Course
Properties
Name
Location
Days offered
Credit hours
Start time
End time
Behavior
Add a student
Delete a student
Get course roster
Determine if it is full
Professor
name
empID
create( )
save( )
delete( )
change( )
Class Name
Attributes
Operations
 A class is comprised of three sections
• The first section contains the class name
• The second section shows the structure (attributes)
• The third section shows the behavior (operations)
 How many classes do you see?
Objects Class
Professor Smith
Professor Jones
Professor Mellon
Professor
 A class is an abstract definition of an object
• It defines the structure and behavior of each object in the class
• It serves as a template for creating objects
 Objects are grouped into classes
:CourseOffering
number = 101
startTime = 900
endTime = 1100
:CourseOffering
number = 104
startTime = 1300
endTime = 1500
CourseOffering
number
startTime
endTime
Class
Attribute
Object
Attribute Value
CourseOffering
addStudent
deleteStudent
getStartTime
getEndTime
Class
Operation
24
 A class that lacks a complete implementation and
provides operations without implementing some methods
 Cannot be used to create objects; cannot be instantiated
 A concrete sub-class must provide methods for
unimplemented operations
25
 Has methods for all operations
 Can be instantiated
 Methods may be:
a) defined in the class or
b) inherited from a super-class
26
 Discriminator – an attribute that defines sub-classes
 Example: “status” of company staff is a possible
discriminator to derive “management”, “senior” and
“junior” sub-classes.
27
 Ability to dynamically choose the method for an
operation at run-time or service-time
 facilitated by encapsulation and generalization:
• encapsulation – separation of interface from
implementation
• generalization –organizing information such that
the shared features reside in one class and
unique features in another
 Operations could be defined and implemented in the
super-class, but re-implemented methods are in unique
sub-classes.
Manufacturer A
Manufacturer B
Manufacturer C
OO Principle:
Encapsulation
 The ability to hide many different implementations
behind a single interface
Tube
Pyramid
Cube
Shape
Draw
Move
Scale
Rotate
<<interface>>
Realization relationship (stay tuned for realization relationships)
 Interfaces formalize polymorphism
 Interfaces support “plug-and-play” architectures
 Association
• Aggregation
• Composition
 Dependency
 Generalization
 Realization
Professor UniversityWorks for
Class
Association
Association Name
Professor University
EmployerEmployee
Role Names
 Models a semantic connection among classes
Student Schedule
Whole
Aggregation
Part
 A special form of association that models a whole-part
relationship between an aggregate (the whole) and its
parts
Student Schedule
Whole
Aggregation
Part
 A form of aggregation with strong ownership and
coincident lifetimes
• The parts cannot survive the whole/aggregate a
 Multiplicity defines how many objects participate in a
relationships
• The number of instances of one class related to ONE
instance of the other class
• Specified for each end of the association
 Associations and aggregations are bi-directional by
default, but it is often desirable to restrict navigation to
one direction
• If navigation is restricted, an arrowhead is added to
indicate the direction of the navigation
Student Schedule1 0..*
Multiplicity
Navigation
Client Supplier
Package
ClientPackage SupplierPackage
Client Supplier
Class
Dependency
relationship
Dependency
relationship
Component
 A relationship between two model elements where a
change in one may cause a change in the other
 Non-structural,“using” relationship
 A relationship among classes where one class shares
the structure and/or behavior of one or more classes
 Defines a hierarchy of abstractions in which a subclass
inherits from one or more super-classes
• Single inheritance
• Multiple inheritance
 Generalization is an “is-a-kind of” relationship
Account
balance
name
number
Withdraw()
CreateStatement()
Checking
Withdraw()
Savings
GetInterest()
Withdraw()
Superclass
(parent)
Subclasses
Generalization
Relationship
Ancestor
Descendents
 One class inherits from another
Airplane Helicopter Wolf Horse
FlyingThing Animal
Bird
multiple
inheritance
Use multiple inheritance only when needed, and
always with caution !
 A class can inherit from several other classes
Inheritance leverages the similarities among classes
 A subclass inherits its parent’s attributes,
operations, and relationships
 A subclass may:
• Add additional attributes, operations, relationships
• Redefine inherited operations (use caution!)
 Common attributes, operations, and/or
relationships are shown at the highest
applicable level in the hierarchy
Truck
tonnage
GroundVehicle
weight
licenseNumber
Car
owner
register( )
getTax( )
Person
0..*
Trailer
1
Superclass
(parent)
Subclass
generalization
size
Component
Interface
Use Case Use-Case Realization
Elided form
Class
Interface
Subsystem
Interface
Canonical form
 One classifier serves as the contract that the other classifier
agrees to carry out
 Found between:
• Interfaces and the classifiers that realize them
• Use cases and the collaborations that realize them

Contenu connexe

Tendances

The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship model
Jane Garay
 
Module 5 oodb systems semantic db systems
Module 5 oodb systems  semantic db systemsModule 5 oodb systems  semantic db systems
Module 5 oodb systems semantic db systems
Taher Barodawala
 
Object oriented database model
Object oriented database modelObject oriented database model
Object oriented database model
PAQUIAAIZEL
 
Ch 5 O O Data Modeling Class
Ch 5  O O  Data Modeling ClassCh 5  O O  Data Modeling Class
Ch 5 O O Data Modeling Class
guest8fdbdd
 
Ijarcet vol-2-issue-4-1363-1367
Ijarcet vol-2-issue-4-1363-1367Ijarcet vol-2-issue-4-1363-1367
Ijarcet vol-2-issue-4-1363-1367
Editor IJARCET
 
L ab # 07
L ab # 07L ab # 07
L ab # 07
Mr SMAK
 

Tendances (20)

ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
Class diagrams
Class diagramsClass diagrams
Class diagrams
 
The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship model
 
SAD02 - Object Orientation
SAD02 - Object OrientationSAD02 - Object Orientation
SAD02 - Object Orientation
 
Chapter3
Chapter3Chapter3
Chapter3
 
Ooad notes
Ooad notesOoad notes
Ooad notes
 
Module 5 oodb systems semantic db systems
Module 5 oodb systems  semantic db systemsModule 5 oodb systems  semantic db systems
Module 5 oodb systems semantic db systems
 
Object oriented database model
Object oriented database modelObject oriented database model
Object oriented database model
 
Ooad ch 4
Ooad ch 4Ooad ch 4
Ooad ch 4
 
Entity relationship modelling
Entity relationship modellingEntity relationship modelling
Entity relationship modelling
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
Unit iv dbms
Unit   iv dbmsUnit   iv dbms
Unit iv dbms
 
Ch 5 O O Data Modeling Class
Ch 5  O O  Data Modeling ClassCh 5  O O  Data Modeling Class
Ch 5 O O Data Modeling Class
 
Ooad ch 3
Ooad ch 3Ooad ch 3
Ooad ch 3
 
Ijarcet vol-2-issue-4-1363-1367
Ijarcet vol-2-issue-4-1363-1367Ijarcet vol-2-issue-4-1363-1367
Ijarcet vol-2-issue-4-1363-1367
 
ER Diagram
ER DiagramER Diagram
ER Diagram
 
Chapter # 12 er modeling
Chapter # 12 er modelingChapter # 12 er modeling
Chapter # 12 er modeling
 
Relational Model
Relational ModelRelational Model
Relational Model
 
Entity Relationship Diagrams
Entity Relationship DiagramsEntity Relationship Diagrams
Entity Relationship Diagrams
 
L ab # 07
L ab # 07L ab # 07
L ab # 07
 

Similaire à Lecture#01, object orientation

Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Aravinth NSP
 
1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas
1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas
1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas
18130208
 
8 oo approach&uml-23_feb
8 oo approach&uml-23_feb8 oo approach&uml-23_feb
8 oo approach&uml-23_feb
Raj Shah
 

Similaire à Lecture#01, object orientation (20)

OOAD notes.pptx
OOAD notes.pptxOOAD notes.pptx
OOAD notes.pptx
 
OOAD.pptx
OOAD.pptxOOAD.pptx
OOAD.pptx
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
OOPs in Java
OOPs in JavaOOPs in Java
OOPs in Java
 
OOSD1-unit1_1_16_09.pptx
OOSD1-unit1_1_16_09.pptxOOSD1-unit1_1_16_09.pptx
OOSD1-unit1_1_16_09.pptx
 
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
 
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
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas
1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas
1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas
 
Oot
OotOot
Oot
 
Unit 3
Unit 3Unit 3
Unit 3
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
implementing oop_concept
 implementing oop_concept implementing oop_concept
implementing oop_concept
 
8 oo approach&uml-23_feb
8 oo approach&uml-23_feb8 oo approach&uml-23_feb
8 oo approach&uml-23_feb
 
Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)
 
Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0
 
CS8592-OOAD Lecture Notes Unit-2
CS8592-OOAD Lecture Notes Unit-2CS8592-OOAD Lecture Notes Unit-2
CS8592-OOAD Lecture Notes Unit-2
 

Plus de babak danyal

Lecture1 Intro To Signa
Lecture1 Intro To SignaLecture1 Intro To Signa
Lecture1 Intro To Signa
babak danyal
 

Plus de babak danyal (20)

applist
applistapplist
applist
 
Easy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client SocketsEasy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client Sockets
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streams
 
Swing and Graphical User Interface in Java
Swing and Graphical User Interface in JavaSwing and Graphical User Interface in Java
Swing and Graphical User Interface in Java
 
Tcp sockets
Tcp socketsTcp sockets
Tcp sockets
 
block ciphers and the des
block ciphers and the desblock ciphers and the des
block ciphers and the des
 
key distribution in network security
key distribution in network securitykey distribution in network security
key distribution in network security
 
Lecture10 Signal and Systems
Lecture10 Signal and SystemsLecture10 Signal and Systems
Lecture10 Signal and Systems
 
Lecture8 Signal and Systems
Lecture8 Signal and SystemsLecture8 Signal and Systems
Lecture8 Signal and Systems
 
Lecture7 Signal and Systems
Lecture7 Signal and SystemsLecture7 Signal and Systems
Lecture7 Signal and Systems
 
Lecture6 Signal and Systems
Lecture6 Signal and SystemsLecture6 Signal and Systems
Lecture6 Signal and Systems
 
Lecture5 Signal and Systems
Lecture5 Signal and SystemsLecture5 Signal and Systems
Lecture5 Signal and Systems
 
Lecture4 Signal and Systems
Lecture4  Signal and SystemsLecture4  Signal and Systems
Lecture4 Signal and Systems
 
Lecture3 Signal and Systems
Lecture3 Signal and SystemsLecture3 Signal and Systems
Lecture3 Signal and Systems
 
Lecture2 Signal and Systems
Lecture2 Signal and SystemsLecture2 Signal and Systems
Lecture2 Signal and Systems
 
Lecture1 Intro To Signa
Lecture1 Intro To SignaLecture1 Intro To Signa
Lecture1 Intro To Signa
 
Lecture9 Signal and Systems
Lecture9 Signal and SystemsLecture9 Signal and Systems
Lecture9 Signal and Systems
 
Lecture9
Lecture9Lecture9
Lecture9
 
Cns 13f-lec03- Classical Encryption Techniques
Cns 13f-lec03- Classical Encryption TechniquesCns 13f-lec03- Classical Encryption Techniques
Cns 13f-lec03- Classical Encryption Techniques
 
Classical Encryption Techniques in Network Security
Classical Encryption Techniques in Network SecurityClassical Encryption Techniques in Network Security
Classical Encryption Techniques in Network Security
 

Dernier

Dernier (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Lecture#01, object orientation

Notes de l'éditeur

  1. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation In the Best Practices module, we discussed some characteristics common to successful projects. OO facilitates the following best practices: Develop Iteratively Model Visually Use Component Architecture Defining basic OO terms and concepts allows everyone in the class to start on a level playing field.
  2. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  3. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  4. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Discuss what makes a good abstraction with the students: Concise, Represents a single coherent concept, etc.
  5. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Encapsulation is putting the “databits” and operations that manipulate them in the same place. Encapsulation DISALLOWS direct manipulation of things that have been encapsulated without utilising the supplied interface. Another example - the accelerator on a car. You put your foot down and car goes faster - this works on most cars, and you don’t worry about the cables, electronics, engine, etc.
  6. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Before moving on, ask the students to name the four basic principles of OO (as a review).
  7. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  8. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  9. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation A class has been called a “cookie cutter” for objects.
  10. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  11. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation In Rose: You may select which compartments are displayed via Diagram Object Properties for the diagram element. You may select which items appear in which compartments using the Edit Compartment function for the diagram element.
  12. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation The answers you get will vary depending on the students’ perspectives on what they see, as well as the criteria they use to organize the objects shown on this slide. For example, some possible answers include: Two classes: animals and non-animals Two classes: Extinct and non-extinct things Etc.
  13. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation This may seem repetitive with earlier slides, but it has been noted that the repetition of the discrimination between objects and classes is beneficial to “newbies”. If this does not apply to your class, you can cover this slide briefly.
  14. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  15. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  16. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Polymorphism will be addressed in more detail in the Class Design module. Another example of polymorphism: There is a toddler sitting in front of some blocks and a teenager siting in front of a piano. An adult walks into the room and says “play”. The toddler plays with the blocks and the teenage plays the piano. Another example - car accelerator on different cars.
  17. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Interfaces are not abstract classes, as abstract classes allow you to provide default behavior for some/all of their methods. Interfaces provide no default behavior.
  18. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Don’t cover the details of the graphic on this slide. The semantics of each of the relationships will be discussed later.
  19. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Associations connect instances of two or more classes together for some duration (as opposed to a dependency relationship, which represents a temporary association between two instances). Dependency relationships will be discussed in the Class Design module. Do not use relationship/role names if they add no value/information to the model. Remember, readability and understandability of the model are key -- only add information that adds value, not clutter to the diagrams.
  20. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation There are many examples of whole-part relationships: a Library contains Books, within a company Departments are made-up of Employees, a Computer is composed of a number of Devices. However, whether you model a relationship as an association or aggregation is really dependent on the domain being modeled. This is discussed in more detail on a later slide.
  21. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Explain to the students that the diamond on this slide must be filled in with black so that the books would print right. If it was filled in with white, it would not be filled in in the books. Note: Compositional aggregation can be shown in by nesting one class within another; however, Rose does not directly support the drawing of a class within a class. Composition is not equivalent to containment by value, as some languages do not support containment by value (e.g., Java). By-value vs. by-reference is an implementation “thing”, whereas composition is a conceptual “thing” that can realized in the implementation using by-value, or by-reference (if the distinction is supported). Note: In Rose, composition is modeled by specifying “by-value” for the containment property of a role of a relationship.
  22. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  23. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  24. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  25. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Generalization relationships are also permitted between packages. However, since packages do not themselves have any semantics, generalization between packages is not very common (generalization amongst subsystems, however, is practical). According to Grady Booch: “The terms “inheritance” and “generalization” are, practically speaking, interchangeable. The UML standardized on calling the relationship “generalization” so as not to confuse people with language-specific meanings of inheritance. To confuse matters further, some call this an “is-a” or a “kind of” relationship (especially those into conceptual modeling in the cognitive sciences). So, for most users, it’s fair to use either term. For power users - people who care about things like the UML metamodel and specifying formal semantics of the same, the relationship is called “generalization” and applying such a relationship between, for example, two classes, results in the subclass inheriting the structure and operations of the superclass (i.e. inheritance is the mechanism).
  26. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  27. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation
  28. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Emphasize that when a change is made to a super class all descendent classes inherit the change. Some languages do not support generalization. In these cases you will need to update the design model to reflect the characteristics of the implementation language. In cases where the implementation language does not support generalization between classes you must “design generalization in”. See the language specific appendices for more information. See Class Design for more information.
  29. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation Ask the class the following to test their understanding: “ Without looking at your notes: How many operations does Car have? Answer: 1 How may relationships? Answer: 1 How many operations does Truck have? Answer: 2 How may relationships? Answer: 2” Generalization provides a way to implement polymorphism in cases where polymorphism is implemented the same way for a set of classes. The use of generalization to support polymorphism is discussed in more detail in the Class Design module
  30. OOADv4.2 Instructor Notes Module 3 - Introduction to Object Orientation We discussed subsystems earlier in this module. We will look at interfaces and the realization relationship in more detail in the Architectural Design module.