1 / 25

Introduction to UML Modeling Elements

Introduction to UML Modeling Elements. Company. 1. 1..*. 1..*. LocatedAt. Department. Office. *. *. Building blocks of the UML. As part of a model you have : 1 modeling elements 2 relationships between the modeling elements

smclean
Download Presentation

Introduction to UML Modeling Elements

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. Introductionto UML Modeling Elements

  2. Company 1 1..* 1..* LocatedAt Department Office * * Building blocks of the UML • As part of a model you have: • 1 modeling elements • 2relationships between the modeling elements • 3diagrams that group and visualize the modeling elements and the relations between them. • E.g. class diagram:

  3. 1Modeling elements • You have modeling elements for: • 1.1 Structural things • 1.2 Behavioral things • 1.3 Grouping things • 1.4 Annotational things

  4. 1.1Structural elements • Identified with nouns, e.g. Person; Typically representing static parts of the model. In UML you will find 7 different types of structual elements: • 1.1.1 Class • 1.1.2 Interface • 1.1.3 Active class • 1.1.4 Colloboration • 1.1.5 Component • 1.1.6 Node • 1.1.7 Use Case

  5. class name Point visibility attributes - x : int - y : int + getX() : int operations + setX(aX : int) : void + getY() : int operationsignature + setY(aY : int) : void Rational Rose 2000 Rose: The icons , and can be used instead of +, # and - 1.1.1 Class:Describes a Set of Objects

  6. Encapsulation -Also Called Data Hiding • Encapsulation: hiding the the implementation of the data from users of the object. Users are typically objects of other classes.The users don’t see if the data is stored in fields, calculated or if they are retrieved from a database, they only call a method. • Encapsulation is achieve by never letting objects directly access fields. Fields should only be accessed through the object’s methods. • Making the fields private (or protected) ensures encapsulation. If you want objects of different types to access the fields, then make public methods (or package accessibility) for this purpose.

  7. Operation Versus Method (C++ member function) A method is an implementation of an operation. A method specifies the algorithm or procedure thatproduces the results of an operation.

  8. Institute Person works for Job description salary Association Classes The association between classes may have attributes of its own. This can be modeled by connecting a class to the association.

  9. ISortable 1.1.2 Interface:A Named Set of Operations That Describes Some Behavior (No Implementation) stereotype interface name operationcompartment interface - iconic form interface - expanded form

  10. An Interface Can Be Seen As a Protocol • An interface is an agreement on behavior. • A class which implements an interface agrees on supporting the specified behavior. • An interface can also be seen as a definition of a role, classes which implements the role are able to play that role. Example: A plane has a certain interface (a stick, ..), the same interface can also be implemented by a flight simulator. A plane and a flight simulator is two different types of objects, but they have both the same interface (implemented differently). If you don’t have interfaces as modeling elements it would be hard to show that we are talking about the same interface.

  11. A Java Example: Interface ActionListener From the Java documentation: The listener interface for receiving action events. The class that is interested in processing an action event implements this interface, and the object created with that class is registered with a component, using the component's addActionListener method. When the action event occurs, that object's actionPerformed method is invoked. Component Button requires someone to support the ActionListener interface ”interface” ActionListener Button actionPerformed(e: ActionEvent) + addActionListener(actionlistener : ActionListener) OneListener realize or supplies the ActionListener interface UML 2.0 Notation: OneListener OneListener ActionListener actionPerformed(e: ActionEvent) Button

  12. Snake pos:Point move() bite() Active class: describes objectsthat owns their own thread;The behavior of this objectscan be concurrent with others 1.1.3 Active Class

  13. Listener Collaboration: describes a collaborationbetween roles to achieve a particular goal. A collaboration can represent animplementationof a use case or a particularpattern. 1.1.4 Collaboration

  14. calculate.class Component: a physicalpart of the system whichimplements a set of interfaces. 1.1.5 Component Example: oneButton OneListener ActionListener

  15. Different types ofComponents (in UML) • Deployment Components: this components can be assembled to form a complete executable system.Example: A complete executable application, a dynamic library (DLL), a JavaBean, a COM+ object. • Work Product Components: this components are the basis for making the deployment components. They are not a part of the executable system, but results from the development process. Example: Source code. • Execution Components: this components are created by an executing system. Example: a JavaBean created during runtime.

  16. Menu Web Example Working productcomponent Deployment component Menu.html ------------ --- Menu.java Could be an execution component,e.g. Produced by a servelet Deployment component Menu.jpg

  17. videoServer Node: a physical element that represent a computational resource(e.g. processor and memory). 1.1.6 Node

  18. Registerfor exam Use case: describes a sequence of actions that yields an observable result for an actor. With use cases you can structure the behavioral things in a model. 1.1.7 Use Case

  19. Extensibility Mechanisms «container» EventQueue {version 2.1} tagged value add(e:event) remove(n:int) «query» length():int «helper function» reorder() {add runs in O(1) time} stereotype constraint

  20. 1.2 Behavioral Elements • Describing the dynamically parts of the model. Behavioral elements are identified with the help of verbs. • 1.2.1 Interaction • 1.2.2 State

  21. User Oven-control -unit Oven-light Set temperature(250C) heatOn() lightOn 1.2.1 Interaction Interaction: A behaviour that comprises aset of messages sent between a set of objectsto archive a special purpose, like in a sequencediagram.

  22. 1.2.2 State Machine State machine: A description of the different states an object can go through in response to events. Events generated by the object is also shown. An activity diagram is a special case of a state diagram.

  23. 1.3 Grouping Elements • You can group elements with the help of packages. • [1]: ”A package may own other elements, including classes, ..., diagrams, and even other packages.” • You can use packages to orginaze your classes (interfaces,..) and your diagrams. java applet +Applet

  24. 1.4 Annotational Elements • You can add comments to a diagram with the help of notes. A comment

  25. References • [1] Grady Booch, James Rumbaugh and Ivar Jacobson:The Unified Modeling Language User Guide.Addison-Wesley, 1999 • James Rumbaugh, Michael Blaha, William Premerlani, Frederick Eddy and William Lorenzen: Object-Oriented Modeling and Design. Prentice Hall, 1991 • Martin Fowler with Kendall Scott: UML Distilled.Addison-Wesley, 1997 • Terry Quatrani: Visual Modeling with Rational Rose and UML.Addison-Wesley, 1998 • Ari Jaaksi: A Method for Your First Object-Oriented Project. JOOP - The Journal of Object-Oriented Programming, Januar 1998 • Rational software: http://www.rational.com/uml/documentation.html

More Related