Monday, 12 December 2016

Class diagrams




Class diagram
1.     Find out nouns from problem statements, These are the probable classes of your system
2.      Try to identify the probable attributes for each class. E.g. class student- student_name , stud_rn etc. write these in attribute section of the class
3.     Find out the methods which will change values(states) of these attributes & write in the same class.
4.     Try to find out relations among the classes- 1.simple association , 2. generalization, 3. aggregation, 4. Composition or 5. Dependency
5.     When two classes only use information of each other through methods , show simple association e.g. teacher uses info of student. So simple association between teacher & student class
6.     Show generalization in case of inheritance






 Accountant is-a employee & Teacher is-a employee
E.g.2  ASCII file(specific file) is-a file & Binary file (specific file)is-a file . File class is a general class of Files.

1.     Generally has-a or made of or consists of relationships are shown using aggregation association
e.g Linked List is made up of Nodes or Linked List has a set of Nodes. Means Linked List is collection of Nodes.             
Linked list is collection(aggregate) class of node objects. Node class can be used by Tree class as well. part_of relationship

1.      Composition relation also shows collection class(part_of relationship) but it is whole-part relationship. Means the parts can’t be used by other classes.

                 
Tracks (or Sector)can’t be used by any other class. If Disk is deleted, there is no use of Sectors &Tracks. If Sector is deleted, no use of Tracks. Existence of Sector & Tracks is due to existence of Disk

1.     If a class is dependent on data from other classes , show dependency relation
e.g

  


To generate bill, customer info & item info are needed without which bill can’t be generated
Do not forget to show multiplicity


                                                       

No comments:

Post a Comment