Class+Diagrams

[|Class diagrams also display relationships such as containment.docx]

**__CLASS DIAGRAMS__**


Class diagrams are one of the most popular and commonly used diagrams in UML. These diagrams portray different meanings to different people. Analysis or conceptual models are designed in class diagrams. Class diagrams are the backbone of every object oriented diagram .They are there in order to describe the structure of a system by showing the particular system classes, attributes and their relationships. They are used mainly to show the object oriented relationships (inheritance, aggregation, associations and others) among the classes. Class diagrams also  make use of the characteristics of state chart and activity diagrams.  There are three different perspectives described in class diagrams: · Conceptual · Specification · Implementation When drawing class diagrams it is better to consider all three perspectives instead of just focusing on one. When drawing classes, composition of classes should be considered as well which is made up of:  **__Class __** Class symbol is divided into compartments. The first compartment shows class name. Second shows the attribute and third shows the operations. Active classes initiate and control the flow of activity. Active classes are illustrated with a thicker border. Passive classes on the other hand, store data and serve other classes. **<span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">__ Visibility __ ** <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">This signifies the access of the class and is of three types: <span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;"> **<span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;">Private visibility: **<span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;"> It hides information from anything outside the class partition. <span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;">Static relationships between classes are represented by associations. Association names are placed above, on, or below the association line. A filled arrow is used to indicate the direction of the relationship. Roles are placed near the end of an association. Roles symbolize the way the two classes see each other.
 * <span style="font-size: 14pt; line-height: 115%; font-family: 'Arial','sans-serif';">How to draw class diagrams? **
 * <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">Name
 * <span style="font-size: 12pt; font-family: 'Arial','sans-serif';">Attribute
 * <span style="font-size: 12pt; font-family: 'Arial','sans-serif';">Operations <span style="font-size: 14pt; line-height: 115%; font-family: 'Arial','sans-serif';">
 * <span style="font-size: 14pt; line-height: 115%; font-family: 'Arial','sans-serif';">Symbols and notations of class diagrams **
 * <span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-ansi-language: EN; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">__Active Class__ **<span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-ansi-language: EN; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">
 * <span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;">Public visibility: **<span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;"> It allows all other classes to view the manifested information.
 * <span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;">Protected visibility: **<span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;"> It allows only the child classes to access information inherited from a parent class.
 * __<span style="font-size: 12pt; color: #424542; line-height: 115%; font-family: 'Arial','sans-serif'; mso-ansi-language: EN;">Associations __**


 * __///MUHAMMAD DANIYAL SHAFIQ//__**


 * __Here is a simple example of class diagram:__**



In the above example, a class named FLIGHT is being depicted. This class has certain attributes and operations. Attributes with their respective data types are listed in the middle section. For instance, FLIGHT NUMBER is an attribute of FLIGHT class with the datatype of Integer. Operations with their respective parameters are listed in the bottom section. For instance, DELAY FLIGHT is the method of FLIGHT class with a parameter of NUMBER OF MINUTES. Below is another example of a class being represented using class diagram notation.



Here above in the diagram attributes and operations of BANK ACCOUNT class is spceified. balance:Dollars=0 depicts that balance attribute would have 0 dollars as its default value. Like a newly created account would hava a balance of 0.


 * __RELATIONSHIPS IN CLASS DIAGRAMS__**

__INHERITANCE:__// inheritance is to get functionality from another class and add more functionality other than what is inherited. For instance, above is a diagram showing a CHEKINGACCOUNT and SAVINGSACCOUNT class which are being inherited by BANKACOUNT class. CHEKINGACCOUNT and SAVINGSACCOUNT class has attributes and opertaions inherited from BANKACCIUNT class but they also have attribute and opertaions of their own like INSUFFICIENTFUNDSFEE operation of CHECKING ACCOUNT class.

<span style="font-size: 10pt; color: black; font-family: 'Arial','sans-serif'; mso-themecolor: text1;">.

BY: Shafia Imtiaz Ayesha Akbar Sadaf Ijaz

1.http://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/ <span style="font-size: 12pt; font-family: 'Arial','sans-serif'; mso-list: Ignore; msofareastfontfamily: Arial; msolist: Ignore;">1. <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">http://blogs.msdn.com/stevecook/archive/2008/10/13/class-diagrams.aspx <span style="font-size: 12pt; font-family: 'Arial','sans-serif'; mso-list: Ignore; msofareastfontfamily: Arial; msolist: Ignore;">2. <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">http://www.embedded.com/story/OEG20030109S0038 <span style="font-size: 12pt; font-family: 'Arial','sans-serif'; mso-list: Ignore; msofareastfontfamily: Arial; msolist: Ignore;">3. <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">http://www.smartdraw.com/tutorials/software/uml/tutorial_04.htm <span style="font-size: 12pt; font-family: 'Arial','sans-serif'; mso-list: Ignore; msofareastfontfamily: Arial; msolist: Ignore;">4. <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">http://atlas.kennesaw.edu/~dbraun/csis4650/A&D/UML_tutorial/class.htm#1 <span style="font-size: 12pt; font-family: 'Arial','sans-serif'; mso-list: Ignore; msofareastfontfamily: Arial; msolist: Ignore;">5. <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">http://searchsoa.techtarget.com/sDefinition/0,,sid26_gci1247176,00.html <span style="font-size: 12pt; font-family: 'Arial','sans-serif'; mso-list: Ignore; msofareastfontfamily: Arial; msolist: Ignore;">6. <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">http://en.wikipedia.org/wiki/Class_diagram
 * <span style="font-size: 12pt; line-height: 115%; font-family: 'Arial','sans-serif';">REFERENCES: **