Object Oriented Design (OOD): The Concept

Similar documents
Component diagrams. Components Components are model elements that represent independent, interchangeable parts of a system.

Recap on SDLC Phases & Artefacts

more uml: sequence & use case diagrams

Design Principles & Prac4ces

UNIT II A. ENTITY RELATIONSHIP MODEL

Architectural Requirements Phase. See Sommerville Chapters 11, 12, 13, 14, 18.2

Database Design CENG 351

Object Oriented Programming. Feb 2015

RDD and Strategy Pa.ern

Genericity. Philippe Collet. Master 1 IFI Interna3onal h9p://dep3nfo.unice.fr/twiki/bin/view/minfo/sofeng1314. P.

CHAPTER 5 GENERAL OOP CONCEPTS

Design pa*erns. Based on slides by Glenn D. Blank

OBJECT ORIENTED SYSTEM DEVELOPMENT Software Development Dynamic System Development Information system solution Steps in System Development Analysis

Intelligent Systems Knowledge Representa6on

Object-Oriented Design (OOD) Case Study : Architecture and Detail Design and Software Design Document (SDD) Prepared by Shahliza Abd Halim

Architectural Design

Chapter 6: Structural Design

University of Calgary Department of Electrical and Computer Engineering. SENG : Object Oriented Analysis and Design Behrouz Homayoun Far

Architectural Design

What were his cri+cisms? Classical Methodologies:

A formal design process, part 2

Classes & Objects CMSC 202

CHAPTER 9 DESIGN ENGINEERING. Overview

Preliminary ACTL-SLOW Design in the ACS and OPC-UA context. G. Tos? (19/04/2016)

Encapsula)on, cont d. Polymorphism, Inheritance part 1. COMP 401, Spring 2015 Lecture 7 1/29/2015

Object-Oriented Design

Java. Package, Interface & Excep2on

Basic Structural Modeling. Copyright Joey Paquet,

Design Pa*erns. Philippe Collet. Master 1 IFI Interna3onal h8p://dep3nfo.unice.fr/twiki/bin/view/minfo/soeeng1213. P.

CISC327 - So*ware Quality Assurance

Ontology engineering. Valen.na Tamma. Based on slides by A. Gomez Perez, N. Noy, D. McGuinness, E. Kendal, A. Rector and O. Corcho

Credit where Credit is Due. Goals for this Lecture. Introduction to Design

Object Model. Object Orientated Analysis and Design. Benjamin Kenwright

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

L6: System design: behavior models

RESTful Design for Internet of Things Systems

Presenter: Dong hyun Park

System Modeling Environment

Mastering Enterprise Metadata with Seman2c Modeling

Principles of Programming Languages

LECTURE 3: SOFTWARE DESIGN. Software Engineering Mike Wooldridge

Automated System Analysis using Executable SysML Modeling Pa8erns

Chapter 1. Introduction to Computers and Java Objects. Background information. » important regardless of programming language. Introduction to Java

Programmazione. Prof. Marco Bertini

Topics in Object-Oriented Design Patterns

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : ,

Object Oriented Software Development CIS Today: Object Oriented Analysis

INFO/CS 4302 Web Informa6on Systems

Object-oriented development. Object-oriented Design. Objectives. Characteristics of OOD. Interacting objects. Topics covered

UNIT I. 3. Write a short notes on process view of 4+1 architecture. 4. Why is object-oriented approach superior to procedural approach?

Relationships. Association Aggregation/Composition Multiplicity Dependencies

System Analysis and Design/ Object-Oriented System Modeling

Abstraction. Design fundamentals in OO Systems. Fundamental Software Development Principles

CASE TOOLS LAB VIVA QUESTION

Design Pa*erns. + Anima/on Undo/Redo Graphics and Hints

Objectives. Architectural Design. Software architecture. Topics covered. Architectural design. Advantages of explicit architecture

Introduction to UML. Paolo Ciancarini Department of Informatics University of Bologna

10조 이호진 이지 호

Object-Oriented Systems. Development: Using the Unified Modeling Language

Architectural Blueprint

BBM 102 Introduc0on to Programming II Spring 2014

COSC 121: Computer Programming II. Dr. Bowen Hui University of Bri?sh Columbia Okanagan

iuml-b Class Diagrams 1

Design Pattern and Software Architecture: IV. Design Pattern

Chapter 1: Principles of Programming and Software Engineering

Chapter 17 - Component-based software engineering. Chapter 17 So-ware reuse

Component Design. Systems Engineering BSc Course. Budapest University of Technology and Economics Department of Measurement and Information Systems

RTP Taxonomy & Rela.onships

CORPORATE PRESENTATION

UML Views of a System

Object Relationships

10/7/15. MediaItem tostring Method. Objec,ves. Using booleans in if statements. Review. Javadoc Guidelines

Encapsula)on CMSC 202

Object-Oriented Systems Analysis and Design Using UML

UML Class Diagrams Revisited

Architectural Design

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1

GUI-Hanger syndrome SOFTWARE ARCHITECTURES. Architectural Design Choices. Why software architectures? Monolithic Architecture / 2

1. Write two major differences between Object-oriented programming and procedural programming?

Classes and Objects. Object Orientated Analysis and Design. Benjamin Kenwright

CSE Lecture 10: Modules and separate compila5on 18 Feb Nate Nystrom University of Texas at Arlington

DDD at 10. Eric Evans #dddesign

Charlie Garrod Bogdan Vasilescu

Appendix A - Glossary(of OO software term s)

Lecture 4: Build Systems, Tar, Character Strings

Chapter 5 Object-Oriented Programming

Architecture of So-ware Systems Distributed Components, CORBA. Mar>n Rehák

Model Transforma.on. Krzysztof Czarnecki Genera.ve So:ware Development Lab University of Waterloo, Canada gsd.uwaterloo.ca

Dynamic Languages. CSE 501 Spring 15. With materials adopted from John Mitchell

UML 2.0 UML 2.0. Scott Uk-Jin Lee. Division of Computer Science, College of Computing Hanyang University ERICA Campus

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

Generic programming POLYMORPHISM 10/25/13

Why Rails and Design for an Applica5on

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram

Topic: Software Verification, Validation and Testing Software Engineering. Faculty of Computing Universiti Teknologi Malaysia

Software Engineering Chap.7 - Design and Implementation

(Func&onal (Programming (in (Scheme)))) Jianguo Lu

CISC327 - So*ware Quality Assurance

Object-Oriented Software Engineering. Chapter 2: Review of Object Orientation

Con$nuous Audi$ng and Risk Management in Cloud Compu$ng

Transcription:

Object Oriented Design (OOD): The Concept Objec,ves To explain how a so8ware design may be represented as a set of interac;ng objects that manage their own state and opera;ons 1

Topics covered Object Oriented Development (OOD) Characteris,cs of OOD Basic Principles of OOD Object Oriented Concepts Advantages of OOD Implementa,on Issues 3 RECAP ON SDLC PHASES VS. ARTEFACTS PRODUCED 2

Recap on SDLC Phases & Artefacts Business Domain Analysis Domain Model (Class Diagram) Requirement Analysis 1) Functional & Non-Functional requirement 2) Use Case diagram 1) System Sequence Diagram 2) Activity Diagram SRS Design 1) Class Diagram (refined) 2) Detail Sequence Diagram 3) State Diagram SDD Implementation 1) Application Source Code 2) User Manual Documentation Testing & Deployment 1) Test Cases 2) Prototype Maintenance & Evolution 1) Change Request Form (zoom into Design) Requirement Requirement Specifica,ons (Func,onal & Non Func,onal) Analysis Requirement Models (Use cases diagram, class diagram, ac,vity diagram, sequence diagram) Design Architectural design model (Package diagram) Detailed design models ( Class diagram (refined), sequence diagram (refined), state diagram) 3

4 Architectural Design Classifica,on Architectural Design System Organisa.on (Style/ Pa4ern) Repository Model Client Server Model Layered (Tiers) Model Pipe & Filter Model View Controller Control Style Model Centralised Call Return Manager Event Driven Broadcast Interrupt Driven Modular Composi.on Object Oriented Func,on Oriented Architectural Design Classifica,on Architectural Design System Organisa.on (Style/ Pa4ern) Repository Model Client Server Model Layered (Tiers) Model Pipe & Filter Model View Controller Control Style Model Centralised Call Return Manager Event Driven Broadcast Interrupt Driven Modular Composi.on Object Oriented Func,on Oriented

OBJECT ORIENTED DEVELOPMENT Object oriented Approach There have been basically 3 approaches in informa,on system development area: process oriented, data oriented and object oriented approaches The focus of first two was either on process or data, while the object oriented approach combines data and processes into single en,,es called objects. Objects usually correspond to the real things such as customers, suppliers, contracts, offices, vehicles The goal of object oriented approach is to make system elements more reusable 10 5

Object oriented development Key idea in object oriented development: The real world can be accurately described as a collec,on of objects that interact. Process to transform the analysis model (from OOA) into OO Design Model. From WHAT (specifica,on) into HOW (implementa,on). Assump,ons: Describing large, complex systems as interac,ng objects make them easier to understand. The behaviors of real world objects tend to be stable over,me. Changes tend to be localized to a few objects. 11 OOA (What?) OOD (How?) Analysis (OOA using UML) SPECIFICATIONS Design (OOD using UML) IMPLEMENTATION 6

Characteris,cs of OOD OOD process involves designing object classes and rela,onship between these classes. Objects are abstrac,ons of real world or system en,,es and manage themselves. Objects are independent and encapsulate state and representa,on informa,on. Changing implementa,on (code) of one object should NOT affect other system objects. System func,onality is expressed in terms of object services. Shared data areas are eliminated. Objects communicate by message passing. OO PRINCIPLES 7

Abstrac;on Polymorphism OOD Basic Principles Encapsula;on Modularity Principle#1. Abstrac,on Abstrac,on focuses on the essen,al characteris,cs of some object, rela,ve to the perspec,ve of the viewer. 8

Basic Principles of OOD: Abstrac,on Abstrac,on allows us to manage complexity by concentra,ng on the essen,al characteris,cs that makes an en,ty different from others. OO uses abstrac,on to depict classes and objects in a system. Principle#2. Encapsula,on Encapsula,on hides the details of the implementa,on of an object. 9

Basic Principles of OOD: Encapsula,on Encapsula,on separates the implementa,on of objects behavior from its public interface It is called informa,on hiding, it allows object s behavior to be used without knowing its implementa,on Offers two kinds of security: Protects object s internal state from being changed from outside users. Changes can be done to the behavior implementa,on without affec,ng other objects An analogy: When you drive a car, you don t have to know the details of how many cylinders the engine has or how the gasoline and air are mixed and ignited. Instead you only have to know how to use the controls. Principle#3. Modularity 10

Basic Principles of OOD: Modularity Modularity can be defined as the process of breaking up of a complex system into small, self contained pieces that can be managed easily. Packages and subsystems support the defini,on of the modularity. Classes are independent modules Principle#4. Polymorphism 11

Basic Principles of OOD: Polymorphism Polymorphism the same word or phrase can mean different things in different contexts Analogy: in English, bank can mean side of a river or a place to put money (one word, bank, but different meaning in different context) In OOD, Polymorphism is the ability to hide many implementa,ons behind the same interface. Example: OO CONCEPTS 12

Object Oriented Concepts Object Class Anribute Opera,on Interface Package Subsystem Rela,onships Object An object is a separately iden,fiable en,ty that has a set of opera,ons and a state that records the effects of the opera,ons. Objects are characterized by: state, opera,ons, iden,ty. 13

Object (cont.) aqributes: the collec,on of informa,on held (i.e., stored) by the object. It can change over,me. It changes as the result of an opera,on performed on the object. The anribute is encapsulated within the object opera;ons: a procedure that takes the anributes of the object and zero or more arguments and changes the state and/or returns one or more values. iden;ty: a way to dis,nguish between two dis,nct objects (even if they have the same state and opera,ons). Class A class is a template for crea,ng objects. A class describes a collec,on of related objects (i.e., instances of the classes). Objects of the same class have common opera,ons and a common set of possible states. The concept of class is closely related to the concept of abstract data type that we discussed previously. A class is a descrip,on of a set of objects that share the same anributes, opera,ons, rela,onships (Booch, 1999). An object is an instance of a class 14

Class (cont.) Class (cont.) In UML, a class has 3 compartments Name Anributes Opera,ons Class nota,on in UML: 15

Class (Anributes) Anributes is a data type held by the objects in the class. Only the object itself should be able to change the value of its anributes. Different objects of the same class Class (Opera,ons) 16

Classes & Objects Classes & Objects A class is an abstract defini,on of an object. It defines the structure and the behavior of each object. A class is template for producing objects of a certain type. Objects are grouped into classes An object is a run,me instances of the corresponding class 17

Classes & Objects Terminology Recap object usually a person, place or thing (a noun) method an ac,on performed by an object (a verb) class a category of similar objects (such as automobiles) *Class does not hold any values of the object s anributes 18

Stereotype A stereotype is a new class of modeling element that is introduced at modeling,me. The stereotype is a tag, or symbol, used to mark the type of an object or other construct so that it can be dis,nguished and treated differently from other types of constructs Interfaces A special class that contains a collec,on of opera,ons that are used to specify a service of a class. Interfaces specify, but not implement behaviour. 19

Interfaces Interfaces (cont.) 20

Abstrac,on with Interface Component A component is a physical and replaceable part of a system that conforms to and provides the realiza,on of a set of interfaces (Booch, 1999) Component may be: Source code component (shell scripts, data files, *.cpp) Link,me component (*.dll files): <<library>> Run,me component (Java Beans, Ac,veC controls, COM objects, CORBA objects, *.exe files): <<applica,on>>, <<table>> A component enforces Encapsula,on 21

Component (cont.) Packages A package is a general purpose mechanism for organizing elements into groups (Booch,1999) It is a model element which can contain other model elements As a grouping mechanism, does not have any seman,cs defined It may not have a representa,on in implementa,on (osen it may represent a directory) A package owns its elements; an element can belong to only one package A package enforces Modularity 22

Packages (cont.) Subsystems A system that is part of a larger system, and which has a definite interface. A model element that has the seman,cs of a package and a class that provides behavior. It implements one or more interfaces which define the behavior of the subsystem A subsystem enforces Encapsula,on & Modularity 23

Rela,onship between Classes / Components A rela,onship is a connec,on among things UML uses these kinds of rela,onships: Associa,on Aggrega,on Composi,on Dependency Generaliza,on Realiza,on Associa,on Rela,onship Associa,on represents a general binary rela,onship that describes an ac,vity between two classes. The rela,onship allows one class to call methods in other class. When there is associa,on between classes, instances/objects of the class has associa,on. 24

Associa,on Rela,onship (cont.) Association between classes Instance association Associa,on Rela,onship Mul,plicity Specifies how many objects/instances of one class may relate to a single instance of an associated class. i.e. 25

Associa,on Rela,onship Role A role name is a name that uniquely iden,fies one end of an associa,on. Wrinen next to the class that plays the role. i.e. Student 1SCS take core Subject Aggrega,on Rela,onship A special form of associa,on. Represents an ownership rela,onships between two classes. Models the rela,onship like has a, part of, owns. Parts may belong to mul,ple wholes. 26

Aggrega,on Rela,onship (cont.) Composi,on Rela,onship Models a whole/part relationship with a strong ownership; when the whole dies, the part does so as well An object can be only part of one whole object The whole part is responsible for creation and destruction of its parts 27

Inheritance Rela,onship is a or a kind of rela,onship Classes with proper,es in common can be grouped so that their common proper,es are only defined once. Superclass : inherit its anributes & methods to the subclass(es). Subclass : inherit all its superclass anributes & methods + have its own unique anributes & methods. Inheritance Rela,onship (cont.) Sub- Class 28

Inheritance Rela,onship (cont.) How do we structure these classes? Inheritance Rela,onship (cont.) A subclass inherits from its superclass: attributes operations relationships. A subclass may add to its definition: Attributes Operations Relationships Redefine inherited operations 29

Modeling Example Model the following scenario: Paula is married to Paul They have children Realiza,on Rela,onship A realization is a semantic relationship between classifiers in which one classifier specifies a contract that another guaranties to carry out. It is used in the context of interfaces and collaborations An interface can be realized by many classes or components A class may realize many interfaces 30

Dependency Rela,onship A dependency is a rela,onship that specifies that a change in one thing may affect other things that use it but not necessarily the inverse. 61 Dependency Rela,onship (cont.) 31

Advantages of OOD Easier maintenance. Objects may be understood as stand alone en,,es. Objects are poten,ally reusable components. For some systems, there may be an obvious mapping from real world en,,es to system objects. Implementa,on Issues Reuse When you are developing sosware, you should make as much use as possible of exis,ng code. Sosware reuse is possible at different levels The abstrac;on level: Design panern or architectural panern The object level: directly reuse objects from library rather wri,ng code yourself. E.g., you need to process email message in Java, you may use objects and methods from JavaMail library. The component level: collec,on of object and object classes You write some code: User interface connected to database The system level: you resue en,re applica,on systems. It ususally involves some configura,on of these systems Configura,on Management: Version management, system integra,on (compiling), problem tracking (bug report) Host target development: development computer (host), execute program on computer (target). Host & target computers may be different. 32