UML for OOADStefan Kluth 1 2UML for OOAD 2.1What is UML? 2.2Classes in UML 2.3Relations in UML 2.4Static and Dynamic Design with UML.

Slides:



Advertisements
Similar presentations
Stereotypes Stereotypes provide the capability to create a new kind of modeling element. –They can be used to classify or mark modeling elements. –A type.
Advertisements

1 Objects and ClassesStefan Kluth 1.6Objects and Classes 1.6What is an Object? 1.7Objects and Classes 1.8Object Interface, Class Inheritance, Polymorphism.
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
Improved software quality through semantic descriptions (Skutt) Karlstad University Dept. of Computer Science UML introduction A short introduction.
Chapter 14 (Web): Object-Oriented Data Modeling
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.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Unified Modeling Language (UML)
© Copyright Eliyahu Brutman Programming Techniques Course.
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
Chapter 14: Object-Oriented Data Modeling
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Unified Modeling Language
UML Diagrams Computer Science I.
CIT UPES | Sept 2013 | Unified Modeling Language - UML.
Introduction to UML By: Prof. Aiman Hanna Department of Computer Science, Concordia University, Montreal, Canada.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Unified Modeling Language, Version 2.0
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: An Aside: The Quickest Tour through the UML that you will ever get.
1 UML Basic Training. UML Basic training2 Agenda  Definitions: requirements, design  Basics of Unified Modeling Language 1.4  SysML.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
CHAPTER 13 (ONLINE): OBJECT-ORIENTED DATA MODELING © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
Unit 1 INTRODUCTION TO MODELING AND CLASS MODEL Ref : L7-UML.PDF.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
1 Class Diagrams: Advanced Concepts. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are the most commonly used diagrams.
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
An Introduction to the Unified Modeling Language
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
Object Oriented Software Development
UML as a Specification Language for Embedded Systems. By, Mir Ahmed Ali, Asst. Professor, ECM department, SNIST. By, Prof. Narsiah sir, Director of School.
Unified Modeling Language. Object Oriented Methods ► What are object-oriented (OO) methods?  OO methods provide a set of techniques for analyzing, decomposing,
Design Model Lecture p6 T120B pavasario sem.
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
1 Class Diagrams. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are for visualizing, specifying and documenting.
Domain Classes – Part 1.  Analyze Requirements as per Use Case Model  Domain Model (Conceptual Class Diagram)  Interaction (Sequence) Diagrams  System.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
1 Unified Modeling Language, Version 2.0 Chapter 2.
UML Part 1: Class Diagrams. Introduction UML stands for Unified Modeling Language. It represents a unification of the concepts and notations presented.
Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
Chapter 3: Introducing the UML
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
UML. Model An abstract representation of a system. Types of model 1.Use case model 2.Domain model 3.Analysis object model 4.Implementation model 5.Test.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
1 An Overview of UML. 2 The Unified Modeling Language UML is a graphical language used by software engineers to model software systems during development.
1 Design Object Oriented Solutions Object Oriented Analysis & Design Lecturer: Mr. Mohammed Elhajj
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Use Cases UML. Use Cases What are Use Cases?  A statement of the functionality users expect and need, organized by functional units  Different from.
CHAPTER
Unified Modeling Language (UML)
Structural Modeling.
Object-Oriented Analysis and Design
Unified Modeling Language—UML A Very Brief Introduction
Systems Analysis and Design With UML 2
Introduction to Unified Modeling Language (UML)
UML Class Diagrams: Basic Concepts
Object Oriented Analysis and Design
Software Engineering Lecture #11.
Introduction to Unified Modeling Language (UML)
Chapter 20 Object-Oriented Analysis and Design
Appendix A Object-Oriented Analysis and Design
Class Diagrams.
Object Oriented System Design Class Diagrams
2 UML for OOAD 2.1 What is UML? 2.2 Classes in UML
Presentation transcript:

UML for OOADStefan Kluth 1 2UML for OOAD 2.1What is UML? 2.2Classes in UML 2.3Relations in UML 2.4Static and Dynamic Design with UML

UML for OOADStefan Kluth UML Background "The Unified Modelling Language (UML) is a graphical language for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system. The UML offers a standard way to write a systems blueprints, including conceptual things like business processes and system functions as well as concrete things such as programming language statements, database schemas, and reusable software components." Grady Booch, Ivar Jacobsen, Jim Rumbaugh Rational Software [OMG Unified Modelling Language Specification, Version 1.3, March 2000]

UML for OOADStefan Kluth Brief UML History ● Around 1980 – first OO modelling languages – other techniques, e.g. SA/SD ● Around 1990 – "OO method wars" – many modelling languages ● End of 90's – UML appears as combination of best practices

UML for OOADStefan Kluth Why UML? ● Physicists know formal graphical modelling – Mathematics to describe nature – Feynman graphs to calculate particle reaction rates ● We need a common language – discuss software systems at a black- (white-) board – document software systems – UML is an important part of that language – UML provides the "words and grammar"

UML for OOADStefan Kluth Classes in UML ● Classes describe objects – Interface (member function signature) – Behaviour (member function implementation) – State bookkeeping (values of data members) – Creation and destruction ● Objects described by classes collaborate – Class relations → object relations – Dependencies between classes

UML for OOADStefan Kluth UML Class Class name Data members Instance methods Arguments Return types Data members, arguments and methods are specified by visibility name : type Class method

UML for OOADStefan Kluth Class Name The top compartment contains the class name Abstract classes have italicised names Abstract methods also have italicised names Stereotypes are used to identify groups of classes, e.g interfaces or persistent (storeable) classes

UML for OOADStefan Kluth Class Attributes Attributes are the instance and class data members Class data members (underlined) are shared between all instances (objects) of a given class Data types shown after ":" Visibility shown as +public - private #protected Attribute compartment visibility name : type

UML for OOADStefan Kluth Class Operations (Interface) 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) Operations compartment visibility name : type

UML for OOADStefan Kluth Visibility + public Anyone can access Interface operations Not data members - private No-one can access Data members Helper functions "Friends" are allowd in though # protected Subclasses can access Operations where sub- classes collaborate Not data members (creates dependency off subclass on im- plementation of parent)

UML for OOADStefan Kluth Template Classes Generic classes depending on parametrised types Type parameter(s) Operations compartment as usual, but may have type parameter instead of concrete type

UML for OOADStefan Kluth Relations ● Association ● Aggregation ● Composition ● Parametric and Friendship ● Inheritance

UML for OOADStefan Kluth 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

UML for OOADStefan Kluth Unary Association A knows about B, but B knows nothing about A Arrow shows direction of association in direction of dependency

UML for OOADStefan Kluth Aggregation Aggregation = Association with "whole-part" relationship Shown by hollow diamond at the "whole" side No lifetime control implied

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

UML for OOADStefan Kluth Association Details Name gives details of association Name can be viewed as verb of a sentence Notes at association ends explain "roles" of classes (objects) Multiplicities show number of objects which participate in the association

UML for OOADStefan Kluth Friendship Friends are granted access to private data members and member functions Friendship is given to other classes, never taken Bob Martin: More like lovers than friends. You can have many friends, you should not have many lovers Friendship breaks data hiding, use carefully

UML for OOADStefan Kluth Parametric Association Association mediated by a parameter (function call argument) A depends upon B, because it uses B No data member of type B in A

UML for OOADStefan Kluth Inheritance Base class or super class Derived class or subclass Arrow shows direction of dependency → B inherits A's interface, behaviour and data members → B can extend A, i.e. add new data members or member functions → B depends on A, A knows nothing about B

UML for OOADStefan Kluth Associations Summary ● Can express different kinds of associations between classes/objects with UML – Association, aggregation, composition, inheritance – Friendship, parametric association ● Can go from simple sketches to more detailed design by adding adornments – Name, roles, multiplicities – lifetime control

UML for OOADStefan Kluth Multiple Inheritance The derived class inherits interface, behaviour and data members of all its base classes Extension and overriding works as before B implements the interface A and is also a "countable" class Countable also called a "Mixin class"

UML for OOADStefan Kluth Deadly Diamond of Death Now hits the %&$? Data members of TObject are inherited twice in B, which ones are valid? Fortunately, there is a solution to this problem: → virtual inheritance in C++: only one copy of a multiply inherited structure will be created (A C++ feature)

UML for OOADStefan Kluth Static and Dynamic Design ● Static design describes code structure and object relations – Class relations – Objects at a given time ● Dynamic design shows communication between objects – Similarity to class relations – can follow sequences of events

UML for OOADStefan Kluth Class Diagram ● Show static relations between classes – we have seen them already – interfaces, data members – associations ● Subdivide into diagrams for specific purpose – showing all classes usually too much – ok to show only relevant class members – set of all diagrams should describe system

UML for OOADStefan Kluth Object Diagram Object diagram shows relations at instant in time (snapshot) Object relations are drawn using the class association lines Class diagram never changes

UML for OOADStefan Kluth Sequence Diagram Show sequence of events for a particular use case Object Lifeline Activation Messages half-arrow=asynchronous, full arrow=synchronous, dashed=return Active object

UML for OOADStefan Kluth Sequence Diagram Can show creation and destruction of objects Destruction mark

UML for OOADStefan Kluth Sequence Diagram Slanted messages take some time Can model real-time systems

UML for OOADStefan Kluth Sequence Diagram Crossing message lines are a bad sign → race conditions

UML for OOADStefan Kluth Collaboration Diagram Object diagram with numbered messages Sequence numbers of messages are nested by procedure call

UML for OOADStefan Kluth Static and Dynamic Design Summary ● Class diagrams → object diagrams – classes → objects; associations → links ● Dynamic models show how system works – Sequence and collaboration diagram ● There are tools for this process – UML syntax and consistency checks ● Rough sketches by hand or with simple tools – aid in design discussions

UML for OOADStefan Kluth 33 Some Comments ● Design-heavy development processes – several 10% of person-power/time spent on design with formal UML from requirements – start coding when the design is consistent – large software houses may work this way ● Lighter processes – a few % of person-power/time spent with UML – UML as a discussion and documentation aid – probably more adequate in HEP