SlideShare a Scribd company logo
Arab Open University
2nd
Semester, 2006-2007
M301
Unit 4.3
Classes and Associations
reem.attas@arabou.org.sa
Reem AlAttas © 2
Topic Road Map
 Simple class models with the UML
Precise modeling of associations
More modeling techniques
Constraining models
Reem AlAttas © 3
Class Model
Describes the objects and the
relationships between them that are
needed to implement the required
functionality.
Reem AlAttas © 4
Searching for Classes
 Tangible objects: the physical things in the domain.
 Ex. rooms, bills, books, vehicles.
 Roles: the roles played by people in the domain.
 Ex. employee, guest, member.
 Events: the circumstances, episodes, interactions,
happenings or significant incidents.
 Ex. reservation of a room, the registration of a vehicle, orders,
deliveries and transactions.
 Organizational units: the groups to which people belong.
 Ex. accounts department, a production team or a maintenance
crew.
Reem AlAttas © 5
… Searching for Classes
The focus on looking for nouns in a
problem description design does
emphasize that you are concentrating on
things.
In a traditional procedural model, the first
area of concern would instead have been
actions and activities, which are described
by verbs.
Reem AlAttas © 6
Object Diagram
Model that show a number of concrete
instances of a set of relevant classes and
the relationships between them.
Each object is an instance of a class.
Each link is an instance of an association.
Reem AlAttas © 7
… Object Diagram
Reem AlAttas © 8
Object Diagram with Role Names
Reem AlAttas © 9
Class Diagrams
A model that expresses generalizations
about all valid object diagrams.
Box represent class.
Line represent association.
Reem AlAttas © 10
Class and some instances
Reem AlAttas © 11
Associations
 The relationships between classes  How
classes might be related?
 A Guest is related to:
 A Hotel by making a reservation.
 A Room by currently occupying a room or having stayed
in a room previously.
 A Room is related to a Hotel by being physically
located in a Hotel.
Reem AlAttas © 12
… Associations
Reem AlAttas © 13
Multiplicities
How many of one sort of thing can be
related to another sort of thing 
determine how many objects are required.
minimum .. maximum
Reem AlAttas © 14
… Multiplicities
Reem AlAttas © 15
… Multiplicities
Reem AlAttas © 16
Naming Associations
Reem AlAttas © 17
Role Names
Reem AlAttas © 18
Two Associations
Reem AlAttas © 19
Several Associations
Reem AlAttas © 20
Recursive Relationship
Reem AlAttas © 21
Topic Road Map
Simple class models with the UML
 Precise modeling of associations
More modeling techniques
Constraining models
Reem AlAttas © 22
Aggregation
A whole–part relationship.
 Ex. The whole (an invoice) is made up from the
parts (the invoice lines).
It is possible to add, remove or replace
one of the ‘parts’ and still have a
meaningful relationship: an invoice would
still be an aggregation of invoice lines if
another invoice line were to be added.
Reem AlAttas © 23
Composition
A chess-board and its squares are much
more intimately related than an invoice
and its invoice lines because a chess
board cannot exist unless it has 64
squares.
If you were to remove (or add) a square
you would no longer have a recognizable
chess-board.
Reem AlAttas © 24
… Composition
Reem AlAttas © 25
Navigation
Put an open arrowhead at one or both
ends of an association to indicate that it is
possible to reach one class from another
following the direction of the arrow.
Reem AlAttas © 26
… Navigation
An instance of the class Invoice can send
messages to instances of the class
InvoiceLine, but not the other way round.
Reem AlAttas © 27
Qualified Associations
If the system you are modeling includes a
mechanism for identifying objects
uniquely, you can use qualified
associations to record this information.
In cases where objects can be uniquely
identified by combinations of two or more
attributes, all those attributes should move
into the qualifier.
Reem AlAttas © 28
… Qualified Associations
Reem AlAttas © 29
Derived Associations
Associations can be derived from others
already in that diagram.
By preceding a role name with a slash,
you indicate that an association is
derivable.
Reem AlAttas © 30
… Derived Associations
Reem AlAttas © 31
Topic Road Map
Simple class models with the UML
Precise modeling of associations
 More modeling techniques
Constraining models
Reem AlAttas © 32
Generalization and Specialization
Reem AlAttas © 33
… Generalization and Specialization
Superclass  more general element.
Subclass  more specific element.
A subclass has the same attributes as the
superclass, though it may define some
additional ones.
Reem AlAttas © 34
Specialization of Account
Reem AlAttas © 35
Interface
the set of operations that specify the
service that a class provides.
 Ex. The class Account has the interface {credit
(amount: Money), debit (amount: Money),
getBalance ()} while the class SavingsAccount
has the interface {credit (amount: Money), debit
(amount: Money), getBalance (), addInterest ()}.
Reem AlAttas © 36
Multiple Levels of Specialization
Reem AlAttas © 37
Violating the is-a rule
Reem AlAttas © 38
Inventing a Superclass
<<abstract>>  never be used to create
instances.
Reem AlAttas © 39
Polymorphism
The ability to use instances of various
different classes through a shared
interface.
The interface simply identifies a set of
operations by naming each one. It does
not provide any implementation.
Reem AlAttas © 40
… Polymorphism
Reem AlAttas © 41
Dependency
Reem AlAttas © 42
Topic Road Map
Simple class models with the UML
Precise modeling of associations
More modeling techniques
 Constraining models
Reem AlAttas © 43
Constraints
Invariants: Boolean expressions that must
always remain true.
 Ex. valid account numbers need to be within a
certain range.
Reem AlAttas © 44
… Constraints
Reem AlAttas © 45
Object Constraint Language (OCL)
Combines logical expressions with set
notation to allow a more rigorous
specification of a constraint.
Reem AlAttas © 46
Constraints across Associations
Reem AlAttas © 47
Controlling the Use of Different
Accounts
Reem AlAttas © 48
Constraint on Related Objects
TMA4 – Q3
Thank You!

More Related Content

Similar to Classes and Associations

se_lectures.DS_Store__MACOSXse_lectures._.DS_Storese_
se_lectures.DS_Store__MACOSXse_lectures._.DS_Storese_se_lectures.DS_Store__MACOSXse_lectures._.DS_Storese_
se_lectures.DS_Store__MACOSXse_lectures._.DS_Storese_
WilheminaRossi174
 
Interactions
InteractionsInteractions
Interactions
Reem Alattas
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
Satyamevjayte Haxor
 
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPTCS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
leela rani
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
Raj Thilak S
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
Madhar Khan Pathan
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
Mukesh Tekwani
 
CASE Tools lab.ppt
CASE Tools lab.pptCASE Tools lab.ppt
CASE Tools lab.ppt
RAJESH S
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Sudarsun Santhiappan
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented DesignAravinth NSP
 
2 class use case
2 class use case2 class use case
2 class use case
Minal Maniar
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
rahulnadola3
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
DHAAROUN
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
poovathi nps
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
pradnyamulay
 
4. UML
4. UML4. UML

Similar to Classes and Associations (20)

se_lectures.DS_Store__MACOSXse_lectures._.DS_Storese_
se_lectures.DS_Store__MACOSXse_lectures._.DS_Storese_se_lectures.DS_Store__MACOSXse_lectures._.DS_Storese_
se_lectures.DS_Store__MACOSXse_lectures._.DS_Storese_
 
Interactions
InteractionsInteractions
Interactions
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
 
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPTCS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
 
CASE Tools lab.ppt
CASE Tools lab.pptCASE Tools lab.ppt
CASE Tools lab.ppt
 
Intro Uml
Intro UmlIntro Uml
Intro Uml
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
2 class use case
2 class use case2 class use case
2 class use case
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Ch 3.pdf
Ch 3.pdfCh 3.pdf
Ch 3.pdf
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
4. UML
4. UML4. UML
4. UML
 

More from Reem Alattas

Rumble Lights Pitch Deck
Rumble Lights Pitch DeckRumble Lights Pitch Deck
Rumble Lights Pitch Deck
Reem Alattas
 
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular RobotsNASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
Reem Alattas
 
She looks just like me 2017
She looks just like me 2017She looks just like me 2017
She looks just like me 2017
Reem Alattas
 
Nasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Nasa Datanauts Water Cooler Chat: Robotics for Space ExplorationNasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Nasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Reem Alattas
 
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space ExplorationNasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Reem Alattas
 
She Looks Just Like Me 2017
She Looks Just Like Me 2017She Looks Just Like Me 2017
She Looks Just Like Me 2017
Reem Alattas
 
Tran helmet pitch
Tran helmet pitchTran helmet pitch
Tran helmet pitch
Reem Alattas
 
Evolutionary Robotics
Evolutionary RoboticsEvolutionary Robotics
Evolutionary Robotics
Reem Alattas
 
Create a Need
Create a NeedCreate a Need
Create a Need
Reem Alattas
 
Enhancing input on and above the interactive surface
Enhancing input on and above the interactive surfaceEnhancing input on and above the interactive surface
Enhancing input on and above the interactive surface
Reem Alattas
 
Skinput: Appropriating the Body as an Input Surface
Skinput: Appropriating the Body as an Input SurfaceSkinput: Appropriating the Body as an Input Surface
Skinput: Appropriating the Body as an Input Surface
Reem Alattas
 
XML - EXtensible Markup Language
XML - EXtensible Markup LanguageXML - EXtensible Markup Language
XML - EXtensible Markup Language
Reem Alattas
 
Dynamic HTML Event Model
Dynamic HTML Event ModelDynamic HTML Event Model
Dynamic HTML Event Model
Reem Alattas
 
DHTML - Dynamic HTML
DHTML - Dynamic HTMLDHTML - Dynamic HTML
DHTML - Dynamic HTML
Reem Alattas
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
Reem Alattas
 
Linear Search & Binary Search
Linear Search & Binary SearchLinear Search & Binary Search
Linear Search & Binary Search
Reem Alattas
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays
Reem Alattas
 
JavaScript Functions
JavaScript Functions JavaScript Functions
JavaScript Functions
Reem Alattas
 
JavaScript Control Statements II
JavaScript Control Statements IIJavaScript Control Statements II
JavaScript Control Statements II
Reem Alattas
 
JavaScript Control Statements I
JavaScript Control Statements IJavaScript Control Statements I
JavaScript Control Statements I
Reem Alattas
 

More from Reem Alattas (20)

Rumble Lights Pitch Deck
Rumble Lights Pitch DeckRumble Lights Pitch Deck
Rumble Lights Pitch Deck
 
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular RobotsNASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
 
She looks just like me 2017
She looks just like me 2017She looks just like me 2017
She looks just like me 2017
 
Nasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Nasa Datanauts Water Cooler Chat: Robotics for Space ExplorationNasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Nasa Datanauts Water Cooler Chat: Robotics for Space Exploration
 
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space ExplorationNasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
 
She Looks Just Like Me 2017
She Looks Just Like Me 2017She Looks Just Like Me 2017
She Looks Just Like Me 2017
 
Tran helmet pitch
Tran helmet pitchTran helmet pitch
Tran helmet pitch
 
Evolutionary Robotics
Evolutionary RoboticsEvolutionary Robotics
Evolutionary Robotics
 
Create a Need
Create a NeedCreate a Need
Create a Need
 
Enhancing input on and above the interactive surface
Enhancing input on and above the interactive surfaceEnhancing input on and above the interactive surface
Enhancing input on and above the interactive surface
 
Skinput: Appropriating the Body as an Input Surface
Skinput: Appropriating the Body as an Input SurfaceSkinput: Appropriating the Body as an Input Surface
Skinput: Appropriating the Body as an Input Surface
 
XML - EXtensible Markup Language
XML - EXtensible Markup LanguageXML - EXtensible Markup Language
XML - EXtensible Markup Language
 
Dynamic HTML Event Model
Dynamic HTML Event ModelDynamic HTML Event Model
Dynamic HTML Event Model
 
DHTML - Dynamic HTML
DHTML - Dynamic HTMLDHTML - Dynamic HTML
DHTML - Dynamic HTML
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
 
Linear Search & Binary Search
Linear Search & Binary SearchLinear Search & Binary Search
Linear Search & Binary Search
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays
 
JavaScript Functions
JavaScript Functions JavaScript Functions
JavaScript Functions
 
JavaScript Control Statements II
JavaScript Control Statements IIJavaScript Control Statements II
JavaScript Control Statements II
 
JavaScript Control Statements I
JavaScript Control Statements IJavaScript Control Statements I
JavaScript Control Statements I
 

Recently uploaded

Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 

Recently uploaded (20)

Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

Classes and Associations

  • 1. Arab Open University 2nd Semester, 2006-2007 M301 Unit 4.3 Classes and Associations reem.attas@arabou.org.sa
  • 2. Reem AlAttas © 2 Topic Road Map  Simple class models with the UML Precise modeling of associations More modeling techniques Constraining models
  • 3. Reem AlAttas © 3 Class Model Describes the objects and the relationships between them that are needed to implement the required functionality.
  • 4. Reem AlAttas © 4 Searching for Classes  Tangible objects: the physical things in the domain.  Ex. rooms, bills, books, vehicles.  Roles: the roles played by people in the domain.  Ex. employee, guest, member.  Events: the circumstances, episodes, interactions, happenings or significant incidents.  Ex. reservation of a room, the registration of a vehicle, orders, deliveries and transactions.  Organizational units: the groups to which people belong.  Ex. accounts department, a production team or a maintenance crew.
  • 5. Reem AlAttas © 5 … Searching for Classes The focus on looking for nouns in a problem description design does emphasize that you are concentrating on things. In a traditional procedural model, the first area of concern would instead have been actions and activities, which are described by verbs.
  • 6. Reem AlAttas © 6 Object Diagram Model that show a number of concrete instances of a set of relevant classes and the relationships between them. Each object is an instance of a class. Each link is an instance of an association.
  • 7. Reem AlAttas © 7 … Object Diagram
  • 8. Reem AlAttas © 8 Object Diagram with Role Names
  • 9. Reem AlAttas © 9 Class Diagrams A model that expresses generalizations about all valid object diagrams. Box represent class. Line represent association.
  • 10. Reem AlAttas © 10 Class and some instances
  • 11. Reem AlAttas © 11 Associations  The relationships between classes  How classes might be related?  A Guest is related to:  A Hotel by making a reservation.  A Room by currently occupying a room or having stayed in a room previously.  A Room is related to a Hotel by being physically located in a Hotel.
  • 12. Reem AlAttas © 12 … Associations
  • 13. Reem AlAttas © 13 Multiplicities How many of one sort of thing can be related to another sort of thing  determine how many objects are required. minimum .. maximum
  • 14. Reem AlAttas © 14 … Multiplicities
  • 15. Reem AlAttas © 15 … Multiplicities
  • 16. Reem AlAttas © 16 Naming Associations
  • 17. Reem AlAttas © 17 Role Names
  • 18. Reem AlAttas © 18 Two Associations
  • 19. Reem AlAttas © 19 Several Associations
  • 20. Reem AlAttas © 20 Recursive Relationship
  • 21. Reem AlAttas © 21 Topic Road Map Simple class models with the UML  Precise modeling of associations More modeling techniques Constraining models
  • 22. Reem AlAttas © 22 Aggregation A whole–part relationship.  Ex. The whole (an invoice) is made up from the parts (the invoice lines). It is possible to add, remove or replace one of the ‘parts’ and still have a meaningful relationship: an invoice would still be an aggregation of invoice lines if another invoice line were to be added.
  • 23. Reem AlAttas © 23 Composition A chess-board and its squares are much more intimately related than an invoice and its invoice lines because a chess board cannot exist unless it has 64 squares. If you were to remove (or add) a square you would no longer have a recognizable chess-board.
  • 24. Reem AlAttas © 24 … Composition
  • 25. Reem AlAttas © 25 Navigation Put an open arrowhead at one or both ends of an association to indicate that it is possible to reach one class from another following the direction of the arrow.
  • 26. Reem AlAttas © 26 … Navigation An instance of the class Invoice can send messages to instances of the class InvoiceLine, but not the other way round.
  • 27. Reem AlAttas © 27 Qualified Associations If the system you are modeling includes a mechanism for identifying objects uniquely, you can use qualified associations to record this information. In cases where objects can be uniquely identified by combinations of two or more attributes, all those attributes should move into the qualifier.
  • 28. Reem AlAttas © 28 … Qualified Associations
  • 29. Reem AlAttas © 29 Derived Associations Associations can be derived from others already in that diagram. By preceding a role name with a slash, you indicate that an association is derivable.
  • 30. Reem AlAttas © 30 … Derived Associations
  • 31. Reem AlAttas © 31 Topic Road Map Simple class models with the UML Precise modeling of associations  More modeling techniques Constraining models
  • 32. Reem AlAttas © 32 Generalization and Specialization
  • 33. Reem AlAttas © 33 … Generalization and Specialization Superclass  more general element. Subclass  more specific element. A subclass has the same attributes as the superclass, though it may define some additional ones.
  • 34. Reem AlAttas © 34 Specialization of Account
  • 35. Reem AlAttas © 35 Interface the set of operations that specify the service that a class provides.  Ex. The class Account has the interface {credit (amount: Money), debit (amount: Money), getBalance ()} while the class SavingsAccount has the interface {credit (amount: Money), debit (amount: Money), getBalance (), addInterest ()}.
  • 36. Reem AlAttas © 36 Multiple Levels of Specialization
  • 37. Reem AlAttas © 37 Violating the is-a rule
  • 38. Reem AlAttas © 38 Inventing a Superclass <<abstract>>  never be used to create instances.
  • 39. Reem AlAttas © 39 Polymorphism The ability to use instances of various different classes through a shared interface. The interface simply identifies a set of operations by naming each one. It does not provide any implementation.
  • 40. Reem AlAttas © 40 … Polymorphism
  • 41. Reem AlAttas © 41 Dependency
  • 42. Reem AlAttas © 42 Topic Road Map Simple class models with the UML Precise modeling of associations More modeling techniques  Constraining models
  • 43. Reem AlAttas © 43 Constraints Invariants: Boolean expressions that must always remain true.  Ex. valid account numbers need to be within a certain range.
  • 44. Reem AlAttas © 44 … Constraints
  • 45. Reem AlAttas © 45 Object Constraint Language (OCL) Combines logical expressions with set notation to allow a more rigorous specification of a constraint.
  • 46. Reem AlAttas © 46 Constraints across Associations
  • 47. Reem AlAttas © 47 Controlling the Use of Different Accounts
  • 48. Reem AlAttas © 48 Constraint on Related Objects