Download presentation
Presentation is loading. Please wait.
Published byPeyton Hewett Modified over 10 years ago
1
UML (cont.) “The Unified Modeling Language User Guide” by G. Booch, J. Rumbaugh and I. Jacobson ● Classes ● Relationships ● Class diagrams ● Examples
2
Classes ● Modelling a system involves identifying the things that are important to your view of the system: the vocabulary of the system. ● A class is a description of a set of objects that share the same attributes, operations, relationships and semantics.
3
Classes ● Names ● Abstract classes (names are written in italics). ● Attributes ● An attribute is a named property of a class, shared by all objects of that class. ● A attribute may have associated a type or a default initial value.
4
Classes ● Operations ● An operation is something that can be done to any object of that class. Represents some behaviour of its enclosing class. ● You can specify the signature of an operation, covering the name and type of all parameters, and a return type (in the case of functions).
5
Relationships ● When you model a system, not only must you identify the things that form the vocabulary of your system, but must also model how these things stand in relation to one another. ● A relationship is a connection among things. ● Three kinds of relationships that are important: ● Dependency ● Generalization ● Association
6
Relationships ● Dependencies: ● Dependencies are using relationships among classes. ● A dependency states that a change in specification of one thing may affect another thing that uses it, but not necessarily the reverse. The latter depends on the former. ● Use dependencies when you want to show one thing using another (e.g. one class uses another class as an argument in the signature of an operation).
7
Relationships ● Generalization ● A generalization is a relationship between a general thing (the superclass or parent) and a more specific kind of thing (the subclass or child). ● Generalization is an “is-a-kind-of” relationship. ● Generalization means that objects of the child class may be used anywhere the parent class may appear, but not the reverse. ● A child class inherits the attributes and the operations of its parents. Often the child has adittional attributes and/or operations.
8
Relationships ● Generalization (cont.) ● An operation of a child that has the same signature as an operation of a parent, overrides the operation of the parent. ● A class may have zero, one or more parents. A class that has no parents and one or more children is called a root class. A class that has no children is called a leaf class. ● A class that has exactly one parent is said to use single inheritance. A class with more than one parent is said to use multiple inheritance.
9
Relationships ● Association ● An association is a structural relationship that specifies that objects of one thing are connected to objects of another. ● Name: An association can have a name to describe the nature of the relationship. Usually you can give a direction to the name. ● Role: When a class participates in an association, it has a specific role that it plays in that relationship. You can name the role a class plays in an association.
10
Relationships ● Association: ● Multiplicity: In many modelling situations, it is important to state how many objects may be connected across an instance of an association. Multiplicity may be: exactly one (1), zero or one (0..1), many (0..*), or one or more (1..*). ● Aggregation: In a plain association between two classes, both classes are conceptually at the same level. When you want to model a “whole/part” relationship, in which one class represents a larger thing (the wole), which consists of smaller things (the parts).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.