CSCI-383 Object-Oriented Programming & Design Lecture 9.

Slides:



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

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
UML an overview.
Chapter 4 - Object-Oriented Analysis and Design in a Nutshell1 Chapter 4 Object-Oriented Analysis and Design in a Nutshell.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
A Brief Introduction. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
Systems Analysis and Design 8th Edition
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth 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:
CS3773 Software Engineering Lecture 03 UML Use Cases.
Chapter 1 Object-Oriented System Development
Introduction To System Analysis and Design
Object Oriented System Development with VB .NET
Lecture 11: Chapter 22 Topics –Object Oriented Modeling –UML –Use case.
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.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
Itntroduction to UML, page 1 Introduction to UML.
UML and Object Oriented Concepts
Introduction to Object-oriented programming and software development Lecture 1.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Unified Modeling Language, Version 2.0
Introduction To System Analysis and Design
CSCI-383 Object-Oriented Programming & Design Lecture 13.
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.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
UML What Is the UML? The Unified Modeling Language (UML) is the successor to the wave of object- oriented analysis and design (OOA&D) methods.
CHAPTER 13 (ONLINE): OBJECT-ORIENTED DATA MODELING © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
Systems Analysis & Design 7 th Edition Chapter 5.
To navigate the slide presentation, use the navigation bar on the left OR use your right and left arrow keys. Move your mouse over the key terms throughout.
Systems Analysis and Design 8 th Edition Chapter 6 Object Modeling.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
 What is Modeling What is Modeling  Why do we Model Why do we Model  Models in OMT Models in OMT  Principles of Modeling Principles of Modeling 
Object-Oriented Paradigm and UML1 Introduction to the Object- Oriented Paradigm.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
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.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 1: Introduction.
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.
UML Part 1: Class Diagrams. Introduction UML stands for Unified Modeling Language. It represents a unification of the concepts and notations presented.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Session 1 What Is the UML? Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 5, 2011 Presented by Kang-Pyo Lee.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
MANAGING COMPLEXITY Lecture OO01 Introduction to Object-oriented Analysis and Design Abstract Data Types.
Basic Characteristics of Object-Oriented Systems
Distributed Java Programming Distributed Java Programming Class #1 August 20, 2002.
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.
SWE 214 (071) Introduction to UML Slide 1 Introduction to UML.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Evolution of UML.
Object-Oriented Analysis and Design
Object-Oriented Modeling with UML
Systems Analysis and Design With UML 2
Introduction to Unified Modeling Language (UML)
Introduction to UML.
Software Design Methodologies and Testing
Chapter 5.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Presentation transcript:

CSCI-383 Object-Oriented Programming & Design Lecture 9

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Characteristics of Components  Let us return to the idea of a software component  There are many different aspects to this simple idea, we will consider just a few: Behavior and State Instances and Classes Coupling and Cohesion Interface and Implementation

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Behavior and State  All components can be characterized by two aspects: The behavior of a component is the set of actions a component can perform. The complete set of behavior for a component is sometimes called the protocol The state of a component represents all the information (data values) held within a component  Notice that it is common for behavior to change state. For example, the edit behavior of a recipe may change the preparation instructions, which is part of the state

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Instances and Classes  We can now clarify a point we earlier ignored. There are likely many instances of recipe, but they will all behave in the same way. We say the behavior is common to the class Recipe  Since earlier our goal was to identify behavior, we ignored this distinction and concentrated on prototypical objects

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Coupling and Cohesion  The separation of tasks into the domains of different components should be guided by the concepts of coupling and cohesion  Cohesion is the degree to which the tasks assigned to a component seem to form a meaningful unit. Want to maximize or minimize cohesion?  Coupling is the degree to which the ability to fulfill a certain responsibility depends upon the actions of another component. Want to maximize or minimize coupling?

Coupling and Cohesion Students in a class were asked to write a large program (~ 1000 lines). One student’s entire program consisted of a single main() function int main() { }

Coupling and Cohesion The student was told by the instructor that he needed to improve the program’s modularity Student broke up code in main() arbitrarily, first 25 lines to function/module 1, next 25 lines to function/module 2, … int main() { }

Coupling and Cohesion Cohesion is a measure of how well the parts of a component “belong together” It is a property or characteristic of an individual module Cohesion is strong if all parts are needed for the functioning of other parts A method is cohesive when it does only a single, precise task. If you have trouble naming a method, would that suggest weak or strong cohesion? Strong cohesion promotes maintainability and adaptability by limiting the scope of changes to a small number of components

Coupling and Cohesion Coupling is a measure of the strength of the interconnections between system components It is a property of a collection of modules Coupling is tight between components if they depend heavily on one another (e.g., there is a lot communication among them) Coupling is loose if there are few dependencies between components Loose coupling promotes maintainability and adaptability since changes in one components are less likely to affect other ones

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Interface and Implementation  We have characterized software components by what they can do  The user of a software component need only know what it does, not how it does it  “Ask not what you can do to a data structure, ask instead what your data structures can do for you”

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Two views of a Software System  This naturally leads to two views of a software system  The term information hiding is used to describe the purposeful hiding of implementation details

The Unified Modeling Language Several different notations for describing object- oriented designs were proposed in the 1980s and 1990s The Unified Modeling Language (UML) is an integration of those notations It describes notations for a number of different models that may be produced during OO analysis and design It is now a de facto standard for OO modelling

History of OOAD leading to UML 1970 –First object-oriented languages (Simula-67, Smalltalk) 1980 –More than 50 different OOAD languages cause users trouble to find complete and appropriate tools 1992 –New iterations of methods appear –Booch’93 (Grady Booch), OOSE (Ivar Jacobson), OMT-2 (James Rumbaugh) 1995 –Unification, UML 0.9 by Booch and Rumbaugh 1997 –Standardization, UML 1.1 by Booch, Rumbaugh, and Jacobson –Object Management Group (OMG) adapts UML as OOAD standard

History of UML

UML Diagrams

Diagrams and Process

UML Class Diagrams Class diagrams describe the types of objects in the system and the various kinds of static relationships that exist among them There are 2 principal kinds of static relationships: –Associations “A customer may rent a number of videos” –Subtypes “A student is a kind of person” Class diagrams also show the attributes and operations of a class and the constraints that apply to the way objects are connected

UML Class Diagrams The main symbols shown on class diagrams are –Classes represent the types of data themselves –Attributes are simple data found in classes and their instances –Operations represent the functions performed by the classes and their instances –Associations represent linkages between instances of classes –Generalizations group classes into inheritance hierarchies

Classes A class is represented as a box with name of the class inside The diagram may also show the attributes and operations A class can be drawn at several different levels of detail

Classes

Associations and Multiplicity An association is used to show how instances of two classes are related to each other (i.e., will reference each other) –Symbols indicating multiplicity are shown at each end of the association

Labelling associations Each association can be labelled, to make explicit the nature of the association. There are 2 types of labels: –association names should be a verb or verb phrase Direction of association can be clarified by showing a little arrow –role names

Analyzing and validating associations Many-to-one –A company has many employees –An employee can only work for one company This company will not store data about the moonlighting activities of employees! –A company can have zero employees E.g. a ‘shell’ company –It is not possible to be an employee unless you work for a company * worksFor EmployeeCompany 1

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?

Analyzing and validating associations One-to-one –For each company, there is exactly one board of directors –A board is the board of only one company –A company must always have a board –A board must always be of some company 1 1

Analyzing and validating associations Avoid unnecessary one-to-one associations Avoid this Do this

A more complex example A booking is always for exactly one passenger –no booking with zero passengers –a booking could never involve more than one passenger A passenger can have any number of bookings –a passenger could have no bookings at all –a passenger could have more than one booking

Association classes Sometimes, an attribute that concerns two associated classes cannot be placed in either of the classes The following are equivalent