DOC PREVIEW
MSU CSE 870 - Class Notes

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 1 R R R CSE870: UML Classes 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!R R R CSE870: UML Classes 2 J. Q. Public VISA 123 4567 887766 998 J. Q. Public Drivers License State of Michigan A-123456 03-12-63 Objects!CSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 2 J. Q. Public VISA 123 4567 887766 998 J. Q. Public Drivers License State of Michigan A-123456 03-12-63 Person objects Card objects Attributes height width id-number Operations issue change Card class Person class Attributes name age height weight Operations move change-job abstracts to Attributes and Operations!3 CSE870: UML Classes R R R CSE870: UML Classes 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!CSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 3 R R R CSE870: UML Classes 5 The Class Diagrams!R R R CSE870: UML Classes 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!CSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 4 R R R CSE870: UML Classes 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!R R R CSE870: UML Classes 8 Class with attributes Objects with values person ID: integername: Stringage: integerPersonObjects have an identity Do not explicitly list object identifiers SSN OK! Class diagram Instance diagram age: integer Person Class Diagrams!D. Q. Public: age= 32 Person J. Q. Public: age= 35 PersonCSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 5 R R R CSE870: UML Classes 9 Examples!name: Stringage: integerheight: integerweight: integerSSN: integerPersonheight: integerwidth: integerthickness: integerid-number: integerCardR R R CSE870: UML Classes issue()revoke()height: integerwidth: integerthickness: integerid-number: integerCardrotate(angle: integer)move(x: integer, y: integer)height: integerwidth: integerShapeOperations and Methods!• Transformation that can be applied to or performed by an object!• May have arguments!10CSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 6 R R R CSE870: UML Classes 11 Object Notation - Summary!operation-1(argument-list-1) : result-type-1operation-2(argument-list-2) : result-type-2operation-3(argument-list-3) : result-type-3attribute-1 : data-type-1 = default-value-1attribute-2 : data-type-2 = default-value-2attribute-3 : data-type-3 = default-value-3Class nameR R R CSE870: UML Classes Associations!• Conceptual connection between classes!– A credit card is issued-by a bank!– A person works-for a company!Class diagrams Credit Card Bank Issued-by Person Company Works-for J.Q. Public: Age=35 Person Michigan State Univ: Company Works-for Instance diagram 12CSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 7 R R R CSE870: UML Classes 13 Associations are Bi-directional!• There is no direction implied in an association (Rumbaugh - OMT)!Country name Drivers-license lic.-number: integer Person name City name Has-capital Is-issued R R R CSE870: UML Classes 14 Associations Can Have Direction!• Unified adds a direction indicator!– Inconsistently used!Country name Drivers-license lic.-number: integer Person name City name Has-capital Is-issuedCSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 8 R R R CSE870: UML Classes 15 Multiplicity!• One object can be related to many objects through the same association!One person holds one credit card name: String Person card-number: integer Credit-card Holds One person can hold zero or more credit cards name: String Person card-number: integer Credit-card Holds 0..* R R R CSE870: UML Classes 16 • One person can hold zero or more credit cards (0..*) • Each card has zero or one holder (0..1) name: String age: integer Person card-number: integer Credit-card Holds 0..* 0..1 Multiplicity (Cont.)!Holds Holds :JQPublic:Person name= J. Q. Public age=35 :DQPublic:Person name= D. Q. Public age=32 card-number= 123 456 789 Card789:Credit-Card card-number= 111 222 333 Card123:Credit-Card card-number= 444 555 666 Card456:Credit-CardCSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 9 R R R CSE870: UML Classes 17 Multiplicity (Cont.)!• One person can hold zero or more credit cards (0..*) • Each card has one holder (no indication or 1) • Each card has one or more authorized users (1..*) • One person can be authorized to use zero or more cards name: String Person card-number: integer Credit-card Holds 8 0..* 3 Authorized 1 1..* 0..* Explicit enumeration is also possible (2, 3, 2..5, etc.) D. Q. Public 32 :Person J. Q. Public 35 :Person 123 456 789 :Credit-Card 111 22 2 333 :Credit-Card 111 22 2 333 :Credit-Card Holds 8 Holds 8 3 Authorized Holds 8 3 Authorized 3 Authorized 3 Authorized R R R CSE870: UML Classes 18 Language Person Project 1..* 1..* 1..* Higher order associations!• Ternary association!– Project, language, person!• Seldom needed (and should be avoided)!J. Q. Public:Person Age=35 Compiler: Project C++ :Language TicTacToe:Project LISP:Language Instance of ternary associationCSE870: Cheng CSE870: Advanced Software Engineering (Cheng) 10 R R R CSE870: UML Classes 19 How to represent salary and job title? name: String age: integer SSN: integer address: String Person name: String address: String Company Works-for 0..* Link Attributes!• Associations can have


View Full Document

MSU CSE 870 - Class Notes

Documents in this Course
HW2

HW2

3 pages

splc1

splc1

21 pages

Lessons

Lessons

3 pages

revision

revision

13 pages

ft1

ft1

12 pages

john.dsn

john.dsn

21 pages

Survey

Survey

2 pages

revision

revision

38 pages

Load more
Download Class Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Class Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Class Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?