Rational Rose Tools Interview Questions
..
..
aa
For understanding class diagrams, we would need to understand UML first. So what is UML? UML is short for Unified Modeling Language and is a second generation notation for diagram-based object-oriented modeling. It was first developed by the company Rational Corp.(Booch). After that UML was advanced as an industry standard by the
Object Management Group (OMG).
Class Diagrams are a part of the structural view of UML as they represent the static structure of a system. Class diagrams are basically used by Business Analysts or Solution Architects to design the static view of the classes involved. The diagrams depicts the grouping of classes which have the same attributes and behavior(operation or functions) and also it includes the interrelationships between two class. A class is an entity which is represented by a simple rectangle and is divided into three parts. At the top we have the Class Name, in the middle the list of the attributes specific to the class is included and lastly comes the class operation or function. If a simplified version of the class diagram is depicted then the last two compartments are not included or are left blank. The interrelationships are shown in the form of interconnecting lines between the classes and the dependencies are represented by symbols such as 1, 0, *(many), This part is similar to the data modeling diagram – entity relationship diagram.
As class diagrams are essential to all object oriented analysis, its used in 90% of the software projects with UML diagrams. But you should keep in mind that even though there are a number of UML notations, the lass diagram should be as simple and clear as possible without complicating it with unnecessary notations. Clasification of classes should be done keeping in mind the object orient principles and after listing the relevant classes you can depict them with the help of the class diagram.
An example of a class diagram is given in Figure A to give you an idea of the structure of class diagrams:
Figure A : Example of Class Diagram
In Fig A, lets take the “Dishware” class, it has three compartments. At present the attributes and operations compartment have been left blank, Each operation is prefixed a “+” sign to depict that its a function and suffixed by “(). The variables which will be input or passed through the function can be included within the symbol”()”.
Also included in the example are six other classes “Plate”, “Bowl”, “WoodenPlate”, “GlassPlate”, “WoodenBowl”, “GlasBowl”. The two classes “Plate” and “Bowl” are generalization of the main class “Dishware”. This can be depicted by the hollow triangle symbol as shown in Fig A. The two classes “WoodenPlate” and “GlassPlate” are generalization of the class “Plate” and similarly for the class “Bowl”, the two classes “WoodenBowl” and “GlassBowl” are generalizations. Generalization means that the sub classes will inherit the behavior of the main class but will have attributes of their own as well. Lets take the example of “GlassPlate”, it will have the attributes of the class “Plate” like shape etc nut will also have its own attributes.
photo