Information Systems Analysis and Design CSC340 Information Systems Analysis and Design Classes III Class and Object Diagrams Diagrams Classes Attributes and Operations Objects and Multi objects Generalization and Inheritance Associations and Multiplicity Aggregation and Composition Business Objects and Rules 2004 John Mylopoulos Class Diagrams 1 Information Systems Analysis and Design CSC340 A class describes a group of objects with similar properties attributes common behaviour operations common relationships to other objects and common meaning semantics Finding classes Listen to the domain experts the people who know the domain you are modeling 2004 John Mylopoulos StaffMember This is a Java class to be included in the design of the new system Name mandatory 2004 John Mylopoulos CalculateBonus ChangeGrade Class Diagrams 3 CSC340 2004 John Mylopoulos Class Diagrams 4 Information Systems Analysis and Design CSC340 Objects are Class Instances Attributes staffName Operations optional Information Systems Analysis and Design StaffMember CalculateBonus ChangeGrade CSC340 System Classes staffName Attributes optional Class Diagrams 2 Information Systems Analysis and Design Diagrammatic Notation for Classes Modeling the real world CSC340 Each class can have attributes attributes w hich represent useful information about instances of a class Each attribute has a type type For example Campaign has attributes title and datePaid SaveTheKids Campaign title Save the kids datePaid 28 01 02 Campaign title String datePaid Date 2004 John Mylopoulos Class Diagrams 5 2004 John Mylopoulos Class Diagrams 6 Information Systems Analysis and Design CSC340 Information Systems Analysis and Design CSC340 Multiobjects Object Diagrams A multiobject is a set of objects with an undefined number of elements Student Jaelson Instructor p2 Instructor BillClinton Course Monica Student someone c1 Course courseNo csc340 description OOAD c3 Course c2 Course Student Student Multiobjects 2004 John Mylopoulos Class Diagrams 7 Information Systems Analysis and Design CSC340 2004 John Mylopoulos Class Diagrams 8 Information Systems Analysis and Design CSC340 Operations Operations Campaign Often derived from action verbs in the description of the application Operations describe what can be done with the instances of a class Title String CampaignStartDate Date CampaignFinishDate Date EstimatedCost Money ActualCost Money CompletionDate Date DatePaid Date Completed CompletionDate Date ActualCost Money SetFinishDate FinishDate Date RecordPayment DatePaid Date CostDifference Money 2004 John Mylopoulos Class Diagrams 9 Information Systems Analysis and Design CSC340 2004 John Mylopoulos Information Systems Analysis and Design Visibility name String passwd String dateofB Date private protected 2004 John Mylopoulos CSC340 Relationships As with Java attributes and operations can be declared with different visibility modes public public any class can use the feature attribute or operation protected protected any descendant of the class can use the feature private private only the class itself Staff can use the feature public Class Diagrams 10 Classes and objects do not exist in isolation from one another A relationship represents a connection among things In UML there are different types of relationships Generalization Association Aggregation Composition more ChangePasswd Include Class Diagrams 11 2004 John Mylopoulos Class Diagrams 12 Information Systems Analysis and Design CSC340 Information Systems Analysis and Design CSC340 Generalization Inheritance StaffMember staff Integer name String startDate Date grade Hire ChangeGrade CalculateBonus AdminStaff Hire CalculateBonus Superclass or parent Inheritance of attributes Inheritance of operations Overriding inherited attributes or operations Subclasses or children CreativeStaff qualifications Hire CalculateBonus 2004 John Mylopoulos Class Diagrams 13 Information Systems Analysis and Design CSC340 Advert 2004 John Mylopoulos Class Diagrams 14 Information Systems Analysis and Design CSC340 Finding Inheritance Bottom Up Finding Inheritance Hoarding Advert Press Advert Book title author publisher ISBN DeweyCode acquisition Loan Return Video Advert Billboard Newspaper Advert Magazine Advert 2004 John Mylopoulos Class Diagrams 15 Information Systems Analysis and Design Better CSC340 All classes in this diagram model real world entities 2004 John Mylopoulos 2004 John Mylopoulos Class Diagrams 16 Information Systems Analysis and Design CSC340 Generalization Notation LoanItem title acquisition Loan Return Book Author DeweyCode publisher ISBN RecordCD title catalogue publisher artist acquisition Loan Return Record artist catalogue recordCo Possibly overlapping Maria is both Lecturer and Student Person Student Class Diagrams 17 2004 John Mylopoulos Lecturer Mutually exclusive a lecturer can t be a student and vice versa Person Student Lecturer Class Diagrams 18 Information Systems Analysis and Design CSC340 Information Systems Analysis and Design Classification Multiple Classification This is the relationship between an object and the classes of which it is an instance Traditional object models assume that classification is single and static Multiple classification allows an object to be an instance of several classes that are not is a related to each other for example Maria may be an instance of GradStudent and Employee Dynamic classification allows an object to change its type during its lifetime 2004 John Mylopoulos Class Diagrams 19 Information Systems Analysis and Design CSC340 TA Male Person sex mandatory Professor role dynamic student Female Student Staff 2004 John Mylopoulos Class Diagrams 20 Information Systems Analysis and Design Association Relationships CSC340 Association Multiplicity name StaffMemder manages name manager staff startDate qualification CSC340 Campaign title startDate estimatedCost How many instances of a class can participate in an association of a particular type StaffMemder name staff startDate qualification role manages 1 A staff member can manage zero or more campaigns 2004 John Mylopoulos Class Diagrams 21 Information Systems Analysis and Design CSC340 Class Diagrams 22 CSC340 Associations and Roles Telephone Class Diagrams 23 Each campaign is managed by exactly one staff member Information Systems Analysis and Design Company 2004 John Mylopoulos estimatedCost 2004 John Mylopoulos Association Navigation Uni Directional Associations PersonName Campaign title 0
View Full Document
Unlocking...