What is a Class Diagram?
• A Class
Diagram is a diagram describing the structure of a system
• shows the system's
• classes
• Attributes
• operations
(or methods),
• Relationships
among the classes.
The class diagram is the main building
block of modelling. It is used both
for general conceptual modelling of
the systematics of
the application, and for detailed modelling translating the models into
programming code. Class diagrams can also be used for data
modelling. The
classes in a class diagram represent both the main objects, interactions
in the
application and the classes to be programmed.
Class diagrams are visual representations of the static structure and composition of a particular system using the conventions set by the Unified Modeling Language (UML). Out of all the UML diagram types it is one of the most used ones. System designers use class diagrams as a way of simplifying how objects in a system interact with each other. Using class diagrams, it is easier to describe all the classes, packages, and interfaces that constitute a system and how these components are interrelated. For example, a simple class diagram may be used to show how an organization such as a convenient store chain is set up. On the other hand, precisely detailed class diagrams can readily be used as the primary reference for translating the designed system into a programming code.
In object-oriented modeling, class diagrams are considered the key building blocks that enable information architects, designers, and developers to show a given system’s classes, their attributes, the functions or operations that are associated with them, and the relationships among the different classes that make up a system.
The image below is an example of a class diagram to blog
Relationships in Class Diagrams
Classes are interrelated to each other in specific ways. In particular, relationships in class diagrams include different types of logical connections. The following are such types of logical connections that are possible in UML:
- Association
- Directed Association
- Reflexive Association
- Multiplicity
- Aggregation
- Composition
- Inheritance/Generalization
- Realization
Association
is a broad term that encompasses just about any logical connection or relationship between classes. For example, passenger and airline may be linked as above:Directed Association
refers to a directional relationship represented by a line with an arrowhead. The arrowhead depicts a container-contained directional flow.Reflexive Association
occurs when a class may have multiple functions or responsibilities. For example, a staff working in an airport may be a pilot, aviation engineer, a ticket dispatcher, a guard, or a maintenance crew member. If the maintenance crew member is managed by the aviation engineer there could be a managed by relationship in two instances of the same class.Multiplicity
is the active logical association when the cardinality of a class in relation to another is being depicted. For example, one fleet may include multiple airplanes, while one commercial airplane may contain zero to many passengers. The notation 0..* in the diagram means “zero to many”.Aggregation
refers to the formation of a particular class as a result of one class being aggregated or built as a collection. For example, the class “library” is made up of one or more books, among other materials. In aggregation, the contained classes are not strongly dependent on the life cycle of the container. In the same example, books will remain so even when the library is dissolved. To render aggregation in a diagram, draw a line from the parent class to the child class with a diamond shape near the parent class.Composition
is very similar to the aggregation relationship, with the only difference being its key purpose of emphasizing the dependence of the contained class to the life cycle of the container class. That is, the contained class will be obliterated when the container class is destroyed. For example, a shoulder bag’s side pocket will also cease to exist once the shoulder bag is destroyed. To depict a composition relationship in a UML diagram, use a directional line connecting the two classes, with a filled diamond shape adjacent to the container class and the directional arrow to the contained class.Inheritance / Generalization
refers to a type of relationship wherein one associated class is a child of another by virtue of assuming the same functionalities of the parent class. In other words, the child class is a specific type of the parent class. To depict inheritance in a UML diagram, a solid line from the child class to the parent class is drawn using an unfilled arrowhead.Realization
denotes the implementation of the functionality defined in one class by another class. To show the relationship in UML, a broken line with an unfilled solid arrowhead is drawn from the class that defines the functionality to the class that implements the function. In the example, the printing preferences that are set using the printer setup interface are being implemented by the printer.
so in
conclusion, class diagram is helpful for programmers in making the project a system.
because it can describe the flow of the system are interconnected and influence
each other. it is also, class diagrams can represent the attributes for each entity
involved in the process of the system. as well as to describe the action that will
happen and that will be generated from the input output processes in the system.
The class diagram for this study will be very useful in helping manufacturing business coursework electronically but it is also useful for other tasks such as creating a final project later in the next semester.
source:
http://creately.com/blog/diagrams/class-diagram-relationships/
Tidak ada komentar:
Posting Komentar