Object-Oriented Design

Slides:



Advertisements
Similar presentations
Design Validation CSCI 5801: Software Engineering.
Advertisements

Architecture. Outline Example Decomposition Style Activity 1.
Diagram Notations
Object-Oriented Design
1 Software Design Introduction  The chapter will address the following questions:  How do you factor a program into manageable program modules that can.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Free Mini Course: Applying UML 2.0 with MagicDraw.
What is Software Design?  Introduction  Software design consists of two components, modular design and packaging.  Modular design is the decomposition.
Copyright Irwin/McGraw-Hill Software Design Prepared by Kevin C. Dittman for Systems Analysis & Design Methods 4ed by J. L. Whitten & L. D. Bentley.
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Diagram Notations
Module: Definition ● A logical collection of related program entities ● Not necessarily a physical concept, e.g., file, function, class, package ● Often.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Jump to first page 1 System Design (Finalizing Design Specifications) Chapter 3d.
Criteria for good design. aim to appreciate the proper and improper uses of inheritance and appreciate the concepts of coupling and cohesion.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
Requirements Analysis 2 What objects collaborate to achieve the goal of a use case?
PVK-Ht051 Contents Introduction Requirements Engineering Project Management Software Design Detailed Design and Coding Quality Assurance Maintenance.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Package design and the Iterative process model. What is a package? Classes are not sufficient to group code –Some classes collaborate, implying dependencies.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1/19 Component Design On-demand Learning Series Software Engineering of Web Application - Principles of Good Component Design Hunan University, Software.
Implementation Yaodong Bi. Introduction to Implementation Purposes of Implementation – Plan the system integrations required in each iteration – Distribute.
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
Software Engineering Chapter 8 Fall Analysis Extension of use cases, use cases are converted into a more formal description of the system.Extension.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Diagram Notations
Requirements To Design--Iteratively Chapter 12 Applying UML and Patterns Craig Larman.
Software Design Designing the overall structure (architecture) of a software system Designing small pieces of computation Designing non-automated processes.
In-Class Interviewing Activity (Grocery example) You can conduct a semi-structured/unstructured interview: How: Use the process outlined here. Individually.
SE: CHAPTER 7 Writing The Program
Criteria Based Software Product Integration Architecture F. Tsui Southern Polytechnic State University.
Cohesion and Coupling CS 4311
Systems analysis and design, 6th edition Dennis, wixom, and roth
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 12-5 Software Engineering Design Goals.
Coupling Cohesion Chandan R. Rupakheti Steve Chenoweth (Chapter 18)
ANALYSIS - II REQUIREMENT ANALYSIS DESIGN IMPLEMENTATION TEST.
Chapter 10 Software Engineering. Understand the software life cycle. Describe the development process models. Understand the concept of modularity in.
CIS 112 Exam Review. Exam Content 100 questions valued at 1 point each 100 questions valued at 1 point each 100 points total 100 points total 10 each.
CCSB223/SAD/CHAPTER131 Chapter 13 Designing the System Internals.
Object-Oriented Design
Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Notations. Requirements Documentation Typical parts of Requirements Document Functional requirements Behavior of the software system Nonfunctional requirements.
1 Software Design Lecture What’s Design It’s a representation of something that is to be built. i.e. design  implementation.
Object-Oriented Design. 1 Objects and concerns Objects have a concern, meaning they have a purpose Not concerned as in worried All code should have a.
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
CSCI 3428: Software Engineering Tami Meredith Chapter 6 Designing the Modules.
310414IMPLEMENTATION1 IMPLEMENTATIONIMPLEMENTATION SOFTWARE ENGINEERING SOFTWARE ENGINEERING.
Systems Development Lifecycle
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Basic Characteristics of Object-Oriented Systems
Coupling and Cohesion Schach, S, R. Object-Oriented and Classical Software Engineering. McGraw-Hill, 2002.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
1 Week 7 Software Engineering Spring Term 2016 Marymount University School of Business Administration Professor Suydam.
Further Modularization, Cohesion, and Coupling. Simple Program Design, Fourth Edition Chapter 9 2 Objectives In this chapter you will be able to: Further.
Software Testing.
School of Business Administration
Coupling and Cohesion Rajni Bhalla.
Coupling and Cohesion 1.
Cohesion and Coupling Chapter 5, Pfleeger 01/01/10.
Software Design Designing the overall structure (architecture) of a software system Designing small pieces of computation Designing non-automated processes.
Improving the Design “Can the design be better?”
Programming Logic and Design Fourth Edition, Comprehensive
Software Design Lecture : 9.
Software Design Lecture : 8
Cohesion and Coupling.
Presentation transcript:

Object-Oriented Design

Why is that joke supposed to be funny? Objects and concerns – Objects have a concern in the sense that they have a purpose. – Which is not to say that inanimate objects are concerned in the sense of being worried. Likewise, all code should have a concern, a purpose for being. – A place for every concern… – and every concern in its place.

Concerns of classes Each class should have a clearly focused purpose. – One class often corresponds to one kind of entity – Each class member often corresponds to one attribute Only code related to that purpose should be in the class. – Put functions together with the data that they modify. – Put code together if it needs to be modified at the same time.

Concerns of packages Ditto for packages – Every package should have a purpose – Code should be in that package if and only if it is related to that purpose “Module” can refer to a class or to a package – Every module should have a purpose – Code should be in module if and only if related to that purpose

An example system to support drug and alcohol counseling

What are the key concerns in this req. dataflow diagram? Survey DB Survey Counselee Counselor Create report Printer Pick up Authent icate

Some key concerns Managing the users – Authenticating counselees – Matching counselees to counselors Performing the survey – Representing the questions – Representing the answers – Performing skip logic – Storing the answers Generating the report – Reading the data – Performing calculations in the report – Sending to the printer

Assigning concerns to code in this arch. dataflow diagram Counselee Rec. Counselor Rec. Survey Instance Questions Answers Authenticator Report Maker Survey Server Question loader Skip logic module Answer storer Data loader Calculation module Printer controller

Notes about architectural dataflow diagrams One box per component – Interfaces italicized Lines without arrowheads show references Lines with open arrowheads for specialization Lines with regular arrowheads indicate data flow

Coupling and cohesion Coupling – When one module is involved in another module’s concern Cohesion – When a module is devoted to its concern

Coupling reduces maintainability Levels of coupling A and B are different modules… – Content coupling (worst) A modifies B – Common coupling A and B both read/write the same data – Control coupling A calls B – Stamp coupling A provides structured data to B – Data coupling A provides unstructured data to B – Uncoupled (best) None of the above If A and B are coupled, then modifying A may require modifying B. If two forms of coupling apply, then choose the one higher in the list.

Inter-package coupling Counselee Rec. Counselor Rec. Survey Instance Questions Answers Authenticator Report Maker Survey server Question loader Skip logic module Answer storer Data loader Calculation module Printer controller Authenticator Data Records Content coupling Common coupling Control coupling Stamp coupling Data coupling Uncoupled Report Maker Survey Server

Cohesion increases maintainability Levels of cohesion A and B are inside same module… – Functional/informational cohesion (best) A and B work together for just one purpose – Communicational cohesion A and B use the same data – Procedural cohesion A executes, then B executes, and A & B are steps in a certain process – Temporal cohesion A executes, then B executes, but A & B do not have any related purpose or shared process – Logical cohesion Either A or B might be executed – Coincidental cohesion (worst) None of the above If A is highly cohesive, then it is easy to find the code for a concern. If two forms of cohesion apply, then choose the one higher in the list.

Intra-package cohesion Functional/informational cohesion Communicational cohesion Procedural cohesion Temporal cohesion Logical cohesion Coincidental Counselee Rec. Counselor Rec. Survey Instance Questions Answers Authenticator Report Maker Survey Server Question loader Skip logic module Answer storer Data loader Calculation module Printer controller

Tips and techniques Some tips and techniques to help improve your software designs… – Don’t talk to strangers – Move code to where it’s used – Split modules to reduce cycles – Prefer composition over inheritance – Use interfaces to declare promises – Plan for future development

Tip #1: Don’t talk to strangers (“Law of Demeter”) Counselee Rec. Counselor Rec. Survey Instance Questions Answers Authenticator Report Maker Survey Server Question loader Skip logic module Answer storer Data loader Calculation module Printer controller This would be bad:

Tip #2: Move code to where it’s used Counselee Rec. Counselor Rec. Authenticator Report Maker Data loader Calculation module Printer controller Survey Instance Questions Answers Survey Server Question loader Skip logic module Answer storer Reducing inter- package coupling.

Tip #3: Split modules to reduce cycles That design had no cycles – But here’s one way to get rid of cycles when they do happen to occur… Pfleeger & Atlee

Tip #4: In reuse, prefer composition over inheritance In general, use composition to add features or to reuse code, and use inheritance to add a new version of an entity. Survey Server Question loader Skip logic module Answer storer Answer cross-check Logging module Survey Instance Questions Answers Timing data

Tip #4: In reuse, prefer composition over inheritance In general, use composition to add features or to reuse code, and use inheritance to add a new version of an entity. Survey Instance QuestionsAnswers Report Maker Data loader Calculation module Printer controller Numeric question Multiple choice ques. Free-text question Numeric answer Multiple choice ans. Free-text answer Physical printer ctrllr. Printout-by- ctrllr. Printout-by-web ctrllr.

Tip #5: Use interfaces to declare promises An interface is a promise – I can do this for you. – If you meet these preconditions, then I can meet these postconditions. Functional or non-functional Polymorphism – If A and B and C and D each implement an interface, then they all make the same promise But may keep the promise in different ways!

Tip #6: Plan for future development Use incremental development – When much of the system’s value resides in one subsection – When one part of the system must be completed (logically) before another – There should be a module boundary around each increment, eventually. Use iterative development – When the system’s value is spread out over much of the system – When the whole system needs to work at least a bit before you can build up – Modules should be decomposed to facilitate maintenance.

Incremental and iterative development Incremental examples – Adding new kinds of print outs From customers’ standpoint, paper printout carried much of the system’s value – Adding a new data export module Logically, the main system needs to be done before we can worry about exporting data. Iterative examples – Tweaking reports and surveyor user interface to improve usability Improvements to existing pieces of system – Adding new kinds of questions (and answers), changing reports accordingly Changes are spread across system

What’s next for you? You know the drill about working on the homework. – This week, no need to meet customer. Revise your vision statement. Start reviewing for midterm – Take-home midterm – Will be an individual exam – Counts for approx. 13% of your grade