1 / 15

What is UML?

What is UML?. A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a visual language for representing software blueprints Latest version is 2.0

rianne
Download Presentation

What is UML?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What is UML? • A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design • A modeling language is a visual language for representing software blueprints • Latest version is 2.0 • UML provides a standard notation, semantics for a set of OO abstractions

  2. UML Overview • UML defines a visual representation of a concept • Everything that is defined in this has meaning • Just like when writing code, you use () or , or + to represent something • Same is true in UML • So, be careful of the types of arrows, boxes, etc. that you use • Be careful of where you put other symbols • Remember that there is a REAL syntax defined for UML • You can’t just write/draw whatever you like • Our focus – reading UML Class diagrams • Next semester, writing them and other diagrams

  3. UML Class Class name Data members (attributes) These compartments are optional. But if you need methods, then you have to have at least empty data member compartment. Instance methods Class method (static) Return types Arguments Important – if something isn’t specified, then that doesn’t necessarily mean that it isn’t there. For example, does name take an argument or not, does it return a value?

  4. Class Attributes Attributes are the instance and class data members Class data members (underlined) are shared between all instances (objects) of a given class (think static). Data types shown after ":" Visibility shown as + public - private # protected Attribute compartment Attribute Model visibility name :typemultiplicity= default {property-string}

  5. Class Operations Operations are the class methods with their argument and return types Public (+) operations define the class interface Class methods (underlined) have only access to class data members, no need for a class instance (object) Parameter List – direction name: type = default Direction Model – direction – in, out, inout Operations compartment Operations Model visibility name (parameter-list) :return-type{property-string}

  6. Multiplicity - 1 • Indicates how many objects may fill the property • 1 – exactly one • 0 .. 1 – may or may not have one • * – zero or more • n .. m – from n to m where n < m • Default is [1] • But it is best to not use default even if value is 1 to make it clear • Question – if you indicate that something is a n..m multiplicity, then how is this realized?

  7. Unary Association A knows about B, but B knows nothing about A UML Comment These two diagrams are identical in what they mean. Arrow shows direction of association in direction of dependency

  8. Unary Association IS an Attribute • Exactly the same as an attribute • Did you hear me? Exactly the same!!! • Solid line (source to target) • Name goes at the target end, plus multiplicity • It is WRONG to include both an association and a attribute of the same thing • That implies that BOTH exist at the same time • What is the difference between a unary association (line) and an attribute? • IT IS THE SAME THING!!!!! Don’t forget!!!!

  9. Binary Association Binary association: both classes know each other Usually "knows about" means a pointer or reference Other methods possible: method argument, tables, database, ... Implies dependency cycle

  10. Dependency • Weak relationships (also transitory): • Class A simply knows of class B • E.g., a method in A creates and immediately returns an object of class B • That is: a change in one may force changes in the other although there is no explicit association between them.

  11. Generalization (Inheritance) Base class or super class Arrow shows direction of dependency Derived class or subclass

  12. Aggregation Aggregation = Association with "whole-part" relationship Shown by hollow diamond at the "whole" side No lifetime control implied

  13. Composition Composition = Aggregation with lifetime control Shown by filled diamond at the "owner" side Lifetime control implied Lifetime control can be transferred Lifetime control: construction and destruction controlled by "owner" → call constructors and destructors (or have somebody else do it)

  14. Composition/AggregationNotations whole part composition aggregation part

  15. Describe This Diagram

More Related