Unformatted text preview:

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 How to Use Class Diagrams 2001 Jaelson Castro and 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 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 3 Information Systems Analysis and Design CSC340 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 2003 John Mylopoulos Operations optional Class Diagrams 4 Information Systems Analysis and Design CSC340 Attributes Campaign staffName ChangeGrade Every class must have a unique name Client Name mandatory CalculateBonus Names CSC340 StaffMember Class for Agate 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 2 Information Systems Analysis and Design Finding Classes CSC340 StaffMember Each class can have attributes which represent useful information about instances of a class Each attribute has a type type For example Campaign has attributes title and datePaid Campaign 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 title String datePaid Date 2003 John Mylopoulos Class Diagrams 6 Information Systems Analysis and Design CSC340 Information Systems Analysis and Design Object Diagrams Objects and Their Attribute Values CSC340 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 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 SaveTheKids Campaign BillClinton title Save the kids datePaid 28 01 02 Course Monica Student someone 2003 John Mylopoulos Class Diagrams 7 Information Systems Analysis and Design CSC340 2003 John Mylopoulos CSC340 Operations p2 Instructor c3 Course c2 Course Student Class Diagrams 8 Information Systems Analysis and Design Multiobjects A multiobject is a set of objects with an undefined number of elements c1 Course courseNo csc340 description OOAD Student 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 Multiobjects 2003 John Mylopoulos Class Diagrams 9 Information Systems Analysis and Design CSC340 2003 John Mylopoulos Information Systems Analysis and Design Operations Each operation has a signature which specifies the types of its parameters and the type of the value it returns if any Class Diagrams 10 CSC340 Visibility Campaign Title String CampaignStartDate Date CampaignFinishDate Date EstimatedCost Money ActualCost Money CompletionDate Date DatePaid Date 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 Staff public Completed CompletionDate Date ActualCost Money SetFinishDate FinishDate Date RecordPayment DatePaid Date CostDifference Money private protected 2003 John Mylopoulos Class Diagrams 11 2003 John Mylopoulos name String passwd String dateofB Date ChangePasswd Include Class Diagrams 12 Information Systems Analysis and Design CSC340 Information Systems Analysis and Design Generalization Relationship 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 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 It may be that in a system like Agate s we need to distinguish between different types of staff creative staff and


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?