Download presentation
Presentation is loading. Please wait.
Published byCurtis Ball Modified over 9 years ago
1
2/9/98 Thomas O’Reilly 1 A Quick UML Introduction
2
2/9/98 Thomas O’Reilly 2 What is UML and why use it? Unified Modeling Language UML is a way of visualising models We are interested in class diagrams. Class diagrams work with classes and the relationships between them UML is an industry standard UML is already used by many people in LHCb It may become standard for LHCb UML is the default method in Rational Rose Rational Rose can turn UML diagrams into C++ code
3
2/9/98 Thomas O’Reilly 3 Classes Name of the class Attributes of the class (data members) Operations of the class (member functions)
4
2/9/98 Thomas O’Reilly 4 Inheritance The arrow symbol is used to show derived types Dog and Cat are both subclasses of Mammal They inherit from the class Mammal Key phrase “A dog ‘is a kind of’ Mammal” The code equivalent is class Dog : public Mammal{... }
5
2/9/98 Thomas O’Reilly 5 Aggregation This black diamond symbol is used to show that an object of type Car will contain an object of type Engine code equivalent class car{ private: Engine engine Key phrase “car ‘has an’ engine” The name of the object contained is the name on the arrow (engine) The negative sign before engine means private containment + public # protected - private The numbers show cardinality
6
2/9/98 Thomas O’Reilly 6 More Aggregation The empty diamond means that a reference to the object will be contained An object of type Person will contain the address of objects of type Cat and Dog (or NULL pointers) code equivalent class person{ private: Cat *MyCat Dog *MyDog Numbers show cardinality
7
2/9/98 Thomas O’Reilly 7 Cardinality The numbers on the ends of relationship arrows show cardinality Cardinality is the number of objects of that type that your object will be associated with A person may have no dog or one dog only. A dog however has to have exactly one owner A person may own as many fish as he likes The fish will be held in a container ( for LHCb : STL vector )
8
2/9/98 Thomas O’Reilly 8 Dependency (Use Relationship) Drawn as a dotted arrow Used when one class may require the services of another In this example the Printer knows about the class Formatter so that it can use its services
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.