Chapter 10 Object-Oriented Design Principles

Similar documents
The Unified Modeling Language. Asst.Prof.Dr. Supakit Nootyaskool IT-KMITL

Topic : Object Oriented Design Principles

Information Technology Audit & Cyber Security

Objectives. Explain the purpose and objectives of objectoriented. Develop design class diagrams

OBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization

OBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization

ITM 305 NOTES. Week 2: Chapter 1: introduction to systems development SDLC. Information systems development process.

INTERNAL ASSESSMENT TEST III Answer Schema

Object-Oriented Design and Modeling Using the UML

Object-Oriented Design

Object-Oriented Systems Analysis and Design Using UML

Object-Oriented Design

SE 1: Software Requirements Specification and Analysis

Chapter 2: The Object-Oriented Design Process

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

Assigning Responsibilities (Patterns of Responsibility Assignment Principles: GRASP)

Unified Modeling Language (UML)

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

Chapter 5: Structural Modeling

UML class diagrams. Nigel Goddard. School of Informatics University of Edinburgh

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak

Use-Case Analysis. Architecture Oriented Analysis. R. Kuehl/J. Scott Hawker p. 1 R I T. Software Engineering

Object-Oriented Modeling Using UML. CS151 Chris Pollett Aug. 29, 2005.

SHRI ANGALAMMAN COLLEGE OF ENGINEERING & TECHNOLOGY (An ISO 9001:2008 Certified Institution) SIRUGANOOR,TRICHY

CSCU9T4: Managing Information

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING CS2353-OBJECT ORIENTED ANALYSIS AND DESIGN. Unit-I. Introduction to OOAD

CS 251 Intermediate Programming Methods and Classes

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

CS 251 Intermediate Programming Methods and More

Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects,

Object- Oriented Design with UML and Java Part I: Fundamentals

UNIT-IV BASIC BEHAVIORAL MODELING-I

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

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Notation Part 1. Object Orientated Analysis and Design. Benjamin Kenwright

Unit Wise Questions. Unit-1 Concepts

Chapter 8: Class and Method Design

Chapter 4 Defining Classes I

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Object-Oriented Design

Object Orientated Analysis and Design. Benjamin Kenwright

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

Oral Questions. Unit-1 Concepts. Oral Question/Assignment/Gate Question with Answer

OO Analysis and Design with UML 2 and UP

Basic Structural Modeling. Copyright Joey Paquet,

Object Oriented Analysis and Design - Part2(Design)

Programmazione. Prof. Marco Bertini

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects

Accessibility. EEC 521: Software Engineering. Classes and Objects. Inheritance. Classes and Objects (OO Analysis)

ACS-3913 Ron McFadyen 1. UML Notation for Class diagrams Object diagrams

Goal: build an object-oriented model of the realworld system (or imaginary world) Slicing the soup: OOA vs. OOD

CSE 403 Lecture 8. UML Class Diagrams. Thanks to Marty Stepp, Michael Ernst, and other past instructors of CSE 403

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

VEL TECH HIGH TECH Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE UNIT 1 UML DIAGRAMS

CSC207H: Software Design Lecture 6

Unified Modeling Language (UML) Class Diagram

Introduction to Unified Modelling Language (UML)

Defining Classes and Methods

Progress Report. Object-Oriented Software Development: Requirements elicitation (ch. 4) and analysis (ch. 5) Object-oriented software development

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

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

Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.

ROEVER ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY CS2353-OBJECT ORIENTED ANALYSIS AND DESIGN. Unit-I. Introduction to OOAD

Object Oriented Paradigm

administrivia today UML start design patterns Tuesday, September 28, 2010

Chapter 5, Analysis: Object Modeling

Design Engineering. Dr. Marouane Kessentini Department of Computer Science

Object-oriented design. More UML

CS111: PROGRAMMING LANGUAGE II

ECE 122. Engineering Problem Solving with Java

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

06. Analysis Modeling

A Conceptual Model of the UML

Goals of the Lecture OO Programming Principles

Designing Classes. Appendix D. Slides by Steve Armstrong LeTourneau University Longview, TX 2007, Prentice Hall

OBJECT ORIENTED ANALYSIS AND DESIGN SYLLABUS

CS6502-OBJECT ORIENTED ANALYSIS AND DESIGN Two Marks Question with Answers Unit-I Introduction to OOAD

user.book Page 45 Friday, April 8, :05 AM Part 2 BASIC STRUCTURAL MODELING

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Architecture and the UML

SEEM4570 System Design and Implementation. Lecture 11 From Design to Implementation

Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently.

What are the characteristics of Object Oriented programming language?

Unified Modeling Language

Class diagrams and architectural design

POAD Book: Chapter 4: Design Patterns as Components Chapter 5: Visual Design Models

17. GRASP: Designing Objects with Responsibilities

Inheritance and Interfaces

CIS Component-Based Software Design BAPTISM BY FIRE AN INTRODUCTION TO COURSE ESSENTIALS. Suggestions on the Design of Your Game of Nim Project

Question Sheet There are a number of criticisms to UML. List a number of these criticisms.

Unified Modeling Language (UML)

Logical Architecture & Design Preliminaries

CS111: PROGRAMMING LANGUAGE II

26. Interfaces. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

An Introduction to Software Architecture By David Garlan & Mary Shaw 94

Intro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a.

COSC 3351 Software Design. An Introduction to UML (I)

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

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

Topic 3 Unified Modeling Language UML. Objective: Student will use UML to represent relationshiops between objects, its structure and dynamics.

Transcription:

Chapter 10 Object-Oriented Design Principles Dr. Supakit Nootyaskool Faculty of Information Technology King Mongkut s Institute of Technology Ladkrabang

Outline Object-oriented design: bridging from analysis to implementation Object-oriented architectural design Fundamental principles of object-oriented detailed design Design classes and the design class diagram Detailed design with CRC cards Fundamental detailed design principles

Learning objective Explain the purpose and objective of object oriented design some of the fundamental principles of objectoriented design Develop UML component diagrams design class diagrams Use CRC cards to define class responsibilities and collaborations

10.1 Object-oriented design: Bridging from analysis to implementation OOD is a process by which a set of detailed OOD models are build and then used by the programmer to write and test the new system. An object-oriented programming (OOP) is a set of the program by using the concept of object representation. -Three objects - User interface object - Problem domain object - Data access object -A multilayer architecture by The object don t need to exist on the same system

UML requirement VS. Design models Identify All the classes or things Elementary business process Necessary step to carry out a use case Describe document the internal workflow of each use case Related activity diagram show message or data between user and system Track all status of all condition requirement for a class.

Overview in Chap6. This chapter will explains how to draw UML components It will be explained in Chap11.

10.2 Object-oriented architectural design The first step in system design is architectural design The system will be deployed Web app. Win app. Software system Single user system example spreadsheet, sample accounting.,.. Enterprise-level system Client server architectures Network based system Internet based system.

10.2 Object-oriented architectural design (2) Enterprise-level system A system that has shared resources among multiple people or groups in an organization Option are client-server or internet based Each presents different issues

10.2.1 Component diagram for architectural design Component diagram A type of design diagram that shows the overall system architecture and the logical components within it for how the system will be implemented Identifies the logical, reusable, and transportable system components that define the system architecture The essential element of a component diagram is the component element with its API. Application program interface (API) The set of public methods that are available to the outside world

10.2.1 Component diagram for architectural design UML component diagram notation

10.2.1 Component diagram for architectural design UML webpage notation

10.2.1 Component diagram for architectural design Component diagram showing two-layer internet architecture

10.3 Fundamental principles of the objectoriented detailed design Both the design class diagram and the interaction diagram are the most important for detail design

10.3 Fundamental principles of the objectoriented detailed design Domain model student Design class diagram student Sequence diagram for updating student name

Write the code for the design class to implement (Java) Design class diagram student

Write the code for the design class to implement (VB.NET) Design class diagram student

10.3.1 Object-oriented design process

10.4.1 Design class symbols (1) stereotype is a notation that uses to categorize a model element as a certain type. It is placed in << >> persistent class an class whose objects exist after a system is shut down (data remembered)

10.4.1 Design class symbols (2) entity class a design identifier for a problem domain class (usually persistent) control class a class that mediates between boundary classes and entity classes, acting as a switchboard between the view layer and domain layer boundary class or view class a class that exists on a system s automation boundary, such as an input window form or Web page data access class a class that is used to retrieve data from and send data to a database

Example UML design class symbols ATM Ref: http://www.cs.sjsu.edu/~pearce/modules/patterns/enterprise/ecb/ecb.htm

10.4.2 Notation for a design class Syntax for name, attributes, and methods

10.4.2 Notation for design classes Attributes Visibility indicates (+ or -) whether an attribute can be accessed directly by another object. private (-) not visibility public (+) visibility Attribute name Lower case camelback notation Type expression class, string, integer, double, date Initial value if applicable the default value Property if applicable, such as {key} Examples: - accountno: String {key} - startingjobcode: integer = 01

10.4.2 Notation for design classes Methods Visibility indicates (+ or -) whether an method can be invoked by another object. private (-) not visibility public (+) visibility Method name Lower case camelback, verb-noun Parameters variables passed to a method Return type the type of the data returned Examples: +setname(fname, lname) : void (void is usually let off) +getname(): string (what is returned is a string) -checkvalidity(date) : int (assuming int is a returned code)

10.4.2 Notation for design classes Class level method a method that is associated with a class instead of with objects of the class, Underline it. +findstudentsabovehours(hours): Array Class level attribute an attribute that contains the same value for all object in the system. Underline it. -noofphonesales: int Abstract class class that can t be instantiated. Only for inheritance. Name in Italics. Concrete class class that can be instantiated.

10.4.2 Notation for design classes Navigation Visibility The ability of one object to view and interact with another object Accomplished by adding an object reference variable to a class. Shown as an arrow head on the association line customer can find and interact with sale because it has mysale reference variable

Navigation visibility guidelines One-to-many associations that indicate a superior/subordinate relationship are usually navigated from the superior to the subordinate Mandatory associations, in which objects in one class can t exist without objects of another class, are usually navigated from the more independent class to the dependent When an object needs information from another object, a navigation arrow might be required, pointing either to the object itself or to its parent in a hierarchy. Navigation arrows may be bidirectional.

First cut design class diagram Proceed use case by use case, adding to the diagram Pick the domain classes that are involved in the use case (see preconditions and post conditions for ideas) Add a controller class to be in charge of the use case Determine the initial navigation visibility requirements using the guidelines and add to diagram Elaborate the attributes of each class with visibility and type Note that often the associations and multiplicity are removed from the design class diagram as in text to emphasize navigation, but they are often left on

Start with domain class diagram RMO sales subsystem

Create first cut design class diagram Use case create phone sale with controller added

10.5 Design with CRC cards CRC Cards Classes, Responsibilities, Collaboration Cards help to identify responsibilities of the class and the set of classes. Usually a manual process done in a brainstorming session 3 X 5 note cards One card per class Front has responsibilities and collaborations Back has attributes needed

Example of CRC card

CRC cards procedure Because the process is to design, or realize, a single use case, start with a set of unused CRC cards. Add a controller class (Controller design pattern). Identify a problem domain class that has primary responsibility for this use case that will receive the first message from the use case controller. For example, a Customer object for new sale. Use the first cut design class diagram to identify other classes that must collaborate with the primary object class to complete the use case. Have use case descriptions and SSDs handy

CRC card procedure (2) Start with the class that gets the first message from the controller. Name the responsibility and write it on card. Now ask what this first class needs to carry out the responsibility. Assign other classes responsibilities to satisfy each need. Write responsibilities on those cards. Sometimes different designers play the role of each class, acting out the use case by verbally sending messages to each other demonstrating responsibilities Add collaborators to cards showing which collaborate with which. Add attributes to back when data is used Eventually, user interface classes or even data access classes can be added

CRC cards results several use cases

CRC cards results Adding in user interface layer

CRC cards Update design class diagram based on CRC results Responsibilities become methods Arguments and return types not yet added

10.6 Fundamental design principle Coupling A quantitative measure of how closely related classes are linked (tightly or loosely coupled) Cohesion A quantitative measure of the focus or unity of purpose within a single class (high or low cohesiveness) Protection from variations A design principle that states parts of a system unlikely to change are separated (protected) from those that will surely change Indirection A design principle that states an intermediate class is placed between two classes to decouple them but still link them Object responsibility A design principle that states objects are responsible for carrying out system processing (Knowing and Doing)

Summary Architectural design Detail design of software proceeds Detailed design models. Design class diagrams Key issues are attribute elaboration and adding methods. Method signatures include visibility, method name, arguments, and return types. abstract vs. concrete classes, navigation visibility, and class level attributes and methods, CRC Cards technique