Object-Oriented Software Engineering More Modelling with Classes Paul J Krause.

Slides:



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

Computer Science Dept. Fall 2003 Object models Object models describe the system in terms of object classes An object class is an abstraction over a set.
7M822 UML Class Diagrams 7 October 2010.
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.
CS 106 Introduction to Computer Science I 04 / 11 / 2008 Instructor: Michael Eckmann.
Ch 12: Object-Oriented Analysis
Together and UML Greg Johnson CSE 230 – Software Engineering Spring 2007.
CS 106 Introduction to Computer Science I 11 / 26 / 2007 Instructor: Michael Eckmann.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
1 SWE Introduction to Software Engineering Lecture 13 – System Modeling.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design Copyright 2000 © John Wiley & Sons, Inc. All rights reserved. Slide 1 The.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
CS 106 Introduction to Computer Science I 11 / 28 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 04 / 16 / 2010 Instructor: Michael Eckmann.
Requirements Analysis 15.1 Specialised Associations b515.ppt © Copyright De Montfort University 2000 All Rights Reserved INFO2005 Requirements Analysis.
1 Chapter 7 Inheritance, Polymorphism, and Scope.
CS 106 Introduction to Computer Science I 11 / 15 / 2006 Instructor: Michael Eckmann.
Chapter 2 Database System Design (part II)
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
Object-oriented Programming Concepts
CS 106 Introduction to Computer Science I 04 / 21 / 2010 Instructor: Michael Eckmann.
COMP1007 Introduction to Requirements Analysis © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Introduction to Requirements Analysis.
CO320 Introduction to Object- Oriented Programming Michael Kölling 3.0.
Object-Oriented Software Engineering Revision Paul J Krause.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
BACS 287 Basics of Object-Oriented Programming 1.
CS 106 Introduction to Computer Science I 04 / 13 / 2007 Friday the 13 th Instructor: Michael Eckmann.
Object-oriented Software Engineering with Reuse Contracts Koen De Hondt, Carine Lucas, Kim Mens, Tom Mens, Patrick Steyaert, Roel Wuyts Programming Technology.
BCS 2143 Introduction to Object Oriented and Software Development.
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
OBJECT AND CLASES: THE BASIC CONCEPTS Pertemuan 8 Matakuliah: Konsep object-oriented Tahun: 2009.
Internet Software Development Putting it all together Paul J Krause.
Component-Based Software Engineering Using Interfaces Paul Krause.
Class Diagrams Tutorial.
Executable UML The Models are the Code - Executable UML Lecture 3 - Modelling with Domains and Classes Paul Krause.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 - Domain Classes.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 Domain Classes.
Software Engineering, 8th edition Chapter 8 1 Courtesy: ©Ian Somerville 2006 April 06 th, 2009 Lecture # 13 System models.
CS212: Object Oriented Analysis and Design Lecture 13: Relationship between Classes.
Chapter 9 Applying UML and Patterns -Craig Larman
Sept Ron McFadyen1 Class Diagram Begins as a conceptual or analysis class model and evolves to a design class model Used throughout the development.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Object-Oriented Analysis and Design CHAPTERS 9, 31: DOMAIN MODELS 1.
January Ron McFadyen1 Domain Models Domain Model: a visual representation of conceptual classes or real-world objects in a domain of interest.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 – 9.4.
Sept 2004Ron McFadyen Generalization (Ch 26) a generalization is a relationship between a general thing (the superclass or parent class) and a.
Interfaces F What is an Interface? F Creating an Interface F Implementing an Interface F What is Marker Interface?
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
2007ACS-3913 Ron McFadyen1 Generalization a generalization is a relationship between a general thing (the superclass or parent class) and a more specific.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
1 SWE Introduction to Software Engineering Lecture 14 – System Modeling.
Object-Oriented Software Engineering CS288. UniS 2 Lecture 1 - Object-Orientation & UML Contents  Overview  Classifiers  Dynamic Behaviour  Static.
Object-Oriented Software Engineering CS288 Paul Krause.
DOMAIN MODEL—PART 2: ATTRIBUTES BTS430 Systems Analysis and Design using UML.
3/1/01H-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Evaluating Class Diagrams Topics include: Cohesion, Coupling Law of Demeter (handout)
Chapter 5 – System Modeling Lecture 1 1Chapter 5 System modeling.
Class Diagram Associations Class Diagrams, Class Stereotypes, Class Associations Dr. Neal CIS 480.
UML Class & Object Diagram I
Chapter 0: Introduction
Reuse Separate classes could be developed for all the different objects that are needed in each program. However that would be wasteful. Often many functionalities.
Lec-4 : Unified Modeling Language (UML)
Objects First with Java A Practical Introduction using BlueJ
a generalization is a relationship between a general thing (the
Software Architecture & Design
Presentation transcript:

Object-Oriented Software Engineering More Modelling with Classes Paul J Krause

More Modelling with Classes Contents  Overview of Associations  Generalisation/Specialisation hierarchies  Aggregation  Why I don’t like aggregation  Interfaces Some examples taken from: Mellor and Balcer, Executable UML, Addison Wesley

Class Tuner class name channel frequency attributes get_Frequency set_Frequency operations

Inheritance Hierarchy Tuner A/V TunerFM Tuner

Aggregation Surf List surfListSize addSurfChannel deleteSurfChannel setSurfChannel Source ID presetNumber presetName setPresetNumber setPresetName 0..*

Association Tuner Surf List 1 1

Putting it all together A/V Source Front EndExternal Source Surf List Source ID 0..* 1 1 Tuner 1..* is tuned to

Publisher name address webSite BookProduct bookNumber title unitPrice Customer name shippingAdd Author name address webSite R1R3 R2 is produced and marketed by produces and markets is a purchase of is sold as wrote was written by 10..*1..* 0..* 1..* Order quantity salePrice date makes1..* is made by 1

“Nonuniform Classes”  Consider an on-line “book store”. It may actually sell a variety of products. Product productID: ProductCode title: string copyright: Year unitPrice: Money description: string bookNumber: ISBN subtitle: string recordingLength: Time productVersion: string applicable to all Products only for Books only for Recordings (CDs, videos …) only for Software

Separate Product Classes? BookProduct productID: title: copyright: unitPrice: description: bookNumber: subtitle: RecordingProduct productID: title: copyright: unitPrice: description: recordingLength: SoftwareProduct productID: title: copyright: unitPrice: description: productVersion:

Partitioning Products All Products Recording Products Book Products No Products remain outside a set No products are in more than one set

Generalisation - Specialisation BookProduct bookNumber: subtitle: RecordingProduct recordingLength: SoftwareProduct productVersion: Product productID: title: copyright: unitPrice: description: R11 {disjoint, complete}

Definitions  A superclass is a class that is a generalisation of a set of concepts  A subclass is a specialisation of a high-level concept  A leaf-subclass is a subclass that is not also a superclass of another class  Generally, superclasses will be abstract classes it is not normally possible to create instances of them it is not normally possible to create instances of them

Repeated Specialisation Account {abstract} CheckingAccount {abstract} SavingsAccount RegularCheckingAccountInterestCheckingAccount R1 {disjoint, complete} R2 {disjoint, complete}

Adding an Association Publisher groupCode: publisherCode: name: address: website: is produced and marketed by produces and markets 1 0..* R1 BookProduct bookNumber: subtitle: RecordingProduct recordingLength: SoftwareProduct productVersion: Product productID: title: copyright: unitPrice: description: R11 {disjoint, complete}

Aggregation - “part of” Vehicle TransmissionEngineWheels “A Vehicle is an aggregation (made up) of an Engine, a Transmission and some Wheels (and some more stuff… )”

Complex structures? Picture Sound Features Installation Features Timer Parental Control Child Lock Sleep Parental Control Block All Clear TV Rating Film Rating TV Rating TV Y TV Y7 PG TV 14 …

Menu MenuItem 1..* LeafItemSubMenu 1 is selected from selects 1

Avoiding Aggregation Vehicle Engine powers is powered by 1 1..* Transmission Wheel transmits power through is driven by 1 10,1 1..* generates motion via is rotated by is supported by 1..* 1 supports

Aggregation - Who needs it? Menu MenuItem 1..* LeafItemSubMenu 1 is selected from selects 1 1 consists of is contained in

Interfaces  Sometimes we may find two or more different subclasses share some common behaviour  In this case, they are not strictly “kinds of” some common parent  Rather, they “behave like” some common pattern (under certain circumstances)  We say that they both implement a common interface

A “Cashier” Interface PersonMachine ATMEmployee «interface» Cashier withdraw deposit