Lectures 2 & 3: Introduction to Modeling & UML. Getting started



Similar documents
Lecture 9: Requirements Modelling

III. Class and Object Diagrams

Lecture 6: Requirements Modeling II. The Entity Relationship Model

Object Oriented Design

III. Class and Object Diagrams

Lecture 12: Entity Relationship Modelling

11 November

How To Design Software

II. Conceptual Modeling

Object Interaction. Object Diagrams. Object Diagrams Object

Engineering Process Software Qualities Software Architectural Design

Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design

Génie Logiciel et Gestion de Projets. Software Requirements Engineering

In this Lecture you will Learn: Systems Development Methodologies. Why Methodology? Why Methodology?

UML Class Diagrams. Lesson Objectives

UML Diagram Types. Use Cases do the Following. Use Case Diagram

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

Java (12 Weeks) Introduction to Java Programming Language

Introduction. UML = Unified Modeling Language It is a standardized visual modeling language.

Chap 1. Introduction to Software Architecture

Graphical Systems Modeling with UML / SysML Class diagrams

Detecting Defects in Object-Oriented Designs: Using Reading Techniques to Increase Software Quality

CSC340: Information Systems Analysis and Design. About the Course

System Modeling / Class Diagra Diagr m a Week 6

Assuming the Role of Systems Analyst & Analysis Alternatives

Announcements. SE 1: Software Requirements Specification and Analysis. Review: Use Case Descriptions

Using UML Part One Structural Modeling Diagrams

Umbrello UML Modeller Handbook

Programming Language Constructs as Basis for Software Architectures

Object Oriented Programming. Risk Management

Applying 4+1 View Architecture with UML 2. White Paper

UML TUTORIALS THE COMPONENT MODEL

Lecture 7 Notes: Object-Oriented Programming (OOP) and Inheritance

Object Oriented Software Models

DISCLAIMER OVERVIEW WHY DO WE MODEL WHAT IS QUALITY? Jeff Jacobs,

Business Modeling with UML

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT SYSTEMS ANALYSIS & DESIGN EXAMINERS REPORT

Tutorial - Building a Use Case Diagram

Masters of Science in Software & Information Systems

Contents. Introduction and System Engineering 1. Introduction 2. Software Process and Methodology 16. System Engineering 53

Menouer Boubekeur, Gregory Provan

Architecture. Reda Bendraou

A UML Introduction Tutorial

Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

Tool Support for Software Variability Management and Product Derivation in Software Product Lines

History OOP languages Year Language 1967 Simula Smalltalk

Software Engineering. System Models. Based on Software Engineering, 7 th Edition by Ian Sommerville

Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c

UML Tutorial: Part 1 -- Class Diagrams.

Karunya University Dept. of Information Technology

Analysis and Design with UML

Concepts of Database Management Seventh Edition. Chapter 9 Database Management Approaches

Design and UML Class Diagrams

How To Draw A Cell Phone Into A Cellphone In Unminimal Diagram (Uml)

IV. The (Extended) Entity-Relationship Model

TECH. Requirements. Why are requirements important? The Requirements Process REQUIREMENTS ELICITATION AND ANALYSIS. Requirements vs.

Communication Diagrams

Types of UML Diagram. UML Diagrams OOAD. Computer Engineering Sem -IV

Object Oriented Analysis and Design and Software Development Process Phases

Designing Real-Time and Embedded Systems with the COMET/UML method

Modeling the User Interface of Web Applications with UML

Fundamentals of Java Programming

Kirsten Sinclair SyntheSys Systems Engineers

Using Use Cases on Agile Projects

An Introduction To UML Class Diagrams Classes

Managing Variability in Software Architectures 1 Felix Bachmann*

A Relationship-Based Approach to Model Integration

4) CRM provides support for front-end customer facing functionality. Answer: TRUE Diff: 1 Page Ref: 334

Object-oriented design methodologies

Software Engineering. System Modeling

CHAPTER_3 SOFTWARE ENGINEERING (PROCESS MODELS)

Generating Aspect Code from UML Models

Design methods. List of possible design methods. Functional decomposition. Data flow design. Functional decomposition. Data Flow Design (SA/SD)

Model Driven Business Architecture. Pete Rivett CTO, Adaptive

UML Modeling Guidelines

Software Design Document (SDD) Template

A Proposal for Constructing Relational Database from Class Diagram

Modeling Web Applications Using Java And XML Related Technologies

Chapter 2: Entity-Relationship Model. Entity Sets. " Example: specific person, company, event, plant

Structure of Presentation. The Role of Programming in Informatics Curricula. Concepts of Informatics 2. Concepts of Informatics 1

Unit I Page No. 1 System Development Object Basics Development Life Cycle Methodologies Patterns Frameworks Unified Approach UML

UML basics. Part III: The class diagram. by Donald Bell IBM Global Services

Principles of Software Construction: Objects, Design, and Concurrency. Domain Modeling and Specifying System Behavior. toad

Design and UML Class Diagrams. Suggested reading: Practical UML: A hands on introduction for developers

ATM Case Study OBJECTIVES Pearson Education, Inc. All rights reserved Pearson Education, Inc. All rights reserved.

Data Modeling Basics

UML-based Test Generation and Execution

Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page:

CSC 742 Database Management Systems

UML for the C programming language.

The UML Class Diagram

Software Requirements Specification of A University Class Scheduler

Information Systems Analysis and Design CSC John Mylopoulos. Software Architectures Information Systems Analysis and Design CSC340

Chapter 8 The Enhanced Entity- Relationship (EER) Model

Transcription:

Lectures 2 & 3: Introduction to Modeling & UML Why Build Models? What types of Models to build Intro to UML Class Diagrams Relationship between UML and program code Uses of UML 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. Getting started Youʼve just joined an ongoing project Where do you start? (oh, BTW, the project doesnʼt really have any documentation) Reverse Engineering: Recover design information from the code Create higher level views to improve understanding E.g. Structure of the code Code Dependencies Components and couplings E.g. Behaviour of the code Execution traces State machine models of complex objects E.g. Function of the code What functions does it provide to the user? 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2

Sometimes you donʼt need a map 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 3 Why build models? Modelling can guide your exploration: It can help you figure out what questions to ask It can help to reveal key design decisions It can help you to uncover problems Modelling can help us check our understanding Reason about the model to understand its consequences Does it have the properties we expect? Animate the model to help us visualize/validate software behaviour Modelling can help us communicate Provides useful abstractions that focus on the point you want to make without overwhelming people with detail Throw-away modelling? The exercise of modelling is more important than the model itself Time spent perfecting the models might be time wasted 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4 2

Maps as Abstractions 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6 3

Abstraction Dealing with problem complexity Ignore detail to see the big picture Treat objects as the same by ignoring certain differences (beware: every abstraction involves choice over what is important) Decomposition Partition a problem into independent pieces, to study separately (beware: the parts are rarely independent really) Projection Separate different concerns (views) and describe them separately Different from decomposition as it does not partition the problem space (beware: different views will be inconsistent most of the time) Modularization Choose structures that are stable over time, to localize change (beware: any structure will make some changes easier and others harder) 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7 the Unified Modelling Language (UML) Third generation OO method Booch, Rumbaugh & Jacobson are principal authors Still evolving (currently version 2.0) Attempt to standardize the proliferation of OO variants Is purely a notation No modelling method associated with it! Was intended as a design notation Has become an industry standard But is primarily promoted by IBM/Rational (who sell lots of UML tools, services) Has a standardized meta-model Use case diagrams Class diagrams Message sequence charts Activity diagrams State Diagrams Module Diagrams Platform diagrams 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8 4

Modeling Notations UML Class Diagrams information structure relationships between data items modular structure for the system Use Cases userʼs view Lists functions visual overview of the main requirements UML Package Diagrams Overall architecture Dependencies between components UML Sequence Diagrams individual scenario interactions between users and system Sequence of messages (UML) Statecharts responses to events dynamic behavior event ordering, reachability, deadlock, etc Activity diagrams business processes; concurrency and synchronization; dependencies between tasks; 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9 Intro: Object Classes in UML Generalization (an abstraction hierarchy) :patient Name Date of Birth physician history Source: Adapted from Davis, 990, p67-68 Aggregation (a partitioning hierarchy) :patient Name Date of Birth physician history 0.. 0.. 0.. :in-patient Room Bed Treatments food prefs :out-patient Last visit next visit prescriptions :heart Natural/artif. Orig/implant normal bpm..2 :kidney Natural/artif. Orig/implant number 0..2 :eyes Natural/artif. Vision colour 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 0 5

Class name aggregation attributes :patient Name Date of Birth Height Weight 0.. 0.. services 0.. multiplicities..2 :kidney Operational? 0..2 :eye Colour Diameter Correction :heart generalization Normal bpm Blood type :In-patient Room Bed Physician :Out-patient Last visit next visit physician :organ Natural/artif. Orig/implant donor 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. What are classes? A class describes a group of objects with similar properties (attributes), common behaviour (operations), common relationships to other objects, and common meaning ( semantics ). Examples employee: has a name, employee# and department; an employee is hired, and fired; an employee works in one or more projects Attributes (optional) :employee name employee# department hire() fire() assignproject() Name (mandatory) Operations (optional) 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2 6

Attribute name The full notation Attribute type Student Name of the class Other Properties Visibility: +, -, #, + name: string [] = Anon {readonly} + registeredin: Course [*] + register (c: Course) + isregistered (c: Course) : Boolean Default value Multiplicity Operation name Parameters Return value 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 3 Objects vs. Classes The instances of a class are called objects. Objects are represented as: Fred_Bloggs:Employee name: Fred Bloggs Employee #: 234609234 Department: Marketing Two different objects may have identical attribute values (like two people with identical name and address) Objects have associations with other objects E.g. Fred_Bloggs:employee is associated with the KillerApp:project object But we will capture these relationships at the class level (why?) Note: Make sure attributes are associated with the right class E.g. you donʼt want both managername and manager# as attributes of Project! ( Why??) 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4 7

Generalization Notes: Subclasses inherit attributes, associations, & operations from the superclass A subclass may override an inherited aspect e.g. AdminStaff & CreativeStaff have different methods for calculating bonuses Superclasses may be declared {abstract}, meaning they have no instances Implies that the subclasses cover all possibilities e.g. there are no other staff than AdminStaff and CreativeStaff 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5 Aggregation Aggregation and Composition This is the Has-a or Whole/part relationship Composition Strong form of aggregation that implies ownership: if the whole is removed from the model, so is the part. the whole is responsible for the disposition of its parts :Engine composition :Car :Locomotive..* 0.. :Train aggregation 0.. driver :Person 0..* 0.. passengers 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6 8

Aggregation / Composition (Refresher) aggregation Club * * Member What does this mean?? composition Polygon {ordered} Point centre Circle 3..* Note: No sharing - any instance of point can be part of a polygon or a circle, but not both 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7 Associations Objects do not exist in isolation from one another A relationship represents a connection among things. In UML, there are different types of relationships: Association Aggregation and Composition Generalization Dependency Realization Class diagrams show classes and their relationships 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8 9

Association Multiplicity Ask questions about the associations: Can a campaign exist without a member of staff to manage it? If yes, then the association is optional at the Staff end - zero or more (0..*) If no, then it is not optional - one or more (..*) If it must be managed by one and only one member of staff - exactly one () What about the other end of the association? Does every member of staff have to manage exactly one campaign? No. So the correct multiplicity is zero or more. Some examples of specifying multiplicity: Optional (0 or ) 0.. Exactly one =.. Zero or more 0..* = * One or more..* A range of values 2..6 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9 Multiplicity A client has exactly one staffmember as a contact person :StaffMember staffname staff# staffstartdate Role The staffmember s role in this association is as a contact person Class associations Multiplicity A staff member has zero or more clients on His/her clientlist Name of the association liaises with 0..* contact ClientList person Direction The liaises with association should be read in this direction Role The clients role in this association is as a clientlist :Client companyaddress companyemail companyfax companyname companytelephone 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 20 0

More Examples 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2 Navigability / Visibility Order + datereceived: Date [0..] + isprepaid: Boolean [] + lineitems: OrderLine [*] {ordered} Date 0.. * +datereceived Order +isprepaid Boolean * +lineitems {ordered} OrderLine 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 22

Bidirectional Associations Person 0.. * Car Person Car + carsowned: Car [*] + Owner: Person [0..] Hard to implement correctly! 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 23 Dependencies Model View ViewController Layout Example Dependency types: <<call>> <<use>> <<create>> <<derive>> <<instantiate>> <<permit>> <<realize>> <<refine>> <<substitute>> <<parameter>> 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 24 2

Interfaces <<interface>> Collection equals add Order LineItems [*] <<requires>> get <<interface>> List <<implements>> get add ArrayList Collection Order LineItems [*] List ArrayList 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 25 Annotations Comments -- can be used to add comments within a class description Notes {length = start - end} Date Range Start: Date End: Date /length: integer Constraint Rules Any further constraints {in curly braces} e.g. {time limit: length must not be more than three months} 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 26 3

What UML class diagrams can show Division of Responsibility Operations that objects are responsible for providing Subclassing Inheritance, generalization Navigability / Visibility When objects need to know about other objects to call their operations Aggregation / Composition When objects are part of other objects Dependencies When changing the design of a class will affect other classes Interfaces Used to reduce coupling between objects 202 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 27 4