ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Key Principles of Software Architecture and Design (II) adapted from Dave Penny’s.

Slides:



Advertisements
Similar presentations
Lecture 6: Software Design (Part I)
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Quality of a Class Abstraction: Coupling & Cohesion Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Structured Design. 2 Design Quality – Simplicity “There are two ways of constructing a software design: One is to make it so simple that there are obviously.
Communication between modules, cohesion and coupling
1 Software Design Introduction  The chapter will address the following questions:  How do you factor a program into manageable program modules that can.
Chapter 13 Design Concepts and Principles
Slide 7A.1 © The McGraw-Hill Companies, 2005 Object-Oriented and Classical Software Engineering Sixth Edition, WCB/McGraw-Hill, 2005 Stephen R. Schach.
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.
UHD::CS3320::CHAP61 INTRODUCTION TO OBJECTS Chapter 6.
A Brief Introduction to Software Design and Design Quality By Laura Leventhal.
Copyright W. Howden1 Lecture 6: Design Evaluation and Intro to OO Design Patterns.
Module: Definition ● A logical collection of related program entities ● Not necessarily a physical concept, e.g., file, function, class, package ● Often.
1 SOFTWARE DESIGN QUALITY COHESION and COUPLING (Part I)
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
INTRODUCTION TO PROGRAMMING STRUCTURE Chapter 4 1.
CMSC 345 Fall 2000 Unit Testing. The testing process.
CSE 303 – Software Design and Architecture
04 - Structured DesignCSC4071 Structured Design –Fundamentals of a Discipline of Computer Program and Systems Design Edward Yourdon / Larry L. Constantine.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
Coupling and Cohesion Source:
Program Design Simple Program Design Third Edition A Step-by-Step Approach 9.
SOFTWARE DESIGN.
1 Software Design Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13, 5 th edition and Ch. 10, 6 th edition.
SOFTWARE DESIGN Design Concepts Design is a meaningful engineering representation of something that is to be built It can be traced to a customer’s requirements.
Software Design Deriving a solution which satisfies software requirements.
1 Software Design Overview Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13.
Cohesion and Coupling CS 4311
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
Coupling & Cohesion CMSC 201- Fall '11. Vocabulary Routine- A programming unit that performs a task, such as a function, procedure, method, or main class.
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Programming Logic and Design Using Methods. 2 Objectives Review how to use a simple method with local variables and constants Create a method that requires.
Coupling Cohesion Chandan R. Rupakheti Steve Chenoweth (Chapter 18)
Software Engineering Principles. SE Principles Principles are statements describing desirable properties of the product and process.
Chapter 10 Software Engineering. Understand the software life cycle. Describe the development process models. Understand the concept of modularity in.
CCSB223/SAD/CHAPTER131 Chapter 13 Designing the System Internals.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Lecture 13 Law of Demeter. Cohesion Cohesion: the “glue” that holds a module together. Don’t do things that do not support a common goal Cohesion: the.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering Issues Software Engineering Concepts System Specifications Procedural Design Object-Oriented Design System Testing.
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
Programming Logic and Design Fifth Edition, Comprehensive Chapter 7 Using Methods.
SOFTWARE DESIGN & SOFTWARE ENGINEERING Software design is a process in which data, program structure, interface and their details are represented by well.
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.
Further Modularization, Cohesion, and Coupling. Simple Program Design, Fourth Edition Chapter 9 2 Objectives In this chapter you will be able to: Further.
Coupling and Cohesion Rajni Bhalla.
Coupling and Cohesion 1.
Lecture 9- Design Concepts and Principles
Software Modules in Software Design
CS223: Software Engineering
Software Design CMSC 345, Version 1/11.
Lecture 9- Design Concepts and Principles
Programming Logic and Design Fourth Edition, Comprehensive
Software Design Lecture : 9.
Paper by D.L Parnas And D.P.Siewiorek Prepared by Xi Chen May 16,2003
What Is Good Software(Program)?
Communication between modules, cohesion and coupling
Cohesion and Coupling.
Presentation transcript:

ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Key Principles of Software Architecture and Design (II) adapted from Dave Penny’s CSC407 material

ECE450 - Software Engineering II2 Structured Design Early work of software design (from 1979) that presented concepts such as cohesion, coupling, and encapsulation. –“Fundamentals of a Discipline of Computer Program and Systems Design” by Edward Yourdon and Larry Constantine Modules are not the same as for Parnas: –Module: A lexically contiguous sequence of program statements, bounded by boundary elements, having an aggregate identifier. A function, a procedure, a method Normal and pathological connections between modules: normal pathological

ECE450 - Software Engineering II3 Human limitations on dealing with complexity George Miller: The Magical Number Seven, Plus or Minus Two –Can’t keep track of too many things at the same time –Yourdon: Maximum number of subroutines called by a routine should be 5-9.

ECE450 - Software Engineering II4 Two kinds of complexity Intra-module complexity –Complexity within one module Inter-module complexity –Complexity of modules interacting with one another Inter-module effect grows as the number of modules grow Intra-module effect decrease as the modules become smaller Total errors is a combination Errors # of modules

ECE450 - Software Engineering II5 Overall cost The overall cost of a system depends on both: –The cost of production (and debugging) –And the cost of maintenance Both are approximately equal for a typical system These costs are directly related to the complexity of the code –Complexity injects more errors and makes them harder to fix –Complexity requires more changes and makes them harder to effect Complexity can be reduced by breaking the problem into smaller pieces –(So long as the pieces are relatively independent of one another) But eventually the process of breaking pieces into smaller pieces creates more complexity than it eliminates. –1970’s: Happens later than most designers would like to believe –2000’s: Happens sooner than most designers would like to believe

ECE450 - Software Engineering II6 In case you don’t believe it...

ECE450 - Software Engineering II7 Design approach Therefore, there is some optimal level of sub-division that minimizes complexity –But to reach it you need your judgment Once you know the right level, the key decision is to choose how to divide: –Minimize coupling between modules Reduces complexity of interaction –Maximize cohesion within modules Keeps changes from propagating –Duals of one another

ECE450 - Software Engineering II8 Coupling Two modules are independent if each can function completely without the presence of the other –They are decoupled, or uncoupled Highly coupled modules are joined by many interconnections and dependencies –And loosely coupled modules have a few interconnections and dependencies Goal: Minimize coupling between modules in a system –Coupling translates into “the probability that in coding/modifying/debugging module A we will have to take into account something from module B” Note that a system that has only one module (function) is absolutely uncoupled –But that’s not what we want! –(We’ll analyze cohesion, coupling’s complement, later)

ECE450 - Software Engineering II9 Influences on coupling Type of connection –Minimally connected: parameters to a subroutine –Pathologically connected: non-parameter data references Interface complexity –Number of parameters/returns –Difficulty of usage Information flow –Data flow: Passing data is handled uniformly –Control flow: Passing of flags governs how data is processed Binding time –More static = more complex E.g., literal “30” vs. pervasive constant N_STUDENTS, vs. execution-time parameter

ECE450 - Software Engineering II10 Common-environment coupling A module writes into global data A different module reads from it (data or, worse, control) Q RS T U V W X

ECE450 - Software Engineering II11 Cohesion While minimizing coupling, we must also maximize cohesion –How well a particular module “holds together” The cement that holds a module together –Answer the questions: Does this make sense as a distinct module? Do these things belong together? Best cohesion is when it comes from the problem space, not the solution space –Echoed years later in OOA/OOD

ECE450 - Software Engineering II12 Levels of lack of cohesion (roughly from worst to best) Coincidental –No reason for doing two things in the same routine double computeAndRead(double x, char c); Logical –Similar class of things that still should be separated char input(bool fromFile, bool fromStdIn); Temporal –The fact that things happen one after the other is no excuse to put them in the same routine void initSimulationAndPrepareFirst(); Procedural –Operations are together because they are in the same loop or decision process, but no higher cohesion exists typeDecide(m); // Decide type of plant being simulated and perform simulation part 1

ECE450 - Software Engineering II13 Levels of lack of cohesion (roughly from worst to best) (cont) Communicational –Procedures that access the same data are kept together void printReports(data x); // Outputs day report and monthly summary Sequential –A sequence of steps that take the output from the previous step as input for the next step string compile(String program) {parse, semantic analysis, code generation} Functional –That which is none of the above –Does one and only one conceptual thing –Equivalent to information hiding double sqrt(double x);

ECE450 - Software Engineering II14 Implementation and cohesion No need to be dogmatic Consider module FG that does two things, F and G –Chances are there is some code that can be shared between them –If F and G have high cohesion, that’s OK –Otherwise it will become difficult to work with G F G F