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

Slides:



Advertisements
Similar presentations
Introduction to Object Orientation System Analysis and Design
Advertisements

7M822 UML Class Diagrams 7 October 2010.
Systems Analysis and Design 8th Edition
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System modeling 2.
Unified Modeling Language
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Data and Process Modeling
CSE 240 Lecture 4. Quote of the day “A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building,
Systems Analysis & Design Sixth Edition Systems Analysis & Design Sixth Edition Toolkit Part 5.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
© Copyright Eliyahu Brutman Programming Techniques Course.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Object-Oriented Analysis and Design
UML Unified Markup Language Ziya Karakaya Atılım University, Computer Engineering
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
Chapter 5: Modelling with Classes
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.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
1 UML Basic Training. UML Basic training2 Agenda  Definitions: requirements, design  Basics of Unified Modeling Language 1.4  SysML.
Lecture 5: Modelling with Classes. © Lethbridge/Laganière 2005 Chapter 5: Modelling with classes2 5.1 What is UML? The Unified Modelling Language is a.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 Object-oriented and Structured System Models.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
Systems Analysis & Design 7 th Edition Chapter 5.
Systems Analysis and Design 8 th Edition Chapter 6 Object Modeling.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
An Introduction to the Unified Modeling Language
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
CSE 240 Lecture 5. © Lethbridge/Laganière 2001 Chapter 5: Modelling with classes2 Overview Discuss Assignment 1 Discuss more of chapter 5, possibly finish.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
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
® IBM Software Group © 2007 IBM Corporation Module 3: Creating UML Diagrams Essentials of Modeling with IBM Rational Software Architect, V7.5.
Basic Characteristics of Object-Oriented Systems
Chapter 11 Inheritance © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured and Object-Oriented.
Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
CSCE 240 – Intro to Software Engineering Lecture 3.
Notices Assn 2 is due tomorrow, 7pm. Moodle quiz next week – written in the lab as before. Everything up to and including today’s lecture: Big Topics are.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 14 Slide 1 Object-Oriented Design.
Software Modelling Class Diagram. Class Diagrams The main building block in object oriented modeling They are used both for general conceptual modeling.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Introduction to UML.
Unified Modeling Language (UML)
Evolution of UML.
Object-Oriented Analysis and Design
Systems Analysis and Design With UML 2
Unified Modeling Language
OO Domain Modeling With UML Class Diagrams and CRC Cards
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Software Architecture & Design Pattern
UML Class Diagrams: Basic Concepts
Software Engineering Lecture #11.
CIS 375 Bruce R. Maxim UM-Dearborn
Chapter 5.
CIS 375 Bruce R. Maxim UM-Dearborn
Presentation transcript:

Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes

Objective Upon completing this lesson you will be able to Use the most essential features of UML class diagrams properly Apply a systematic step-by-step process for modeling the structure of object-oriented classes using UML Map Java source code to UML class diagrams and vice versa © Lethbridge/Laganière 2005 Chapter 5: Modelling with classes2

Review of Object Orientation Basic Concepts Classes —Attributes —Operations (Methods) Objects Relationships Basic Principles Abstraction Encapsulation Modularity Hierarchy © Lethbridge/Laganière 2005 Chapter 5: Modelling with classes3

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes4 5.1 What is UML? The Unified Modelling Language is a standard graphical language for modelling object oriented software At the end of the 1980s and the beginning of 1990s, the first object- oriented development processes appeared The proliferation of methods and notations tended to cause considerable confusion Two important methodologists Rumbaugh and Booch decided to merge their approaches in —They worked together at the Rational Software Corporation In 1995, another methodologist, Jacobson, joined the team —His work focused on use cases In 1997 the Object Management Group (OMG) started the process of UML standardization What would you draw?

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes5 UML diagrams Class diagrams —describe classes and their relationships Interaction diagrams —show the behaviour of systems in terms of how objects interact with each other State diagrams and activity diagrams —show how systems behave internally Component and deployment diagrams —show how the various components of systems are arranged logically and physically

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes6 UML features It has detailed semantics It has extension mechanisms It has an associated textual language —Object Constraint Language (OCL) The objective of UML is to assist in software development —It is NOT a methodology

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes7 What constitutes a good model? A model should use a standard notation be understandable by clients and users lead software engineers to have insights about the system provide abstraction Models are used: to help create designs to permit analysis and review of those designs. as the core documentation describing the system.

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes8 5.2 Essentials of UML Class Diagrams The main symbols shown on class diagrams are: Classes -represent the types of data themselves Associations -represent linkages between instances of classes Attributes -are simple data found in classes and their instances Operations -represent the functions performed by the classes and their instances Generalizations -group classes into inheritance hierarchies

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes9 Classes A class is simply represented as a box with the name of the class inside The diagram may also show the attributes and operations The complete signature of an operation is: operationName(parameterName: parameterType …): returnType :void int

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes10 Associations and Multiplicity An association is used to show how two classes are related to each other Symbols indicating multiplicity are shown at each end of the association Each association can be labelled, to make explicit the nature of the association

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes11 Analyzing and validating associations Many-to-many —A secretary can work for many managers —A manager can have many secretaries —Secretaries can work in pools —Managers can have a group of secretaries —Some managers might have zero secretaries. —Is it possible for a secretary to have, perhaps temporarily, zero managers?

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes12 Analyzing and validating associations Avoid unnecessary one-to-one associations Avoid this do this

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes13 Directionality in associations Associations are by default are undefined, though many tools treat these as bi-directional. It is possible to limit the direction of an association by adding an arrow at one end

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes Generalization Specializing a superclass into two or more subclasses The discriminator is a label that describes the criteria used in the specialization

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes15 Associations versus generalizations in object diagrams Associations describe the relationships that will exist between instances at run time. —When you show an instance diagram generated from a class diagram, there will be an instance of both classes joined by an association Generalizations describe relationships between classes in class diagrams. —They do not appear in instance diagrams at all. —An instance of any class should also be considered to be an instance of each of that class’s superclasses

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes More Advanced Features: Aggregation Aggregations are special associations that represent ‘part-whole’ relationships. —The ‘whole’ side is often called the assembly or the aggregate —This symbol is a shorthand notation association named isPartOf As a general rule, you can mark an association as an aggregation if the following are true: You can state that —the parts ‘are part of’ the aggregate —or the aggregate ‘is composed of’ the parts When something owns or controls the aggregate, then they also own or control the parts

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes17 Interfaces An interface describes a portion of the visible behaviour of a set of objects. An interface is similar to a class, except it lacks instance variables and implemented methods Person EmployeeATM Machine «interface» Cashier withdraw deposit Person EmployeeATM Machine Cashier

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes18 Notes and descriptive text Descriptive text and other diagrams —Embed your diagrams in a larger document —Text can explain aspects of the system using any notation you like —Highlight and expand on important features, and give rationale Notes: —A note is a small block of text embedded in a UML diagram —It acts like a comment in a programming language

© Lethbridge/Laganière 2005 Chapter 5: Modelling with classes19 Suggested sequence of activities Identify a first set of candidate classes Add associations and attributes Find generalizations List the main responsibilities of each class Decide on specific operations Iterate over the entire process until the model is satisfactory —Add or delete classes, associations, attributes, generalizations, responsibilities or operations —Identify interfaces —Apply design patterns (Chapter 6) Don’t be too disorganized. Don’t be too rigid either.

Mapping Requirements to Design Components Design must satisfy requirements – Everything (data and behavior) in the requirements must be mapped to the design components – Decide what functionality goes into which component As you do the mapping, assess functional cohesion and coupling – Strive for low coupling and high cohesion

Mapping UML to Java 21 Larman, C. Applying UML and Patterns, 3rd Edition (Pearson Education, 2005)