Communication between modules, cohesion and coupling

Slides:



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

Chapter 3: Modules, Hierarchy Charts, and Documentation
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.
1 Software Design Introduction  The chapter will address the following questions:  How do you factor a program into manageable program modules that can.
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.
© Copyright 2011 John Wiley & Sons, Inc.
Programming with Objects: Class Libraries and Reusable Code.
VBA Modules, Functions, Variables, and Constants
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)
Module Cohesion and Coupling Lecture 10. How to determine a good module? Cohesion: a measure of the internal strenght of a module – how closely the elements.
Jump to first page 1 System Design (Finalizing Design Specifications) Chapter 3d.
Modularisation II Lecture 9. Communication between modules Also known as intermodule communication. The fewer and the simpler the communications, the.
Chapter 1 Principles of Programming and Software Engineering.
Modules, Hierarchy Charts, and Documentation
Chapter 1 Program Design
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Systems Analysis and Design
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Chapter 9 Moving to Design. The Structured Approach To Designing The Application Architecture Module-an identifiable component of a computer program that.
INTRODUCTION TO PROGRAMMING STRUCTURE Chapter 4 1.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
Program Design Simple Program Design Third Edition A Step-by-Step Approach 9.
Software Design Designing the overall structure (architecture) of a software system Designing small pieces of computation Designing non-automated processes.
First Steps in Modularization Simple Program Design Third Edition A Step-by-Step Approach 8.
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.
Arrays Module 6. Objectives Nature and purpose of an array Using arrays in Java programs Methods with array parameter Methods that return an array Array.
1 Software Design Overview Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13.
Cohesion and Coupling CS 4311
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.
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)
Chapter 10 Software Engineering. Understand the software life cycle. Describe the development process models. Understand the concept of modularity in.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
CCSB223/SAD/CHAPTER131 Chapter 13 Designing the System Internals.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Systems Design.  Application Design  User Interface Design  Database Design.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Key Principles of Software Architecture and Design (II) adapted from Dave Penny’s.
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.
Programming Logic and Design Seventh Edition
7. Modular and structured design
Coupling and Cohesion Rajni Bhalla.
Basic Concepts in Software Design
Coupling and Cohesion 1.
Software Design Mr. Manoj Kumar Kar.
Organization of Programming Languages
Not what first comes to mind
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?”
Software Design CMSC 345, Version 1/11.
Programming Logic and Design Fourth Edition, Comprehensive
Software Design Lecture : 9.
Communication between modules, cohesion and coupling
Design Module view What module should the system and which have to be developed . It determines the module structure of components.
Cohesion and Coupling.
Presentation transcript:

Communication between modules, cohesion and coupling Chapter 10 Communication between modules, cohesion and coupling

Objectives To introduce communication between modules To develop solution algorithms that pass parameters between modules To introduce cohesion as a measure of the internal strength of a module To introduce coupling as a measure of the extent of information interchange between modules

Communication between modules 10.1 Communication between modules

Communication between modules Necessary to consider flow of information between modules This flow of information is called ‘intermodule communication’ and can be accomplished by the scope of the variable

Communication between modules Scope of a variable The portion of a program in which that variable has been defined and to which it can be referenced Variables can be global where the scope of the variable is the whole program Scope of the variable is simple the module which it is defined

Communication between modules Global data Date that can be used by all the modules in a program Every module in the program can access and change data Lifetime of a global variable spans the execution of the whole program

Communication between modules Local data Variable are defined within the submodule are called local variables The scope of a local variable is simply the module in which it is defined The lifetime of a local variable is limited to the execution of the single submodule in which it is defined

Communication between modules Side effects Side effect is a form of a cross-communication of a module with other parts of a program, Occurs when a subordinate module alters the value of a global variable inside a module

Communication between modules Passing parameters Parameters are simply data items transferred from a calling module to its subordinate module at the time of calling To pass parameters between modules, two things can happen: The calling module must name the parameters that it wants to pass to the submodule The submodule must be able to receive those parameters and return them to the calling module if required

Communication between modules Formal and actual parameters Parameters names that appear when a submodule is defined are known as formal parameters Variables and expressions that are passed to a submodule in a particular call are called actual parameters

Communication between modules Value and reference parameters Parameters may have one of three function: To pass information from a calling module to a subordinate module To pass information from a subordinate module to its calling module To fulfil a two-way communication role

Communication between modules Value and reference parameters Value parameters Value parameters pass a copy of the value of a parameter from one module to another Reference parameters Reference parameter pass the memory address of a parameter from one module to another

Communication between modules Hierarchy charts and parameters Data parameters contain actual variables or data items that will be passed between modules Status parameters act as a program flag and should contain just one of two values; true or false Data parameters Status parameters

10.3 Module cohesion

Module cohesion Cohesion is a measure of the internal strength of a module It indicates how closely the elements or the statements of a module are associated with each other The more closely the elements of a module are associated with each other, the higher the cohesion of the module

Module cohesion Coincidental cohesion Occurs when elements are collected into a module simply because they happen to fall together Occur as a result of one of the following conditions: Existing program may have been arbitrarily segmented into small modules Existing program may have been arbitrarily subdivided to conform to a badly considered programming standard A number of existing modules have been combined into one module

Module cohesion Logical cohesion Logical cohesion occurs when the element of a module are grouped together according to a certain class of activity The element falls into some general category because they all do the same kind of thing

Module cohesion Temporal cohesion Occurs when the elements of a module are grouped together because they are related by time Typical examples are initialisation and finalisation modules in which elements are placed together because they perform certain housekeeping functions at the beginning or end of a program

Module cohesion Procedural cohesion Occurs when the elements of a module are related because they operate according to a particular procedure The elements are executed in a particular sequence so that the objectives of the program are achieved

Module cohesion Communicational cohesion Occurs when the element of a module are grouped together because they all operate on the same (central) piece of data Are commonly found in business application because of the close relationship of a business program to the data it is processing

Module cohesion Sequential cohesion Occurs when a module contains elements that depend on the processing of previous elements Contain elements in which the output data from one element serves as input data to the next

10.4 Module coupling

Module coupling Coupling is a measure of the extent of information interchange between modules Tight coupling implies large dependence on the structure of one module by another Loose coupling is the opposite of tight coupling. Modules with loose coupling are more independent and easier to maintain

Module coupling Common coupling Global data structure Module A Module B Common coupling Occurs when modules reference the same global data structure External coupling Occurs when two or more modules access the same global data variable (similar to common coupling except that the global data is an elementary data item, rather than a data structure) Global data variable Module A Module B

Module coupling Control coupling Occurs when a module passes another module a control variable that is intended to control the other module’s logic Stamp coupling Occurs when one module passes a non-global data structure to another module in the form of a parameter Module A Module B Module A Data structure Module B

Module coupling Data coupling Occurs when a module passes a non-global data variable to another module (similar to stamp coupling except that the non-global data variable is an elementary data item, nota data structure) Module A Elementary data item Module B

Module coupling Summary of coupling levels If the programming language allows it, try to uncouple each module from its surroundings by Passing data to a subordinate module in the form of parameters, rather than using global data Writing each subordinate module as a self-contained unit

Summary Introduced communication between modules and parameters. Intermodule communication is the flow of information or data between modules. Passing of parameters was introduced as a form of intermodule communication.

Summary The differences between formal and actual parameters and value and reference parameters was explained. Module cohesion and module coupling must be considered when designing modular programs. Cohesion is a measure of the internal strength of a module. Seven levels of cohesion were discussed.

Summary Coupling is a measure of the extent of information interchange between modules. Five levels of coupling were discussed.