Monday, January 7, 2008

Class Diagram:

In the Unified Modeling Language (UML), a class diagram is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, and the relationships between the classes.
Class:
An object is any person, place, thing, concept, event, screen, or report applicable to your system. Objects both know things (they have attributes) and they do things (they have methods). A class is a representation of an object.
Responsibilities:

Classes are typically modeled as rectangles with three sections: the top section for the name of the class, the middle section for the attributes of the class, and the bottom section for the methods of the class. Attributes are the information stored about an object (or at least information temporarily maintained about an object), while methods are the things an object or class do. For example, students have student numbers, names, addresses, and phone numbers. Those are all examples of the attributes of a student. Students also enroll in courses, drop courses, and request transcripts. Those are all examples of the things a student does, which get implemented (coded) as methods.


Associations:

Objects are often associated with, or related to, other objects. Associations are modeled as lines connecting the two classes whose instances (objects) are involved in the relationship.


Multiplicity Indicators.
Indicator Meaning
0..1 Zero or one
1 One only
0..* Zero or more
1..* One or more
n Only n (where n > 1)
0..n Zero to n (where n > 1)
1..n One to n (where n > 1)
Inheritance Relationship:


Similarities often exist between different classes. Very often two or more classes will share the same attributes and/or the same methods. Inheritance Models “is a” and “is like” relationships, enabling to reuse existing data and code easily. The UML modeling notation for inheritance is a line with a closed arrowhead pointing from the subclass to the superclass.


Composition Association:

Sometimes an object is made up of other objects. For example, an airplane is made up of a fuselage, wings, engines, landing gear, flaps, and so on. In UML 2, aggregation would be shown with an open diamond.

No comments: