The interesting thing about structural diagrams is
that they look very similar for both UML and SysML, but their interpretations
are different. Let’s start with UML Class diagrams because they are more
basic and easier to understand.
Class diagrams, such as the one here, show classes and
relationships among classes. In UML, classes are entities that
contain functionality (operations), data (attributes) and relations. They are not necessarily language (code)
classes. When working in a structured
language like C, I use UML to help define and allocate functions to files and
variables to structures.
Associations are general relationships between
classes. They come is several flavors that we'll discuss here, but it
helps to understand the basics before we get into the subtleties of the metamodel.
The easiest way to understand a relation is to understand how it gets
implemented in code. For simplicity sake, I am going to use C++
terminology and syntax. The design principles apply to object oriented
languages like Java, AND to functional languages like C.
In UML, classes have two primary types of relations: a
class can have an association to another class and a class may be generalized from
another class. Associations are how classes know about each
other. In C++, an association gets
implemented as a pointer or reference. Generalizations
show an inheritance. A class that
generalizes another (the child) has all of the attributes and operations of its
parent.
More on each of these relationships in the next few
articles.
The figure shows these two relations.
No comments:
Post a Comment