Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

Similar documents
So#ware Engineering Just Enough UML. Klaus Ostermann

Principles of Software Construction: Objects, Design and Concurrency. Introduction to Design. toad

UML Modeling I. Instructor: Yongjie Zheng September 3, CS 490MT/5555 Software Methods and Tools

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Unified Modeling Language (UML) Class Diagram

Unified Modeling Language (UML) and Modeling

Software Service Engineering

Today s Topic. Lecture 5. What is UML? Why Use UML. UML Diagrams. Introduction to UML. What is UML Why use UML? UML Diagrams

CS/IT Secure Software Construction

Principles of Software Construction: Objects, Design and Concurrency. Object-Oriented Design: Assigning Responsibilities.

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

Object-Oriented Software Engineering Practical Software Development using UML and Java

Introduction to Software Engineering. 5. Modeling Objects and Classes

Topic 3 Unified Modeling Language UML. Objective: Student will use UML to represent relationshiops between objects, its structure and dynamics.

COSC 3351 Software Design. An Introduction to UML (I)

Model Driven Development Unified Modeling Language (UML)

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

Object-Oriented Design

PROCESSI DI PRODUZIONE E GESTIONE DEL SOFTWARE. Analysis and Design with UML. Paola Turci

Object Oriented Modeling

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A

JOURNAL OF OBJECT TECHNOLOGY

Object-Oriented Design

BCS Higher Education Qualifications. Diploma in IT. Object Oriented Programming Syllabus

UML (Unified Modeling Language)

Review of Basic Software Design Concepts. Fethi Rabhi SENG 2021

Modeling System Behavior. Events Scenarios Sequence Diagrams Collaboration Diagrams

SOFTWARE ENGINEERING UML FUNDAMENTALS. Saulius Ragaišis.

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

OBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization

Dr.S.S.Riaz Ahamed Principal, Sathak Institute of Technology, Ramanathapuram,India.

System Sequence Diagrams. Based on Craig Larman, Chapter 10 and Anuradha Dharani s notes

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

The Unified Modeling Language (UML)

12 Tutorial on UML. TIMe TIMe Electronic Textbook

Introduction to Software Engineering. 5. Modeling Objects and Classes

Developing Shlaer-Mellor Models Using UML

Engineering Design w/embedded Systems

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

UML class diagrams. Nigel Goddard. School of Informatics University of Edinburgh

Software Modelling. UML Class Diagram Notation. Unified Modeling Language (UML) UML Modelling. CS 247: Software Engineering Principles

Domain Model and Domain Modeling

CS 247: Software Engineering Principles. UML Modelling

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

Notation Part 1. Object Orientated Analysis and Design. Benjamin Kenwright

UML Tutorial. Unified Modeling Language UML Tutorial

The Unified Modelling Language. Example Diagrams. Notation vs. Methodology. UML and Meta Modelling

Software Design And Modeling BE 2015 (w. e. f Academic Year )

Lecture 17: (Architecture V)

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

OBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization

Class diagrams and architectural design

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Software Engineering I (02161)

UML data models from an ORM perspective: Part 4

TIME-BASED CONSTRAINTS IN THE OBJECT CONSTRAINT LANGUAGE OCL

What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships

What is a Class Diagram? Class Diagram. Why do we need Class Diagram? Class - Notation. Class - Semantic 04/11/51

Metamodeling. Janos Sztipanovits ISIS, Vanderbilt University

CHAPTER 1. Topic: UML Overview. CHAPTER 1: Topic 1. Topic: UML Overview

Fuente. conceptual data modelling model

administrivia today UML start design patterns Tuesday, September 28, 2010

02291: System Integration

Lecture 34 SDLC Phases and UML Diagrams

From Analysis to Design. LTOOD/OOAD Verified Software Systems

Unified Modeling Language (UML)

Course "UML and Design Patterns" of module "Software Engineering and Design", version February 2011 (X)

Modern Systems Analysis and Design Seventh Edition

SEEM4570 System Design and Implementation Lecture 11 UML

What is a Data Model?

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

LABORATORY 1 REVISION

Introduction to UML Diagrams

Lecture 33 April 4, Unied Modelling Language. ECE155: Engineering Design with Embedded Systems Winter Patrick Lam version 1

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

MSc programme (induction week) Department of Informatics INTRODUCTION TO UML

Object-Oriented Design

A Conceptual Model of the UML

Software Specification 2IX20

Topic : Object Oriented Design Principles

SE 1: Software Requirements Specification and Analysis

Introduction to UML. (Unified Modeling Language)

Unified Modeling Language

Nick Rozanski Andy Longshaw Eoin Woods. Sold! How to Describe, Explain and Justify your Architecture

to schedule pressure

Design and UML Class Diagrams

Use-Case Analysis. Architecture Oriented Analysis. R. Kuehl/J. Scott Hawker p. 1 R I T. Software Engineering

Relationships. Association Aggregation/Composition Multiplicity Dependencies

Object-Oriented Modeling. Sequence Diagram. Slides accompanying Version 1.0

Introduction to UML What is UML? Motivations for UML Types of UML diagrams UML syntax Descriptions of the various diagram types Rational Rose (IBM.. M

C++ (Non for C Programmer) (BT307) 40 Hours

Principles of Software Construction: Objects, Design, and Concurrency. Assigning Responsibilities to Objects. toad. Jonathan Aldrich Charlie Garrod

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

Information Technology Audit & Cyber Security

OBJECT ORIENTED ANALYSIS AND DESIGN SYLLABUS

Objectives. Explain the purpose and objectives of objectoriented. Develop design class diagrams

UML Sequence Diagrams

Software Life-Cycle Models

Object-Oriented and Classical Software Engineering

Transcription:

Principles of Software Construction: Objects, Design and Concurrency Just enough UML 15-214 toad Christian Kästner Charlie Garrod School of Computer Science With slides from Klaus Ostermann

Learning Goals Basic fluency in UML Ability to communicate with class diagrams and interaction diagrams toad 2

UML Unified Modeling Language Graphical Notation to describe classes, objects, behavior, and more You will need: Class Diagrams Interaction Diagrams (Sequence and Communication Diagrams) toad 3

Goal of Modeling Modeling is primarily for communication with yourself with team members with customers Agree on common understanding Forces to clarify understanding (relationships etc) Visual representation scales better than code abstraction Mostly used for informal communication toad 4

Class Diagrams A class diagram describes the types of objects in a system and the various kinds of static relationships between them Associations Subtypes Class diagrams also show the attributes, names/types of operations, and constraints that restrict how objects are connected toad 5

Class Diagrams Example toad 6

Three ways to use class diagrams Conceptual: Draw a diagram that represents the concepts in the domain under study Conceptual classes reflect concepts in the domain Little or no regard for software that might implement it Specification: Describing the interfaces of the software, not the implementation Software classes representing candidates for implem. Often confused in OO since classes combine both interfaces and implementation Implementation: Diagram describes actual implementation classes Understanding the intended perspective is crucial to drawing and reading class diagrams, even though the lines between them are not sharp toad 7

Associations Associations represent relationships between instances of classes Conceptual perspective: Associations represent conceptual relationships Specification perspective: Associations represent responsibilities Implementation perspective: Associations represent pointers/fields between related classes toad 8

Associations Each association has two ends Each end can be named with a label called role name An end also has a multiplicity: How many objects participate in the given relationship General case: give upper and lower bound in lower..upper notation Abbreviations: * = 0..infinity, 1 = 1..1 Most common multiplicities: 1, *, 0..1 In the specification perspective, one can infer existence and names (if naming conventions exist) of methods to navigate the associations, for example: Class Order { public Customer getcustomer(); public Set<OrderLine> getorderlines(); } toad 9

Associations In the implementation perspective we can conclude existence of pointers in both directions between related classes class Order { private Customer _ customer; private Set<OrderLine> _orderlines; } class Customer { private Set<Order> orders; } toad 10

Associations Unidirectional vs bidirectional Arrows in association lines indicate navigability Only one arrow: unidirectional association No or two arrows: bidirectional association Specification perspective: Indicates navigation operations in interfaces Implementation perspective: Indicates which objects contain the pointers to the other objects Arrows serve no useful purpose in conceptual perspective For bidirectional associations, the two navigations must be inverses of each other toad 11

Unidirectional Associations toad 12

Class Diagrams: Attributes Attributes are very similar to associations Conceptual level: A customer s name attribute indicates that customers have names Specification level: Attribute indicates that a customer object can tell you its name Implementation level: customer has a field (aka instance variable) for its name UML syntax for attributes: visibility name : type = defaultvalue Details may be omitted toad 13

Class Diagrams: Attributes vs Associations Attributes describe non-object-oriented data Integers, strings, booleans, From conceptual perspective this is the only difference Specification and implementation perspective: Attributes imply navigability from type to attribute only Implied that type contains solely its own copy of the attribute objects toad 14

Class Diagrams: Operations Operations are the processes that a class knows to carry out Most obviously correspond to methods on a class Full syntax: visibility name(parameter-list) : return-type visibility is + (public), # (protected), or - (private) name is a string parameter-list contains comma-separated parameters whose syntax is similar to that for attributes Can also specificy direction: input (in), output(out), or both (inout) Default: in return-type is comma-separated list of return types (usually only one) toad 15

Class Diagrams: Constraint Rules Arbitrary constraints can be added by putting them inside braces({}) Mostly formulated in informal natural language UML also provides a formal Object Constraint Language (OCL) Constraints should be implemented as assertions in your programming language toad 16

Object Diagrams (Class diagram that belongs to the object diagram) toad 17

Aggregation vs Composition Aggregation expresses part-of relationships, but rather vague semantics Composition is stronger: Part object live and die with the whole toad 18

Abstract classes and methods UML convention for abstract classes/methods: Italicize name of abstract item or use {abstract} constraint toad 19

Interfaces and Lollipop notation toad 20

Interaction Diagrams Interaction diagrams describe how groups of objects collaborate in some behavior Two kinds of interaction diagrams: sequence diagrams and communication diagrams toad 21

Sequence Diagram Example toad 22

Sequence Diagrams Vertical line is called lifeline Each message represented by an arrow between lifelines Labeled at minimum with message name Can also include arguments and control information Can show self-call by sending the message arrow back to the same lifeline Can add condition which indicates when message is sent, such as [needsreorder] Can add iteration marker which shows that a message is sent many times to multiple receiver objects toad 23

Communication Diagram Example toad 24

Communication Diagram Example: Decimal Numbering System toad 25

Sequence vs Communication Diagrams Sequence diagrams are better to visualize the order in which things occur Communication diagrams also illustrate how objects are statically connected Communication diagrams often are more compact You should generally use interaction diagrams when you want to look at the behavior of several objects within a single use case. toad 26

The UML universe There is a lot more to the UML than what we have shown here More diagram types State diagrams, activity diagrams, use cases, deployment diagrams, More notational features in all diagram types Stereotypes, parameterized classes, We will touch some UML features not shown here during the course and will explain them as needed toad 27

UML Misconceptions and Limitations UML is not language-independent. It is a language, as the L in UML suggests. This language is something like a high-level best-of of common OO programming language features It contains notation for features that are only available in some (or even no) programming language (such as: dynamic classification) Every OO language has features that have no corresponding notation in the UML (e.g. wildcards in Java) The same UML notation may have a different meaning in different OO languages (e.g. visibility) The UML has no clearly defined semantics. This is both a limitation and a feature Good for informal diagrams, bad for formal specifications No consensus in the community about the scenarios where UML is useful toad 28

Literature Shalloway and Trott. Design Patterns Explained. Addison-Wesley. 2005 brief introduction only Craig Larman, Applying UML and Patterns, Prentice Hall, 2004 detailed introduction of class diagrams and interaction diagrams detailed guidelines for modeling (e.g., when to use an association and when to use an attribute) Martin Fowler. UML Distilled. Addison-Wesley. 2003 detailed introduction to UML including many other diagrams and advanced concepts toad 29