Software Design Lecture : 9.

Slides:



Advertisements
Similar presentations
Quality of a Class Abstraction: Coupling & Cohesion Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Advertisements

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.
Lecture 9 Improving Software Design CSC301-Winter 2011 – University of Toronto – Department of Computer Science Hesam C. Esfahani
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.
Managing data Resources: An information system provides users with timely, accurate, and relevant information. The information is stored in computer files.
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.
Criteria for good design. aim to appreciate the proper and improper uses of inheritance and appreciate the concepts of coupling and cohesion.
ASP.NET Programming with C# and SQL Server First Edition
Developed by Reneta Barneva, SUNY Fredonia Component Level Design.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Software Design Fundamentals Design Principles
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 (SWD) Instructor: Dr. Hany H. Ammar
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.
SE: CHAPTER 7 Writing The Program
Cohesion and Coupling CS 4311
Systems analysis and design, 6th edition Dennis, wixom, and roth
System Implementation
Coupling & Cohesion CMSC 201- Fall '11. Vocabulary Routine- A programming unit that performs a task, such as a function, procedure, method, or main class.
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)
Chapter 10 Software Engineering. Understand the software life cycle. Describe the development process models. Understand the concept of modularity in.
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
CCSB223/SAD/CHAPTER131 Chapter 13 Designing the System Internals.
CS540 Software Design Lecture 3 & 4 1 Lecture 3 & 4: Modularity, Coupling, Cohesion and Abstraction Anita S. Malik Adapted from Schach.
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.
Systems Design.  Application Design  User Interface Design  Database Design.
Week 6: Software Design HNDIT Software Engineering Software Design Learning Outcomes  Understand the activities involved in the Design process.
Slide 1 Good Methods. Slide 2 Cohesion and Coupling l For structured design These software metrics were used extensively Proven to be effective l For.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
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.
Introduction toData structures and Algorithms
Introduction To DBMS.
Programming Logic and Design Seventh Edition
7. Modular and structured design
UNIT-3 SOFTWARE DESIGN.
Coupling and Cohesion Rajni Bhalla.
Basic Concepts in Software Design
Coupling and Cohesion 1.
Chapter 1: Introduction
Basic Concepts in Software Design
Software Design and Architecture
Software Design Mr. Manoj Kumar Kar.
Not what first comes to mind
Cohesion and Coupling Chapter 5, Pfleeger 01/01/10.
Improving the Design “Can the design be better?”
CS223: Software Engineering
Software Design CMSC 345, Version 1/11.
Programming Logic and Design Fourth Edition, Comprehensive
Software Design Lecture : 8
Software Design Lecture : 11.
Software Design Lecture : 10
Chapter 1: Introduction
Chapter 1: Introduction
Software Design Lecture : 35.
Communication between modules, cohesion and coupling
Cohesion and Coupling.
Chapter 1: Introduction
DESIGN CONCEPTS AND PRINCIPLES
Presentation transcript:

Software Design Lecture : 9

Software Design Components Principle Criteria (this lecture) Techniques

Range of Coupling High Coupling Content Common Control Stamp Data Uncoupled Loose Low

Common Coupling – High Coupling Definition: Two components share data Global data structures Common blocks Usually a poor design choice because Lack of clear responsibility for the data Reduces readability Difficult to determine all the components that affect a data element (reduces maintainability) Difficult to reuse components Reduces ability to control data accesses Pp220+ pfleeger

Example-1 Process control component maintains current data about state of operation. Gets data from multiple sources. Supplies data to multiple sink. Each source process writes directly to global data store. Each sink process reads directly from global data store.

Diagrammatic Representation Shared Data Store Source -1 Sink Variable a Source -2 Read directly from Variable a Write directly to Variable a Source -3

Example-2 Process control component maintains current data about state of operation. Gets data from multiple sources. Supplies data to multiple sinks. Each source process writes directly to global data store. Each sink process reads directly from global data store. Improvement Data manager component is responsible for data in data store. Processes send data to and request data from data manager.

Diagrammatic Representation Data Manager Source -1 Sink Variable a Source -2 Places request to read Places request to write Source -3

Control Coupling – Moderate Coupling Definition: One module controls the internal logic of the the other one through parameters May be either good or bad, depending on situation. Bad when component must be aware of internal structure and logic of another module Good if parameters allow factoring and reuse of functionality

Example of Control Coupling Two modules exhibit control coupling if one (``module A'') passes to the other (``module B'') a piece of information that is intended to control the internal logic of the other Unsorted List Sort the list

Stamp Coupling Definition: Stamp coupling is when modules share a composite data structure and use only a part of it, possibly a different part (e.g., passing a whole record to a function that only needs one field of it). Be sure you know the difference between the insightful designer and the lazy programmer. Know what tradeoffs you are making in your design.

Example-1 Customer billing system The print routine of the customer billing accepts a customer data structure (cid, cname, address, phone no, email address, NIC, cell no, passport no) as an argument, parses it, and prints the name, address, and billing amount.

Example-2 Customer Billing System The print routine of the customer billing accepts a customer data structure as an argument, parses it, and prints the name, address, and billing information. Improvement The print routine takes the customer name, address, and billing information as an argument rather than taking the whole structure as input.

DATA COUPLING – Lowest level of coupling Data coupling occurs between two modules when data are passed by parameters using a simple argument list and every item in the list is used. 

Example

Cohesion A measure of the closeness of the relationships between elements of a component or "module" of a system. High cohesion is desirable because: simplifies correction, change and extension reduces testing promotes reuse

Range of Cohesion High Cohesion Coincidental Low Functional Informational Sequential Communicational Procedural Temporal Logical Coincidental Low

Coincidental Cohesion – Lowest Cohesion Definition: Parts of the component are only related by their location in source code A coincidentally cohesive module is one whose activities have no meaningful relationship to one another.

Example – Module with multiple argument Print next line Reverse string of characters in second argument Add 7 to 5th argument Convert 4th argument to float  All the above functions have no relationship but they are there in the same module by chance!! I don’t even want to think about it.

Logical Cohesion Definition: Elements of component are related logically and not functionally. Several logically related elements are in the same component and one of the elements is selected by the client component. A logically cohesive module performs several activities of the same general category in which the activity or activities to be executed are selected by the invoking module

Example- I/O Operation A component reads inputs from tape, disk, and network. All the code for these functions are in the same component. Operations are related, but the functions are significantly different. I don’t even want to think about it.

TEMPORAL COHESION A temporally cohesive module is one which performs several activities that are related in time. Temporally cohesive modules typically consist of partial activities whose only relationship to one another is that they are all carried out at a specific time..

Example One of the most common examples of a temporally cohesive module is an initialization routine that initializes data used by many modules throughout a system. I don’t even want to think about it.

Procedural Cohesion Definition: Elements of a component are related only to ensure a particular order of execution.  Module with (only) procedural cohesion is one supporting different and possibly unrelated activities, in which control passes from one activity to the next.

Example ... Read part number from data base update repair record on maintenance file. May be useful to abstract the intent of this sequence. Make the data base and repair record components handle reading and updating. Make component that handles more abstract operation.

Communicational Cohesion Definition: Module performs a series of actions related by a sequence of steps to be followed by the product and all actions are performed on the same data A communication ally cohesive module is one which performs several functions on the same input or output data. 

Example Update record in data base and send it to the printer. Obtain author, title, or price of book from bibliographic record, based on a passed flag. I don’t even want to think about it.

Sequential Cohesion The output of one component is the input to another. Occurs naturally in functional programming languages Good situation

Example Retrieve customer Data Retrieve customer order Generate invoice Get and edit input data.

Functional Cohesion – Highly cohesive Definition: Every essential element to a single computation is contained in the component. A functionally cohesive module performs one and only one problem related task. Ideal situation.

Examples Read Customer Record, Calculate Net Pay A complex module with numerous sub modules may still be functionally cohesive if all of its subordinate modules are only performed to carry out the task of the parent module. For example, Calculate Net Pay is functionally cohesive although it contains many different functions (e.g., calculate taxable deductions, calculate tax, calculate CPP deduction).

Sufficient Each component has all the features needed for a sensible and efficient usage within the abstraction The interface is as small as possible. Minimum possible interface is to be selected

Complete Each component has all relevant features within the abstraction; a general interface can be reused.

Simple All features of a components are easy to understand (and implement); Complex features are built up of simpler features.

Simple All features of a components are easy to understand (and implement); Complex features are built up of simpler features.