Presentation is loading. Please wait.

Presentation is loading. Please wait.

CONCEPTUAL DESIGN: UML CLASS DIAGRAM RELATIONSHIPS

Similar presentations


Presentation on theme: "CONCEPTUAL DESIGN: UML CLASS DIAGRAM RELATIONSHIPS"— Presentation transcript:

1 CONCEPTUAL DESIGN: UML CLASS DIAGRAM RELATIONSHIPS

2 What is UML? Is a language. It is not simply a notation for drawing diagrams, but a complete language for capturing knowledge(semantics) about a subject and expressing knowledge(syntax) regarding the subject for the purpose of communication. Applies to modeling and systems. Modeling involves a focus on understanding a subject (system) and capturing and being able to communicated in this knowledge. It is the result of unifying the information systems and technology industry’s best engineering practices (principals, techniques, methods and tools).

3 Unified Modeling Language (UML)
used for both database and software modeling version 1.1 was adopted in November 1997 by the Object Management Group (OMG) as a standard language for object-oriented analysis and design Initially based on a combination of the Booch, OMT (Object Modeling Technique) and OOSE (Object-Oriented Software Engineering) methods, UML was refined and extended by a consortium of several companies, and is undergoing minor revisions by the OMG Revision Task Force. Ivar Jacobson is known as the father of Use Cases. Refernces

4

5 UML Diagrams UML includes diagrams for use cases
static structures (class and object diagrams) behavior (state-chart, activity, sequence and collaboration diagrams) implementation (component and deployment diagrams). For data modeling purposes UML uses class diagrams, to which constraints in a textual language may be added

6 Identify the information system’s purpose
A Simplified Object-Oriented Systems Analysis & Conceptual Design Methodology Activities Identify the information system’s purpose Identify the information system’s actors and features Identify Use Cases and create a Use Case Diagram Identify Objects and their Classes and create a Class Diagram Create Interaction/Scenario Diagrams Create Detail Logic for Operations Repeat activities 1-6 as required to refine the “blueprints”

7 Defining Class Class Objects
A CLASS is a template (specification, blueprint) for a collection of objects that share a common set of attributes and operations. HealthClubMember Class Objects attributes operations

8 Relationships Generalization (Class-to-Class) (Superclass/Subclass)
A RELATIONSHIP is what a class or an object knows about another class or object. Generalization (Class-to-Class) (Superclass/Subclass) Inheritance Ex: Person - FacultyPerson, StudentPerson, Staff... Ex: ModesOfTravel - Airplane, Train, Auto, Cycle, Boat... [Object] Associations FacultyInformation - CourseInformation StudentInformation - CourseInformation [Object] Aggregations & Composition (Whole-Part) Assembly - Parts Group - Members Container - Contents F o u r T y p e s

9 Relationships Exist to: 1) show relationships 2) enforce integrity 3) help produce results In this example: Removal of a University Course should also remove Students that are in the Course but not Student Information. Removal of a Student should also remove the Courses that the Student is in but not the University Course. Removal of a Student in a Course should not affect either University Course or Student Information. UniversityCourse StudentInformation 1 0,m 1 StudentInCourse 0,m

10 { UML Class Diagram Notation 1 of 2 Class attributes operations Member
memberNumber firstName lastName telephone address city etc... checkOutVideo checkInVideo buyItem attributes operations { Expanded view of a Class into its three sections: Top: Class Name Middle: attributes Bottom: operations

11 UML Class Diagram Notation
2 of 2 Class Generalization Relationship Object Aggregation Association 0..* 1..* Object Composition Association 0..* 1 Object Association n Will always be “1”

12 Class Diagram Relationships
Generalization Object Association Aggregation Composition

13 Generalization (Class-to-Class) (superclass – subclass; supertype – subtype)
A Generalization follows a “is a” or “is a kind of” heuristic from a specialization class to the generalization class. (e.g., student “is a” person, video “is a kind of” inventory). Common attributes, operations and relationships are located in the generalization class and are inherited by the specialization classes Unique attributes, operations and relationships are located in the specialization classes. Inherited attributes and operations may be overridden or enhanced in the specialization class depending on programming language support. Inherited operations in the specialization classes may be polymorphic. Only use when objects do NOT “transmute” (add, copy, delete) Multiple inheritance is allowed in the UML but can complicate the class model’s understanding and implementation (e.g., C++ supports but Java and Smalltalk do not).

14 Generalization Example
Others: Transactions Things Places Etc... Role attributes operations Staff Faculty Student Visitor attributes attributes attributes attributes operations operations operations operations

15 Poor Generalization Example
(violates the “is a” or “is a kind of” heuristic) Person attributes operations Head Arm Leg attributes attributes attributes operations operations operations

16 Generalization Inheritance
One-Way Inheritance from the Generalization to the Specialization Common o1 o2 o3 Specialization a1 a2 a3 a4 a5 a6 Specialization a4 a5 a6 Unique o1 o2 o3 o4 o5 o6 o4 o5 o6 (a = attribute; o = operation)

17 Generalization - Multiple Inheritance
Specialization a6 a7 a8 a1 a2 (which one?) a3 a4 a5 inherited attributes o6 o7 o8 o1 o2 o3 o4 o5 (which one?) inherited operations

18 UML Generalization Notation
Note Supertype Useful text discriminator Subtype 1 Subtype 2 Note: Supertype = Superclass; Subtype = Subclass

19 Generalization - Multiple Classification
Discriminator Doctor role Person Nurse patient Physical- therapist Patient

20 Rational Rose Class Diagram Example

21 Associations Relationships between instances (objects) of classes
Conceptual: associations can have two roles (bi-directional): source --> target target --> source roles have multiplicity (e.g., cardinality, constraints) To restrict navigation to one direction only, an arrowhead is used to indicate the navigation direction No inheritance as in generalizations

22 Object Association Relationship Patterns
b) Object Aggregation Associations Whole attributes operations Class A attributes operations x x x x x x x Part1 attributes operations Part2 attributes operations PartN attributes operations x Class B attributes operations c) Object Composition Associations (y may not be “1”) Whole attributes operations Class A attributes operations x Class B attributes operations 1 1 x 1 y y y a) Object Associations Part1 attributes operations Part2 attributes operations PartN attributes operations

23 Associations role B Class A Class B role A Example: Employee Company
Person Employer

24 Multiplicities 1 Class exactly one 0..* many (zero or more) Class 0..1
optional (zero or one) Class m..n numerically specified Class Example: 0..* Course CourseOffering 1

25 Aggregation & Composition
Aggregation (shared aggregation): is a specialized form of ASSOCIATION in which a whole is related to its part(s). is known as a “part of” or containment relationship and follows the “has a” heuristic three ways to think about aggregations: whole-parts container-contents group-members Composition (composite aggregation): is a stronger version of AGGREGATION the “part(s)” may belong to only ONE whole the part(s) are usually expected to “live” and “die” with the whole (“cascading delete”) Aggregation vs. Composition vs. Association???

26 Aggregation Composition
Faculty SalesOrder 1..* 1 (team-teaching is possible) 0..* 1..* CourseTeaching SalesOrderLineItem (another: assembly --> part) (another: hand --> finger)

27 Composition Composition is often used in place of Generalization (inheritance) to avoid “transmuting” (adding, copying, and deleting of objects) Person {abstract} 1 Person FacultyRole 0..1 1 Faculty Student 0..1 StudentRole FacultyStudent Note: Attributes may need to be considered to more-fully understand

28 Video Store – UML Class Diagram
1 1 Inventory SaleItem RentalItem Video Game ConcessionItem VCR 0..* 0..* Transaction Employee StoreLocation 1 1 SaleTransaction RentalTransaction Suplier 0..* 1 1 0..* 1 1 0..1 0..* Member PurchaseOrder 1..* 1..* 1 1..* SaleRentalLineItem 0..* 0..* PurchaseOrderLineItem

29

30

31

32 Conclusion UML is effective for modeling large, complex software
systems It is simple to learn for most developers, but provides advanced features for expert analysts, designers and architects It can specify systems in an implementation-independent manner Structural modeling specifies a skeleton that can be refined and extended with additional structure and behavior Use case modeling specifies the functional requirements of system in an object-oriented manner


Download ppt "CONCEPTUAL DESIGN: UML CLASS DIAGRAM RELATIONSHIPS"

Similar presentations


Ads by Google