Object-Oriented Design

Slides:



Advertisements
Similar presentations
ANALYSIS MODEL. Analysis Model Actual system development start with this. Aims to structure the system independently of the actual implementation environment.
Advertisements

Diagram Notations
1 Software Design Introduction  The chapter will address the following questions:  How do you factor a program into manageable program modules that can.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
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.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
Object Oriented System Development with VB .NET
Software Engineering 1 Provisional Revision Plan.
Diagram Notations
Module: Definition ● A logical collection of related program entities ● Not necessarily a physical concept, e.g., file, function, class, package ● Often.
Jump to first page 1 System Design (Finalizing Design Specifications) Chapter 3d.
Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.
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.
Object-Oriented Design
Chapter 13: Object-Oriented Programming
Data Abstraction: The Walls
Use Case Analysis – continued
Relationships. In the Interaction diagrams, we began to look at how classes communicate with one another. Now, we'll focus on the relationships between.
Objectives Design Class Diagrams Issues in system design Generalization Review UML papers.
Object Oriented Software Development
Chapter 7 Software Engineering Objectives Understand the software life cycle. Describe the development process models.. Understand the concept of modularity.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Computer Science II 810:062 Section 01 Session 2 - Objects and Responsibilities.
An Object-Oriented Approach to Programming Logic and Design
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
CSC 213 – Large Scale Programming Lecture 3: Object-Oriented Analysis.
Diagram Notations
Software Design Designing the overall structure (architecture) of a software system Designing small pieces of computation Designing non-automated processes.
INFO 425 Week 21 INFO 425 Design Problem I Week 2 – SRS Improvements Glenn Booker.
Design Patterns. Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution.
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
Cohesion and Coupling CS 4311
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 12-5 Software Engineering Design Goals.
Coupling Cohesion Chandan R. Rupakheti Steve Chenoweth (Chapter 18)
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
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Object Oriented Analysis and Design Class and Object Diagrams.
Object-Oriented Analysis and Design CHAPTERS 9, 31: DOMAIN MODELS 1.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
© 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.
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
Chapter 4 Basic Object-Oriented Concepts. Chapter 4 Objectives Class vs. Object Attributes of a class Object relationships Class Methods (Operations)
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.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
CSCI 3428: Software Engineering Tami Meredith Chapter 6 Designing the Modules.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
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.
School of Business Administration
Coupling and Cohesion Rajni Bhalla.
Coupling and Cohesion 1.
Types of Programming Languages
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.
Programming Logic and Design Fourth Edition, Comprehensive
Software Design Lecture : 9.
Software Design Lecture : 8
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 usually corresponds to one kind of entity – Each class member usually 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? 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 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 UML class diagrams One box per kind of entity – Usually list attributes – Interfaces & abstract attributes italicized Lines without arrowheads show references – Represents member variables in OO – Labeled with cardinality (multiplicity) Lines with open arrowheads for specialization Lines with regular arrowheads indicate dependencies I’m omitting several pieces of the diagrams today, to make the diagrams less cluttered so that you can focus on today’s lessons.

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 – 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.

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 – 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 have vaguely related purpose – Temporal cohesion A executes, then B executes, but A & B do not have any related purpose – 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.

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

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.

The secret to using interfaces 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!

Incremental and iterative 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 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

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