Download presentation
Presentation is loading. Please wait.
Published byTobias Dennis Modified over 6 years ago
1
The OO Solution The OO model closely resembles the problem domain
Base your model on the objects in the problem domain Iteratively refine the high-level model until you have an implementation Attempt to avoid big conceptual jumps during the development process CSE 435: Software Engineering
2
Objects VISA State of Michigan J. Q. Public 123 4567 887766 998
Drivers License State of Michigan A CSE 435: Software Engineering
3
Attributes and Operations
Person class J. Q. Public VISA Drivers License State of Michigan A Attributes name age height weight Operations move change-job width id-number issue change Person objects Card objects Card class abstracts to
4
Characteristics of Objects
Identity Discrete and distinguishable entities Classification Abstract entities with the same structure (attributes) and behavior (operations) into classes Polymorphism The same operation may behave differently on different classes Inheritance Sharing of attributes and operations based on a hierarchical relationship CSE 435: Software Engineering
5
The Class Diagrams CSE 435: Software Engineering
6
Objects Something that makes sense in the application context (application domain) J.Q. Public Joe’s Homework Assignment 1 J. Q. Public’s drivers license All objects have identity and are distinguishable NOT objects Person Drivers license CSE 435: Software Engineering
7
Classes Describes a group of objects with similar properties (attributes), common behavior (operations), common relationships to other classes, and common semantics Person J. Q. Public Joe Smith D. Q. Public Card Credit card Drivers license Teller card CSE 435: Software Engineering
8
Class Diagrams Class diagram Instance diagram D. Q. Public: age= 32
Person J. Q. Public: age= 35 Person Person age: integer Class with attributes Objects with values Objects have an identity Do not explicitly list object identifiers SSN OK! CSE 435: Software Engineering
9
Examples CSE 435: Software Engineering
10
Operations and Methods
Transformation that can be applied to or performed by an object May have arguments CSE 435: Software Engineering
11
Object Notation - Summary
CSE 435: Software Engineering
12
Associations Conceptual connection between classes Class diagrams
A credit card is issued-by a bank A person works-for a company Issued-by Credit Card Bank Class diagrams Works-for Person Company J.Q. Public: Person Michigan State Univ: Company Works-for Instance diagram Age=35 CSE 435: Software Engineering
13
Associations are Bi-directional
There is no direction implied in an association (Rumbaugh - OMT) Country name City name Has-capital Person name Drivers-license lic.-number: integer Is-issued CSE 435: Software Engineering
14
Associations Have Direction
Unified adds a direction indicator Inconsistently used Country name City name Has-capital Person name Drivers-license lic.-number: integer Is-issued CSE 435: Software Engineering
15
Multiplicity One person holds one credit card name: String Person card-number: integer Credit-card Holds One object can be related to many objects through the same association One person can hold zero or more credit cards Person Holds 0..* Credit-card name: String card-number: integer CSE 435: Software Engineering
16
Multiplicity (Cont.) One person can hold zero or more credit cards (0..*) Each card has zero or one holder (0..1) Person Credit-card 0..1 Holds 0..* name: String age: integer card-number: integer card-number= Card789:Credit-Card :DQPublic:Person name= D. Q. Public age=32 :JQPublic:Person name= J. Q. Public age=35 Holds Holds card-number= Card456:Credit-Card card-number= Card123:Credit-Card CSE 435: Software Engineering
17
Higher order associations
Ternary association Project, language, person Seldom needed (and should be avoided) 1..* 1..* Language Project 1..* Person Compiler: Project C++ :Language Note: hexagons should be rectangles to represent instances J. Q. Public:Person Age=35 TicTacToe:Project LISP:Language CSE 435: Software Engineering
18
Link Attributes How to represent salary and job title?
Associations can have properties the same way objects have properties How to represent salary and job title? Person Company name: String 0..* Works-for age: integer name: String SSN: integer address: String address: String Person Company name: String 0..* Works-for age: integer name: String Use a link attribute! SSN: integer address: String address: String salary: integer job-title: String CSE 435: Software Engineering
19
Folding Link Attributes
Why not this? Salary and job title are properties of the job not the person Person name: String Company age: integer 0..* Works-for SSN: integer name: String address: String address: String salary: integer job-title: String Person Company name: String 0..* Works-for 0..* age: integer name: String In this case, a link attribute is the only solution SSN: integer address: String address: String salary: integer job-title: String CSE 435: Software Engineering
20
Role Names Attach names to the ends of an association to clarify its meaning name: String age: integer SSN: integer address: String Person Company Works-for 0..* salary: integer job-title: String employer employee boss worker Manages 0..1 CSE 435: Software Engineering
21
Aggregation A special association, the is-part-of association
A sentence is part of a paragraph (a paragraph consists of sentences) A paragraph is part of a document (a document consists of paragraphs) 0..* 0..* Document Paragraph Sentence Aggregation symbol CSE 435: Software Engineering
22
Aggregation (Cont.) Often used in parts explosion Car 4 Wheel Body
Gearbox Engine 1..* 1..* 0..* Door Hood Trunk Piston Valve Crankshaft CSE 435: Software Engineering
23
Generalization and Inheritance
The is-a association Cards have many properties in common Generalize the common properties to a separate class, the base-card Let all cards inherit from this class, all cards is-a base-card (plus possibly something more) issue() revoke() height: integer width: integer thickness: integer id-number: integer Card expire() class: vehicle issued: date expires: date Drivers License ID Card validate() credit-limit: integer Credit Card CSE 435: Software Engineering
24
Example Owns Pilot City Airline Works-for Based-In 0..* name name name
license Located-In Offers 1..* Certified-On Pilots 0..* 0..* Airport 0..* Plane 0..* name Departs 0..* Flight model date serial # heat() Arrives Used-For flight # hours flown clean() 0..* cancel() heat() delay() refuel() clean() 30..* 0..* Seat Passenger location name Confirmed-for reserve()
25
Aggregation Versus Association
Can you use the phrase is-part-of or is-made-of Are operations automatically applied to the parts (for example, move) - aggregation Not clear what it should be…… 0..* 0..* Company Division Department Works-for 0..* Person CSE 435: Software Engineering
26
Aggregation Versus Inheritance
Do not confuse the is-a relation (inheritance) with the is-part-of relation (aggregation) Use inheritance for special cases of a general concept Use aggregation for parts explosion 4 Wheel Body Car Gearbox Engine Minivan Compact Jeep Roll Bar CSE 435: Software Engineering
27
Recursive Aggregates A recursive aggregate contains (directly or indirectly) an instance of the same kind of aggregate Program Simple Statement Compound Block 0..* CSE 435: Software Engineering
28
Class diagram Metamodel I
Eclipse.org CSE 435: Software Engineering
29
Class diagram Metamodel II
CSE 435: Software Engineering Science direct
30
Use Case Metamodel I uu: use case association relationship
_i: includes _e: extends _g: generalization aa: actor relationship Image: Science Direct: ``Visual Modeling for Software Intensive Systems, Kooper et al, 2006. CSE 435: Software Engineering
31
Use Case Metamodel II CSE 435: Software Engineering Image: Jot.fm
32
Object Modeling Summary
Classes Name Attributes Operations Associations Roles Link attributes Aggregation Inheritance CSE 435: Software Engineering
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.