Not what first comes to mind

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.
1 SOFTWARE DESIGN QUALITY COHESION and COUPLING (Part II)
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.
Use Case Analysis – continued
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
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 (SWD) Instructor: Dr. Hany H. Ammar
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.
1 Software Design Overview Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13.
Copyright © 2015 – Curt Hill Version Control Systems Why use? What systems? What functions?
Cohesion and Coupling CS 4311
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 12-5 Software Engineering Design Goals.
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.
Copyright Curt Hill The C/C++ switch Statement A multi-path decision statement.
Design and Planning Or: What’s the next thing we should do for our project?
Copyright © 2005 – Curt Hill MicroProgramming Programming at a different level.
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.
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.
Advanced Computer Systems
Unit - 3 OBJECT ORIENTED DESIGN PROCESS AND AXIOMS
Programming Logic and Design Seventh Edition
7. Modular and structured design
Visit for more Learning Resources
Metrics of Software Quality
Coupling and Cohesion Rajni Bhalla.
Chapter 7 Text Input/Output Objectives
Coupling and Cohesion 1.
Operating Systems (CS 340 D)
System Design Ashima Wadhwa.
Chapter 12: Collaboration Diagram - PART2
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
Copyright © by Curt Hill
Part 3 Design What does design mean in different fields?
The Client/Server Database Environment
Class and Method Design
Cohesion and Coupling Chapter 5, Pfleeger 01/01/10.
Organizing common actions
Predefined Dialog Boxes
Improving the Design “Can the design be better?”
Objects as Variables Featuring the Date Object
Lecture 22 Inheritance Richard Gesick.
CS223: Software Engineering
Fault Tolerance Distributed Web-based Systems
Software Design CMSC 345, Version 1/11.
Throwing and catching exceptions
Miscellaneous Thoughts Nothing on the APIs
Programming Logic and Design Fourth Edition, Comprehensive
Software Design Lecture : 9.
Libraries of Code Notes from Wilson, Software Design and Development Preliminary Course pp
Design Components are Code Components
Control Structure Testing
Multiple Inheritance in C++
Communication between modules, cohesion and coupling
CS 2704 Object Oriented Software Design and Construction
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:

Not what first comes to mind Coupling Not what first comes to mind Want to talk about cohesion as well? Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Coupling Coupling, in Computer Science and Software Engineering, describes the dependency of one thing upon another The things in question are usually functions and objects May also refer to interdependency Low coupling means an item is not very dependent on another High coupling means that we cannot use the one without the other Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Terminology Low coupling is sometimes referred to as weak or loose Generally desirable for functions and objects Indicates well designed modules High coupling AKA tight or strong Inhibits reuse in other programs Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Informal Example The coupling of a customer and clerk in a store is low Communicate through common language Either person is interchangeable with another Family relationships are usually high Parents/siblings/spouse are tightly coupled No interchangeability Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Types of Coupling 1 Content (high) A module relies on the internal workings of another Common (high to medium high) Two modules use common global variables Changing the globals requires a change in the modules External (medium) Two modules share a common data format or protocol Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Types of Coupling 2 Control (medium) One module controls the execution of another Often a parameter that alters the type of processing Stamp or data structure Two modules use a common data structure, but not the same portions of it Changing the data structure may mandate changes in one without the other Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Types of Coupling 3 Data (low) Data is shared, but the data is simple, such as in parameters Often a parameter that alters the type of processing None Two modules share nothing Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Coupling Issues Highly coupled systems become harder to maintain A change in one module forces changes in others A ripple effect occurs as change ripples through the system Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Some Examples GUI programs are typically Common coupled Event handlers rely on the fact that certain edit boxes or labels are available Cutting the event handler out of one program and putting it into another is never done Math library functions Those programs that use them are Data coupled to them They are not coupled to each other Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill The Date class example The methods are stamp or common coupled with one another getDay is stamp coupled with getMonth ToString is common coupled with getDay Changing the form of the month, day and year mandates changes in every method Since the class is a unit this is not a problem Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Date again Suppose that the correct function were missing and not called Then the date class would be dependent on its client to supply good data This would shift the checking to the client This would increase the coupling between the client and the class Copyright © 2014 by Curt Hill

High Coupling is Not Evil Very often we have a program that has a central data structure or many data structures Nearly every method/function uses one or more of these We do not need to pass every data structure to every function Just use it as global data This is not bad but it prevents reuse of the function Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill The Other Coupling Multiple CPU systems also use this term Two CPUs that have a common memory is termed tightly coupled Two CPUs that are connected by some other type of high speed communications is loosely coupled Current multicore CPUs are tightly coupled, while the CPU to GPU coupling is loose Copyright © 2014 by Curt Hill

Copyright © 2014 by Curt Hill Conclusion When designing classes we generally want the lowest possible coupling This allows us to reuse the class This allows us to rewrite the class without breaking other things Many programs have one-shot classes They are designed for this particular application Little chance of reusability Copyright © 2014 by Curt Hill