SlideShare a Scribd company logo
1 of 36
UNIT – IV
CHAPTER – 8
Identifying Object Relationships, Attributes and Methods
Introduction
Objects relate with each other
Three types of relationships among objects are
1. Association: how are objects associated? This information
will guide in designing classes
2. Super – sub structure: how are objects organized into
superclass and subclass? This information provides us the
direction of inheritance
3. Aggregation and a – part – of structure: what is the
composition of complex classes? This provides information
in defining mechanisms that properly manage object
within - object
Relationships among objects are known as
associations
E.g.: placing an order
A – part – of structure is a familiar means of
organizing components of a bigger object
e.g. : walls, windows, doors are a – part – of a
bigger object building
Associations
Association represents a physical or conceptual
connection b/w two or more objects
Binary associations are shown as lines connecting
tow class symbols
Ternary and higher – order associations are shown
as diamonds connecting to a class symbol by lines
and the association name is written above or below
the line
diagram
Identifying Associations
Any dependency relationship b/w two or more
classes is an association. The responsibilities has to
be examined to determine dependencies
The following questions can help us to identify
association
Is the class capable of fulfilling the required task by
itself?
If not, what does it need?
From what other class can it acquire what it needs?
Guidelines for Identifying Association
1. A dependency b/w two or more classes may be an
association
Association verb or prepositional phase such
as part of , next to, works for, or contained in
2. Reference from one class to another is an
association. Some associations are implicit or
taken from general knowledge
Common Association Patterns
1.Location association – next to, part of, contained in
e.g.: cheddar cheese is a – part – of soup.
Wheel is a – part – of cart
2.Communication association - talk to, order to
e.g.: customer orders to supplier
diagram
Eliminate Unnecessary Associations
1.Implementation association are concerned with the
implementation or design of the class within certain
programming or development environments and
not relationships among business objects
2.Ternary associations is an association where more
than two classes are involved
3.Directed actions (or derived) associations can be
defined in terms of other associations
e.g.: Grand Parent of ken can be defined in terms of
the parent association
•Diagram
Super – Sub Class Relationships
Represents inheritance b/w the related classes
Also known as generalization hierarchy
Takes advantages of the commonality b/w classes to
create new classes
Is a relationship b/w classes, where one class is the
parent class of another(derived) class
Parent class is also known as base or super class or
ancestor
Real advantage is use can build on what we already
have and reuse what use already have
Guidelines for Identifying Super – sub Relationship, a
Generalization:
1.Top – down
Look for various adjectives in a class
Avoid over refinement
Specialize only when subclasses have significant
behavior
2.Bottom – up
Look for classes with similar attributes
Apply the generalization principles
3.Reusabiltiy
Do not create very specialized classes at the top of the
hierarchy
Using generalized classes, create new classes for reuse
4. Multiple inheritance
Avoid excessive use of multiple inheritance
Diagram
Benefits:
inherit from the most appropriate class and add an
object of another class as an attribute
A – part – of Relationships – Aggregation
A – part – of relationship, also called aggregation
represents the situation where a class consists of
several component classes
A class that is composed of other classes does not
behave like its parts but it behaves differently
E.g.: car consists of many classes, one class is radio,
but car does not behave like radio
2 major properties
(i) transitivity
(ii) antisymmetry
Transitivity
A B C
A part of B and B is a part of C so A is a part of C
e.g.: diagram
Antisymmetry
A is a part of B then B is not a part of A
e.g.: engine is a part of car, but car is not a part of car
A clear distinction b/w the part and the whole can help
us determine where the responsibilities of certain
behavior must reside
Does the part class belong to a problem domain?
Does the part class capture more than a single
value?(yes, include as an attribute with whole class)
Fig – a – part – of composition
diagram
Aggregation is represented as container or
collection as hollow diamonds and use a solid
diamond to represent composition – strong form of
aggregation
A – part – of Relationship Patterns
1.Assembly is constructed from the parts and an
assembly – part situation physically exists
e.g.: soup is an assembly of onion, butter, flour,
cheese and so on.
2.Container
A physical whole encompasses but is not
constructed from physical parts
Diagram
3.Collection – member
A conceptual whole encompasses parts that may be
physical or conceptual
e.g.: football team is a collection of players
diagram
Case study : Relationship Analysis for the ViaNet Bank
ATM System
The system is developed using an iterative process
where the analysis is completed before the design
starts
Identifying Classes Relationships
(i) Bank (ii) Bank Client (iii)Account (iv) ATM Machine
(v) Transaction (vi) Checking Account (vii) Savings
Account
Different relationships exist in the ViaNet Bank system
and use we have to define each one of the
relations separtely
Developing a UML Class Diagram Based on the Use –
case Analysis
UML class diagram is the main static analysis and
design diagram of a system
The analysis consists of the following class diagrams
One class diagram for the system shows the identity
and definition of classes in the system, their
interrelationships and various packages containing
groupings of classes
Multiple class diagrams that represent various
pieces, or views of the system class diagram
Multiple class diagrams, that show the specific
static relationships b/w various classes
Create the classes
diagram
Defining Association Relationships
Identifying association begins by analyzing the
interactions of each class
General Guidelines
1.Association corresponds to verb or prepositional
phrases
e.g.: part of, next to, works for, or contained in
2.Some associations are taken from general
knowledge
some common patterns of association are
1.Location association: next to, part of, contained in
(part – of relation is a special type of association)
2.Directed actions association
3.Communication association: talk to , order from
e.g.:
Each account belongs to a bank client
therefore there is association b/w Bank client and
account class
Establish cardinality among these classes
All associations are considered one to one (one
client can have only one account)
Therefore each Bank client have one or two
accounts so change the cardinality of association
diagram
Associations among the ViaNet bank ATM system
classes
Diagram
Defining Super – Sub Relationships
Guidelines for identifying super – sub relationships
 Top – down – noun phrase composed of various
adjective in the class name
 Bottom – up – look for classes with similar
attributes or methods
 Reusability – move attributes and behavior as high
as possible in the hierarchy
 Multiple Inheritance – avoid excess usage
Fig. Super – Sub relationships among the Account,
Savings Account and Checking Account classes
diagram
Identifying the aggregation / a – part – of Relationship
1.Assembly
2.Container
3.Collection – Member
Association, generalization and aggregation among
the ViaNet bank classes
diagram
Class Responsibility: Identifying Attributes and
Methods
Identifying attributes and methods is like finding
classes – difficult activity and an iterative process
Questions – for identifying responsibilities of
classes
What information about an object should we keep
track of ?
Help to identify attributes of a class
What services must a class provide?
help to identify a class’s method
Class Responsibility: Defining Attributes By Analyzing use
cases and other UML Diagrams
Attributes can be derived from scenario testing
Main goal – understand what the class is responsible
for knowing. Responsibility is the key issue
As an object in an object oriented environment the
questions to be asked are
How am I going to be used?
How am I going to collaborate with other classes?
How am I described in the context of this system’s
responsibility?
What do I need to know?
What state information do I need to remember over
time?
What states can I be in?
Guidelines for Defining Attributes
i. Attributes usually correspond to nouns followed
by prepositional phrases such as cost of the soup
 Attributes also may correspond to adjectives or
adverbs
ii. Keep class simple: define attributes for a particular
object stats
iii. Attributes are less likely to be defined in the
problem statement
iv. Omit derived attributes (e.g.) do not use time
elapsed since other
v. Do not carry discovery of attributes to excess
Defining Attributes for the ViaNet Bank Objects
Defining Attributes for the BankClient Class
Attributes of BankClient
firstName
lastName
pinNumber
cardNumber
account:Account
PINnumber
cardNumber
Defining Attributes for the Account Class
AcctNumber
balance
Defining Attributes for the Transaction Class
transID transTime amount
transDate transType postBalance
Defining Attributes for the ATM machine class
address
state
Object Responsibility: Methods and Messages
Methods and messages are the workhorses of
object – oriented systems
Object must provide some services
In OO environment, every piece of data, or object is
surrounded by a rich set of routines called methods.
These methods do everything from printing the
object to initializing its variables
every class is responsible for storing certain
information from the domain knowledge. If an
object requires certain information to perform
some operation for which it is responsible, it is
logical to assign it the responsibility for maintaining
the information
Methods are responsible for managing the value of
attributes such as query, updating, reading and
writing; we need a set of operations that can
maintain or change values
Defining Methods by Analyzing UML Diagrams and
use cases
An event is considered to be an action that
transmits information. These actions are operations
that the objects must perform and, as in attributes,
methods also can be derived from scenario testing
To define methods for Account class, look to the
sequence diagram for use cases
Deposit Checking
Deposit Savings
Withdraw Checking
Withdraw More from Checking
Withdraw Savings
Withdraw Savings Denied
Checking Transaction History
Savings Transaction History
Defining methods for ViaNet Bank Objects
Defining Account class Operations
Methods
deposit
Withdraw
Create Transaction
Defining BankClient Class Operations
method to validate client’s passwords
Defining CheckingAccount Class Operations
withdraw service
Fig: a more complete UML class diagram of the ViaNet
bank ATM system

More Related Content

What's hot

Object and class relationships
Object and class relationshipsObject and class relationships
Object and class relationshipsPooja mittal
 
Ports & sockets
Ports  & sockets Ports  & sockets
Ports & sockets myrajendra
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4PrathimaBaliga
 
CS6003 AD HOC AND SENSOR NETWORKS
CS6003 AD HOC AND SENSOR NETWORKSCS6003 AD HOC AND SENSOR NETWORKS
CS6003 AD HOC AND SENSOR NETWORKSKathirvel Ayyaswamy
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methodsShubham Dwivedi
 
Vb.net session 01
Vb.net session 01Vb.net session 01
Vb.net session 01Niit Care
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan systemshalinikarunakaran1
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologiesAmith Tiwari
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithmAnkit Garg
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming languageMd.Al-imran Roton
 
Address in the target code in Compiler Construction
Address in the target code in Compiler ConstructionAddress in the target code in Compiler Construction
Address in the target code in Compiler ConstructionMuhammad Haroon
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 

What's hot (20)

Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Object and class relationships
Object and class relationshipsObject and class relationships
Object and class relationships
 
Ports & sockets
Ports  & sockets Ports  & sockets
Ports & sockets
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
CS6003 AD HOC AND SENSOR NETWORKS
CS6003 AD HOC AND SENSOR NETWORKSCS6003 AD HOC AND SENSOR NETWORKS
CS6003 AD HOC AND SENSOR NETWORKS
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Dynamic Itemset Counting
Dynamic Itemset CountingDynamic Itemset Counting
Dynamic Itemset Counting
 
The medium access sublayer
 The medium  access sublayer The medium  access sublayer
The medium access sublayer
 
Unit 4
Unit 4Unit 4
Unit 4
 
Vb.net session 01
Vb.net session 01Vb.net session 01
Vb.net session 01
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
 
Infix to postfix conversion
Infix to postfix conversionInfix to postfix conversion
Infix to postfix conversion
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologies
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
Address in the target code in Compiler Construction
Address in the target code in Compiler ConstructionAddress in the target code in Compiler Construction
Address in the target code in Compiler Construction
 
Java utility classes
Java utility classesJava utility classes
Java utility classes
 
Code generation
Code generationCode generation
Code generation
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Spline representations
Spline representationsSpline representations
Spline representations
 

Similar to Chapter 8 ooad

Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented DesignAravinth NSP
 
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxanguraju1
 
Ooad 2marks
Ooad 2marksOoad 2marks
Ooad 2marksAsh Wini
 
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.pptChishaleFriday
 
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptxRokaKaram
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagramskebsterz
 
Programming Paradigm Seminar 4
Programming Paradigm Seminar 4Programming Paradigm Seminar 4
Programming Paradigm Seminar 4neoxiuting
 
L ab # 07
L ab # 07L ab # 07
L ab # 07Mr SMAK
 
Advanced Structural Modeling
Advanced Structural ModelingAdvanced Structural Modeling
Advanced Structural ModelingAMITJain879
 
Uml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot netUml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot netmekhap
 

Similar to Chapter 8 ooad (20)

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
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
Jar chapter 2
Jar chapter 2Jar chapter 2
Jar chapter 2
 
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptx
 
Class diagram
Class diagramClass diagram
Class diagram
 
Ooad 2marks
Ooad 2marksOoad 2marks
Ooad 2marks
 
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.ppt
 
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx
 
5 transition to design
5 transition to design5 transition to design
5 transition to design
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagrams
 
Programming Paradigm Seminar 4
Programming Paradigm Seminar 4Programming Paradigm Seminar 4
Programming Paradigm Seminar 4
 
L ab # 07
L ab # 07L ab # 07
L ab # 07
 
Advanced Structural Modeling
Advanced Structural ModelingAdvanced Structural Modeling
Advanced Structural Modeling
 
Software Testing and UML Lab
Software Testing and UML LabSoftware Testing and UML Lab
Software Testing and UML Lab
 
Unit 2
Unit 2Unit 2
Unit 2
 
Uml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot netUml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot net
 
Inheritance
InheritanceInheritance
Inheritance
 
Unit_2.pdf
Unit_2.pdfUnit_2.pdf
Unit_2.pdf
 

More from anujabeatrice2 (7)

Chapter 7 ooad
Chapter 7 ooadChapter 7 ooad
Chapter 7 ooad
 
Ooad ch 5
Ooad ch 5Ooad ch 5
Ooad ch 5
 
Ooad ch 4
Ooad ch 4Ooad ch 4
Ooad ch 4
 
Ooad ch 3
Ooad ch 3Ooad ch 3
Ooad ch 3
 
Ooad ch 2
Ooad ch 2Ooad ch 2
Ooad ch 2
 
Ooad ch 1_2
Ooad ch 1_2Ooad ch 1_2
Ooad ch 1_2
 
Ooad ch 6
Ooad ch 6Ooad ch 6
Ooad ch 6
 

Recently uploaded

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Recently uploaded (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

Chapter 8 ooad

  • 1. UNIT – IV CHAPTER – 8 Identifying Object Relationships, Attributes and Methods Introduction Objects relate with each other Three types of relationships among objects are 1. Association: how are objects associated? This information will guide in designing classes 2. Super – sub structure: how are objects organized into superclass and subclass? This information provides us the direction of inheritance 3. Aggregation and a – part – of structure: what is the composition of complex classes? This provides information in defining mechanisms that properly manage object within - object
  • 2. Relationships among objects are known as associations E.g.: placing an order A – part – of structure is a familiar means of organizing components of a bigger object e.g. : walls, windows, doors are a – part – of a bigger object building Associations Association represents a physical or conceptual connection b/w two or more objects Binary associations are shown as lines connecting tow class symbols
  • 3. Ternary and higher – order associations are shown as diamonds connecting to a class symbol by lines and the association name is written above or below the line diagram
  • 4. Identifying Associations Any dependency relationship b/w two or more classes is an association. The responsibilities has to be examined to determine dependencies The following questions can help us to identify association Is the class capable of fulfilling the required task by itself? If not, what does it need? From what other class can it acquire what it needs?
  • 5. Guidelines for Identifying Association 1. A dependency b/w two or more classes may be an association Association verb or prepositional phase such as part of , next to, works for, or contained in 2. Reference from one class to another is an association. Some associations are implicit or taken from general knowledge Common Association Patterns 1.Location association – next to, part of, contained in e.g.: cheddar cheese is a – part – of soup. Wheel is a – part – of cart
  • 6. 2.Communication association - talk to, order to e.g.: customer orders to supplier diagram
  • 7. Eliminate Unnecessary Associations 1.Implementation association are concerned with the implementation or design of the class within certain programming or development environments and not relationships among business objects 2.Ternary associations is an association where more than two classes are involved 3.Directed actions (or derived) associations can be defined in terms of other associations e.g.: Grand Parent of ken can be defined in terms of the parent association
  • 9. Super – Sub Class Relationships Represents inheritance b/w the related classes Also known as generalization hierarchy Takes advantages of the commonality b/w classes to create new classes Is a relationship b/w classes, where one class is the parent class of another(derived) class Parent class is also known as base or super class or ancestor Real advantage is use can build on what we already have and reuse what use already have
  • 10. Guidelines for Identifying Super – sub Relationship, a Generalization: 1.Top – down Look for various adjectives in a class Avoid over refinement Specialize only when subclasses have significant behavior 2.Bottom – up Look for classes with similar attributes Apply the generalization principles 3.Reusabiltiy Do not create very specialized classes at the top of the hierarchy Using generalized classes, create new classes for reuse
  • 11. 4. Multiple inheritance Avoid excessive use of multiple inheritance Diagram Benefits: inherit from the most appropriate class and add an object of another class as an attribute
  • 12. A – part – of Relationships – Aggregation A – part – of relationship, also called aggregation represents the situation where a class consists of several component classes A class that is composed of other classes does not behave like its parts but it behaves differently E.g.: car consists of many classes, one class is radio, but car does not behave like radio 2 major properties (i) transitivity (ii) antisymmetry
  • 13. Transitivity A B C A part of B and B is a part of C so A is a part of C e.g.: diagram Antisymmetry A is a part of B then B is not a part of A e.g.: engine is a part of car, but car is not a part of car A clear distinction b/w the part and the whole can help us determine where the responsibilities of certain behavior must reside Does the part class belong to a problem domain? Does the part class capture more than a single value?(yes, include as an attribute with whole class)
  • 14. Fig – a – part – of composition diagram
  • 15. Aggregation is represented as container or collection as hollow diamonds and use a solid diamond to represent composition – strong form of aggregation A – part – of Relationship Patterns 1.Assembly is constructed from the parts and an assembly – part situation physically exists e.g.: soup is an assembly of onion, butter, flour, cheese and so on. 2.Container A physical whole encompasses but is not constructed from physical parts
  • 16. Diagram 3.Collection – member A conceptual whole encompasses parts that may be physical or conceptual e.g.: football team is a collection of players diagram
  • 17. Case study : Relationship Analysis for the ViaNet Bank ATM System The system is developed using an iterative process where the analysis is completed before the design starts Identifying Classes Relationships (i) Bank (ii) Bank Client (iii)Account (iv) ATM Machine (v) Transaction (vi) Checking Account (vii) Savings Account Different relationships exist in the ViaNet Bank system and use we have to define each one of the relations separtely
  • 18. Developing a UML Class Diagram Based on the Use – case Analysis UML class diagram is the main static analysis and design diagram of a system The analysis consists of the following class diagrams One class diagram for the system shows the identity and definition of classes in the system, their interrelationships and various packages containing groupings of classes Multiple class diagrams that represent various pieces, or views of the system class diagram Multiple class diagrams, that show the specific static relationships b/w various classes
  • 20. Defining Association Relationships Identifying association begins by analyzing the interactions of each class General Guidelines 1.Association corresponds to verb or prepositional phrases e.g.: part of, next to, works for, or contained in 2.Some associations are taken from general knowledge some common patterns of association are 1.Location association: next to, part of, contained in (part – of relation is a special type of association)
  • 21. 2.Directed actions association 3.Communication association: talk to , order from e.g.: Each account belongs to a bank client therefore there is association b/w Bank client and account class Establish cardinality among these classes All associations are considered one to one (one client can have only one account) Therefore each Bank client have one or two accounts so change the cardinality of association
  • 23. Associations among the ViaNet bank ATM system classes Diagram
  • 24. Defining Super – Sub Relationships Guidelines for identifying super – sub relationships  Top – down – noun phrase composed of various adjective in the class name  Bottom – up – look for classes with similar attributes or methods  Reusability – move attributes and behavior as high as possible in the hierarchy  Multiple Inheritance – avoid excess usage
  • 25. Fig. Super – Sub relationships among the Account, Savings Account and Checking Account classes diagram
  • 26. Identifying the aggregation / a – part – of Relationship 1.Assembly 2.Container 3.Collection – Member Association, generalization and aggregation among the ViaNet bank classes diagram
  • 27. Class Responsibility: Identifying Attributes and Methods Identifying attributes and methods is like finding classes – difficult activity and an iterative process Questions – for identifying responsibilities of classes What information about an object should we keep track of ? Help to identify attributes of a class What services must a class provide? help to identify a class’s method
  • 28. Class Responsibility: Defining Attributes By Analyzing use cases and other UML Diagrams Attributes can be derived from scenario testing Main goal – understand what the class is responsible for knowing. Responsibility is the key issue As an object in an object oriented environment the questions to be asked are How am I going to be used? How am I going to collaborate with other classes? How am I described in the context of this system’s responsibility? What do I need to know? What state information do I need to remember over time? What states can I be in?
  • 29. Guidelines for Defining Attributes i. Attributes usually correspond to nouns followed by prepositional phrases such as cost of the soup  Attributes also may correspond to adjectives or adverbs ii. Keep class simple: define attributes for a particular object stats iii. Attributes are less likely to be defined in the problem statement iv. Omit derived attributes (e.g.) do not use time elapsed since other v. Do not carry discovery of attributes to excess
  • 30. Defining Attributes for the ViaNet Bank Objects Defining Attributes for the BankClient Class Attributes of BankClient firstName lastName pinNumber cardNumber account:Account PINnumber cardNumber
  • 31. Defining Attributes for the Account Class AcctNumber balance Defining Attributes for the Transaction Class transID transTime amount transDate transType postBalance Defining Attributes for the ATM machine class address state
  • 32. Object Responsibility: Methods and Messages Methods and messages are the workhorses of object – oriented systems Object must provide some services In OO environment, every piece of data, or object is surrounded by a rich set of routines called methods. These methods do everything from printing the object to initializing its variables every class is responsible for storing certain information from the domain knowledge. If an object requires certain information to perform some operation for which it is responsible, it is logical to assign it the responsibility for maintaining the information
  • 33. Methods are responsible for managing the value of attributes such as query, updating, reading and writing; we need a set of operations that can maintain or change values Defining Methods by Analyzing UML Diagrams and use cases An event is considered to be an action that transmits information. These actions are operations that the objects must perform and, as in attributes, methods also can be derived from scenario testing To define methods for Account class, look to the sequence diagram for use cases
  • 34. Deposit Checking Deposit Savings Withdraw Checking Withdraw More from Checking Withdraw Savings Withdraw Savings Denied Checking Transaction History Savings Transaction History
  • 35. Defining methods for ViaNet Bank Objects Defining Account class Operations Methods deposit Withdraw Create Transaction Defining BankClient Class Operations method to validate client’s passwords Defining CheckingAccount Class Operations withdraw service
  • 36. Fig: a more complete UML class diagram of the ViaNet bank ATM system