it is about object oriented design, An object contains encapsulated data and procedures grouped together to represent an entity. The 'object interface' defines how the object can be interacted with. An object-oriented program is described by the interaction of these objects. Object-oriented design is the discipline of defining the objects and their interactions to solve a problem that was identified and documented during object-oriented analysis.
What follows is a description of the class-based subset of object-oriented design, which does not include object prototype-based approaches where objects are not typically obtained by instantiating classes but by cloning other (prototype) objects. Object-oriented design is a method of design encompassing the process of object-oriented decomposition and a notation for depicting both logical and physical as well as state and dynamic models of the system under design.
2. Lesson Plan
5min Attendance , Welcome , lesson Overview
20 min Stage1: Design Class Diagram
20 min Stage2: Enterprise Architect Activity develop formal sequence diagram
20 min Stage3 : Business Case
30 min Stage4 : Enterprise Architect Activity develop design class diagram
5 min Summary
ITB6006 Object-Oriented Design
3. Topic
• What is a design class diagram?
• What is the usefulness of a design class diagram?
• How to derive it from other diagrams?
• Organize Classes with Package Diagram
ITB6006 Object-Oriented Design
4. Software Design
• Software Design determines the software architecture specifying
the subsystems , relationships, subsystems’ functions, interfaces,
look and feel of GUI.
ITB6006 Object-Oriented Design
deployment Deployment View
InterfaceLayer «executionEnvironm...
Controller Layer
«executionEnviron...
Database Layer
User
«device»
Software
Controller
«executionEnviron...
Business Object Layer
Responsible for
interacting with
the User/Devices
Responsible for
Executing
Business
Processes
Responsible for
Executing Functions
of Individual Business
Objects
Responsible for
Storing /Retrieving
Objects from a
Database
Requests
Requests
Requests
«flow»
Requests
Requests
N-Tier Architecture
5. What is a design class diagram?
• A UML diagram derived from behavioral and domain
models.
• A blueprint to facilitate implementation, testing and
integration
• Contains all the classes, attributes, relationships
(Generalizations→ inheritance, aggregations → composition
and associations → usage), operations needed to satisfy the
requirements
ITB6006 Object-Oriented Design
6. Usefulness
• Brings together the most significant artifacts in one
diagram
• facilitates quality measurement and assurance
• effort estimation
• work allocation
ITB6006 Object-Oriented Design
7. Business Case
• In a library management System (LIS) you have 2
requirements
• Req1. LIS must allow a client to check out documents
• Req2. LIS must allow a client to return document
• A Scenario is developed to describe a list of interactions
for req1
• A sequence diagram is generated and tweaked to reflect
the interactions
ITB6006 Object-Oriented Design
8. sd 1_Basic_Path
customer :customer
:Checkout Page
:Home Page :CheckoutController :DBmgr d :Document
l :Loan
alt
«click
checkout»
Displays Checkout Page ()
«document numbers»
1.msg:checkout(docNo:String) :String
2.d:getDocument(docNo:String) :Document
returns the document d ()
returns the document()
[d!=null]:3. creates Loan (c:customer, d:Document)
4.save(l:Loan)
5.setAvailable(false:boolean)
6.save(d:Document)
7. msg:"Checkout Successful"()
ITB6006 Object-Oriented Design
Formal Messages:
Action →function call
Data or object required → parameters
If function returns result → variable (more
than one additional calls to get functions are
required)
Decide parameter type a:A
Decide return value type x:function (a:A):X
9. Deriving Formal Messaging
ITB6006 Object-Oriented Design
sd Sequence Rules
Subject Object Acted on
action + other data/objects()
return value()
sd Formal Messages
Subject Object Acted on
returnvalue:action(otherdata/objects)
sd Formal Messages
LoginController
loginPage
verification__result:=verify(uid, passowrd)
sd Sequence Rules
loginPage LoginController
verify uid, password()
verification result()
General Conversion Conversion Example
10. ITB6006 Object-Oriented Design
sd Sequence Rules
Document
CheckoutController
set available to false()
sd Formal Messages
CheckoutController Document
setAvailable(false)
sd Sequence Rules
CheckoutController
CheckoutPage DBMgr
check document with doc no()
get document()
d()
sd Formal Messages
CheckoutController
CheckoutPage DBMgr
msg:checkout(docNo:string) :string
d:getDocument(docNo:string) :Document
12. Identify Classes from Sequence Diagrams
• Classes of Objects that sends and receives messages are
5 types : GUI, Controller, DB Manager, Other classes
• Classes of Objects that are passed as parameters to a
function call
• Classes that serve as return types
• Classes from Domain Model
ITB6006 Object-Oriented Design
13. Denoting Accessors
• Due to encapsulation hiding
including all getters and setters will cause the design
diagram to look crowded
• Unordinary getters and setters must be denoted
Ex. Database Manager class get and set operations
getX():X, getY():Y ,…,where X and Y are class names
ITB6006 Object-Oriented Design
14. sd 1_Basic_Path
A :A B :B
x= m(...) :X
Identify methods from Sequence Diagrams
Message denoted as
x:=m():X
Sent from object A to object B
A calls the m(…) function of B
A saves the result in variable x of
type X
ex.d:=getDocument(callNo:string)
:Document
ex. save(l:loan)
ex. save (d:Document)
ITB6006 Object-Oriented Design
class Class Model
B
+ x:m() :X
15. Identify Attributes from Sequence Diagrams
• Attributes are scalar types not objects class types
• Identified from messages or methods that
• retrieve objects
• Is ordinary get and set ex. get(docNo)
• Ex. Is Available ():boolean , set Available(b:boolean) where
Available is an adjective
• compute ex. calculateArea ():int
• Are constructors: ex. create document ( docNo:string , title:
string, author:string)
ITB6006 Object-Oriented Design
16. Identify relationships
• Identify create from calls to constructors
ex. A creates object of B
ex. CheckoutController creates Loan
• Identify use relationship from parameters
ex. A uses B in a function call
• Object of A passes an object of B as a parameter
ex. DBMgr save (d:Document)
ex. DBMgr save (l:loan)
• Object of class A receives and object of class B as a return value
ex. D:=getDocument (docNo:String):Document // from
checkoutcontroller to the Document
ITB6006 Object-Oriented Design
17. Identify relationships
• Identify call relationships
ex. Object of class A calls a method in B
ex. CheckoutGUI calls Checkout Controller
• Identify aggregation , inheritance from Domain Model
ITB6006 Object-Oriented Design
18. Review Design Class Diagram
• Ensure that the
classes ,
attributes,
operations,
parameter types,
return types,
return types,
relationships
…are derived correctly
• Does the diagram contains unnecessary classes?
ITB6006 Object-Oriented Design
19. Review Design Class Diagram
• Ensure that the
classes ,
attributes,
operations,
parameter types,
return types,
return types,
relationships
…names are easy to understand
ITB6006 Object-Oriented Design
Scenario
Customer Clicks on CheckoutDocument Button on the Home Page
Home Page Displays Checkout Page
Customer enters the Doc numbers of documents to be checked out and clicks the submit button on Checkout Page
Checkout Page calls checkout(Doc No:String) of CheckoutController
CheckoutController calls getDocument(callNo:String) of DBmgr
DBmgr returns the document d to CheckoutController
CheckoutController creates Loan
CheckoutController calls save(l:Loan) of DBmgr
CheckoutController calls setAvailable(false:boolean) of Document
CheckoutController calls save(d:Document) of DBmgr
CheckoutController displays a confirmation msg "Checkout Successful" to the Checkout Page
Checkout Page displays msg toThe Customer
Customer sees the msg
In this case 2 objects are interacting and parameter are required a return value is introduced
In this case 3 objects are interacting and a parameter is required one of the messages is a function call and the other is the function itself