Unformatted text preview:

Information Systems Analysis and Design CSC340 III Class and Object Diagrams Classes Attributes and Operations Objects and Multi objects Generalization and Inheritance Associations and Multiplicity Aggregation and Composition How to Use Class Diagrams 2001 Jaelson Castro and John Mylopoulos Class Diagrams 1 Information Systems Analysis and Design CSC340 Classes A class describes a group of objects with similar properties attributes common behaviour operations common relationships to other objects and common meaning semantics For example employee has a name employee and department an employee is hired and fired an employee works in one or more projects 2003 John Mylopoulos Class Diagrams 2 Information Systems Analysis and Design CSC340 Finding Classes Finding classes in use case or in text descriptions Look for nouns and noun phrases in the description of a use case or a problem statement These are only included in the model if they explain the nature or structure of information in the application Don t create classes for concepts which Are beyond the scope of the system Refer to the system as a whole Duplicate other classes Are too vague or too specific few instances Finding classes in other sources Reviewing background information Users and other stakeholders Analysis patterns CRC Class Responsibility Collaboration cards 2003 John Mylopoulos Class Diagrams 3 Information Systems Analysis and Design CSC340 StaffMember Class for Agate For example we may want to represent the concept of a staff member for a company such as Agate in terms of the class StaffMember StaffMember Attributes optional Name mandatory staffName CalculateBonus ChangeGrade 2003 John Mylopoulos Operations optional Class Diagrams 4 Information Systems Analysis and Design CSC340 Names Every class must have a unique name Client Campaign StaffMember Each class has instances that represent particular individuals that have the properties of the class For example George Nazim Yijun may be instances of StaffMember Classes can be used to describe a part of the real world or part of the system under design 2003 John Mylopoulos Class Diagrams 5 Information Systems Analysis and Design CSC340 Attributes Each class can have 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 Campaign title String datePaid Date 2003 John Mylopoulos Class Diagrams 6 Information Systems Analysis and Design CSC340 Objects and Their Attribute Values The instances of a class are called objects Objects are represented as shown below Two different objects may have identical attribute values like two people with identical name and address Make sure that attributes are associated with the right class for example you don t want to have both managerName managerEmp as attributes of Campaign Why SaveTheKids Campaign title Save the kids datePaid 28 01 02 2003 John Mylopoulos Class Diagrams 7 Information Systems Analysis and Design CSC340 Object Diagrams Model the instances of things described by a class Each object diagram shows a set of objects and their interrelationships at a point in time Used to model a snapshot of the application Each object has an optional name and set of classes it is an instance of also values for attributes of these classes Student Jaelson Instructor BillClinton Course Monica Student 2003 John Mylopoulos someone courseNo csc340 description OOAD Class Diagrams 8 Information Systems Analysis and Design CSC340 Multiobjects A multiobject is a set of objects with an undefined number of elements p2 Instructor c1 Course c3 Course c2 Course Student Student Multiobjects 2003 John Mylopoulos Class Diagrams 9 Information Systems Analysis and Design CSC340 Operations Often derived from action verbs in use case descriptions or problem statements Operations describe what can be done with the instances of a class For example For the class Stone we may want to associate operations Throw Kick and WriteOn Some operations will carry out processes to change or do calculations with the attributes of an object For example the directors of Agate might want to know the difference between the estimated cost and the actual cost of a campaign Campaign would need an operation CostDifference 2003 John Mylopoulos Class Diagrams 10 Information Systems Analysis and Design CSC340 Operations Each operation has a signature which specifies the types of its parameters and the type of the value it returns if any Campaign 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 2003 John Mylopoulos Class Diagrams 11 Information Systems Analysis and Design CSC340 Visibility 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 can use the feature public private protected 2003 John Mylopoulos Staff name String passwd String dateofB Date ChangePasswd Include Class Diagrams 12 Information Systems Analysis and Design CSC340 Relationships 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 2003 John Mylopoulos Class Diagrams 13 Information Systems Analysis and Design CSC340 Generalization Relationship Generalization relates two classes when the concept represented by one class is more general than that represented by the other For example Person is a generalization of Student and conversely Student is a specialization of Person The more general class participating in a generalization relationship is also called the superclass or parent while the more specialized class is called subclass or child The child always inherits the structure and behavior of the parent However the child may also add new structure and behavior or may modify the behavior of the parent 2003 John Mylopoulos Class Diagrams 14 Information Systems Analysis and Design CSC340 Generalization It may be that in a system like Agate s we need to distinguish between different types of staff creative staff and administrative staff and to store


View Full Document

Toronto CSC 340 - Class and Object Diagrams

Documents in this Course
Scoping

Scoping

10 pages

Load more
Loading Unlocking...
Login

Join to view Class and Object Diagrams 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 and Object Diagrams 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?