80 likes | 103 Views
CSC340: Tutorial 5 Requirements Analysis. TA: Y. An Date: 9:00-10:00am, Fri. Nov 7, 2003 Location: BA1130. Classes. A class describes a group of objects with: Similar properties (attributes), Common behaviors (operations), Common relationships to other objects,
E N D
CSC340: Tutorial 5Requirements Analysis TA: Y. An Date: 9:00-10:00am, Fri. Nov 7, 2003 Location: BA1130 CSC340
Classes • A class describes a group of objects with: • Similar properties (attributes), • Common behaviors (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. CSC340
Identifying classes • You don’t model objects which are beyond the scope of the system. • It is not usually necessary for a model to contain classes that represent the entire system. • You should remove class which is really a synonym of others. • Avoid too vague names which you cannot write description. • Avoid too specific names which are really a generalization. • Don’t tie up with physical inputs and outputs. CSC340
Classes and attributes • “A member of staff has one grade at a time, but members may have several previous grades, and several members may have a same grade.” • “A grade has only one rate at a time, and each rate has a money value. Grade may have a rate attribute.” CSC340
Classes and attributes • “A grade may have several previous rates, which suggests either that Grade has multiple rate attributes, or that Rate and Grade are distinct classes.” • “Rate must have a date attribute.” CSC340
UML class diagram Where to put the attributes gradeStartDate And gradeFinishDate? CSC340
Association class CSC340