際際滷

際際滷Share a Scribd company logo
Object Oriented
Analysis and
Design L10
IT1206
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
1
Sameera
Gunathilaka
Lead Software
Engineer
ERP Technical
Consultant
Types of UML
Diagrams
(Modelling Types)
Structural UML
diagrams
Package diagram
Object diagram
Component diagram
Composite structure
diagram
Deployment diagram
Behavioural UML
diagrams
Activity diagram
Sequence diagram
Use case diagram
State diagram
Communication diagram
Interaction overview
diagram
Timing diagram
Recap: What is a Class?
 A Class is a blueprint(template) for an
object
 We use classes to create objects
 Classes describe the type of objects,
while objects are usable instances of
classes
 Objects have states and behaviours
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD 3
Example
A dog has - color,
name, breed as well
as behaviors -
wagging, barking,
eating. An object is
an instance of a class.
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 4
UML Class
Notation
 Class encapsulates: attributes (state) and operations (behaviour)
 attribute has a type
 operation has a signature
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 5
Example
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 6
Class Visibility
 + denotes public attributes or operations
 - denotes private attributes or operations
 # denotes protected attributes or operations
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 7
Parameter
Directionality
 Direction: OUT or INOUT or IN
 It specifies its direction with respect to the caller
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 8
Perspectives
of Class
Diagram
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 9
Focus of this course: Conceptual
Relationships
between
classes
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 11
Strength of
Relationships  Most weakest relationship: Dependency
 Most Strongest relationship: Inheritance
12
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
Dependency
13
A uses B
Changing B will affect the A
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD
Dependency
example
 Cart class depend on the Product class
 Cart uses Products
 Changing the Product will affect the Cart
 Cart class depends on the Product class
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 14
Associations
15
 Connects one instance of a class
with an instance of another class
 Stronger relationship than
Dependency
 An Employee works for a Company
Direction of Association
Unary Association vs Binary Association
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
16
Unary Associations
 Class A knows Class B
 Class B knows nothing about Class A
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
17
Unary Association
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 18
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
19
Binary Associations
 Class C knows about Class D
 Class D knows about Class C
 No arrow
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
20
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
21
Multiplicity
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
22
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
23
Reflective Association
 Objects in the same class can be associated
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
24
Association Class
This places the responsibility for maintaining information pertaining to
the association with the Ownership class.
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
25
Association Class -Example
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
26
Association Class -Example
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
27
Association Class -Activity
 Each Student can take multiple units
 A unit can be taken by many students
 Students who follow units can take exam multiple times if they fail
We need to manage their marks for each attempt in the system
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
28
Association Class -Activity
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
29
Aggregation - Association
 Whole-part relationship( Part of Relationship)
 Removing Class B will not affect to the Class A
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
30
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
31
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
32
Composition - Association
 part depends on the whole
 Parts are destroyed when the whole is destroyed
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
33
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
34
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
35
Inheritance (or
Generalization)
 Represents an "is-a"
relationship.
 An abstract class name is
shown in italics.
 SubClass1 and SubClass2
are specializations of
SuperClass.
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 36
Realization
 Source class support all the
operations of the target
element
 Relationship between the
interface and the
implementing class
 Realization is a relationship
between the blueprint class
and the object containing its
respective implementation
level details.
IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka -
OOAD 37
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
38
Thank you
IT1206 - Institute of Technology, University of Moratuwa
Sameera Gunathilaka - OOAD
39

More Related Content

IT1206- Object Oriented Analysis and Design- L10

  • 1. Object Oriented Analysis and Design L10 IT1206 IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 1 Sameera Gunathilaka Lead Software Engineer ERP Technical Consultant
  • 2. Types of UML Diagrams (Modelling Types) Structural UML diagrams Package diagram Object diagram Component diagram Composite structure diagram Deployment diagram Behavioural UML diagrams Activity diagram Sequence diagram Use case diagram State diagram Communication diagram Interaction overview diagram Timing diagram
  • 3. Recap: What is a Class? A Class is a blueprint(template) for an object We use classes to create objects Classes describe the type of objects, while objects are usable instances of classes Objects have states and behaviours IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 3
  • 4. Example A dog has - color, name, breed as well as behaviors - wagging, barking, eating. An object is an instance of a class. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 4
  • 5. UML Class Notation Class encapsulates: attributes (state) and operations (behaviour) attribute has a type operation has a signature IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 5
  • 6. Example IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 6
  • 7. Class Visibility + denotes public attributes or operations - denotes private attributes or operations # denotes protected attributes or operations IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 7
  • 8. Parameter Directionality Direction: OUT or INOUT or IN It specifies its direction with respect to the caller IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 8
  • 9. Perspectives of Class Diagram IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 9
  • 10. Focus of this course: Conceptual
  • 11. Relationships between classes IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 11
  • 12. Strength of Relationships Most weakest relationship: Dependency Most Strongest relationship: Inheritance 12 IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD
  • 13. Dependency 13 A uses B Changing B will affect the A IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD
  • 14. Dependency example Cart class depend on the Product class Cart uses Products Changing the Product will affect the Cart Cart class depends on the Product class IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 14
  • 15. Associations 15 Connects one instance of a class with an instance of another class Stronger relationship than Dependency An Employee works for a Company
  • 16. Direction of Association Unary Association vs Binary Association IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 16
  • 17. Unary Associations Class A knows Class B Class B knows nothing about Class A IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 17
  • 18. Unary Association IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 18
  • 19. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 19
  • 20. Binary Associations Class C knows about Class D Class D knows about Class C No arrow IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 20
  • 21. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 21
  • 22. Multiplicity IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 22
  • 23. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 23
  • 24. Reflective Association Objects in the same class can be associated IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 24
  • 25. Association Class This places the responsibility for maintaining information pertaining to the association with the Ownership class. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 25
  • 26. Association Class -Example IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 26
  • 27. Association Class -Example IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 27
  • 28. Association Class -Activity Each Student can take multiple units A unit can be taken by many students Students who follow units can take exam multiple times if they fail We need to manage their marks for each attempt in the system IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 28
  • 29. Association Class -Activity IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 29
  • 30. Aggregation - Association Whole-part relationship( Part of Relationship) Removing Class B will not affect to the Class A IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 30
  • 31. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 31
  • 32. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 32
  • 33. Composition - Association part depends on the whole Parts are destroyed when the whole is destroyed IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 33
  • 34. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 34
  • 35. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 35
  • 36. Inheritance (or Generalization) Represents an "is-a" relationship. An abstract class name is shown in italics. SubClass1 and SubClass2 are specializations of SuperClass. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 36
  • 37. Realization Source class support all the operations of the target element Relationship between the interface and the implementing class Realization is a relationship between the blueprint class and the object containing its respective implementation level details. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 37
  • 38. IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 38
  • 39. Thank you IT1206 - Institute of Technology, University of Moratuwa Sameera Gunathilaka - OOAD 39

Editor's Notes

  • #3: We are learning mainly those highlighted diagrams
  • #6: Visibility of Operations and attributes
  • #10: Conceptual: represents the concepts in the domain Specification: focus is on the interfaces of Abstract Data Type (ADTs) in the software Implementation: describes how classes will implement their interfaces
  • #15: Cart class depends on the Product class correct Product class has a dependency on Cart - wrong
  • #17: One way or two way One directional vs Bi-directional
  • #19: Person Has an Address
  • #21: Customer can own accounts Account is belonged to a Customer
  • #24: Hose has one Kitchen, one or many bathroom, one or many bedrooms Kitechn, Bath,Bed rooms are rooms House has a one mail box House can have a mortgage one time or not
  • #25: Company has Employees A single manager responsible for up to 10 workers
  • #31: Belt is a part of me now, but belt can exist without me Watch is a part of me, but it exists without me
  • #32: Removing the 際際滷 will not affect to the Lake
  • #33: Hose has one Kitchen, one or many bathroom, one or many bedrooms Kitechn, Bath,Bed rooms are rooms House has a one mail box House can have a mortgage one time or not
  • #34: Class B live or die with Class B Hand is a part of me, but hand cannot exist without me. But I can exist without hand
  • #35: Department is a part of Company. Department cannot exist without Company. But Company can exist without department.
  • #36: Hose has one Kitchen, one or many bathroom, one or many bedrooms Kitechn, Bath,Bed rooms are rooms House has a one mail box House can have a mortgage one time or not
  • #37: Most strongest relationship