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.

Slides:



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

What is shape function ? shape function is a function that will give the displacements inside an element if its displacement at all the node locations.
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.
UHD::CS3320::CHAP61 INTRODUCTION TO OBJECTS Chapter 6.
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.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
Jump to first page 1 System Design (Finalizing Design Specifications) Chapter 3d.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design Copyright 2000 © John Wiley & Sons, Inc. All rights reserved. Slide 1 Key.
Criteria for good design. aim to appreciate the proper and improper uses of inheritance and appreciate the concepts of coupling and cohesion.
Understanding class definitions Looking inside classes.
Systems Design. Analysis involves understanding and documenting user requirements in a clear and unambiguous way. It focuses on the business side and.
Python quick start guide
Metrics.
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.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
Coupling and Cohesion Source:
Software Design Designing the overall structure (architecture) of a software system Designing small pieces of computation Designing non-automated processes.
1 Software Design Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13, 5 th edition and Ch. 10, 6 th edition.
1 Software Design Overview Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13.
Concepts of Software Quality Yonglei Tao 1. Software Quality Attributes  Reliability  correctness, completeness, consistency, robustness  Testability.
Cohesion and Coupling CS 4311
Systems analysis and design, 6th edition Dennis, wixom, and roth
Coupling & Cohesion CMSC 201- Fall '11. Vocabulary Routine- A programming unit that performs a task, such as a function, procedure, method, or main class.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Methods (a.k.a. Functions)
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.
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.
C++ Classes and Data Structures Jeffrey S. Childs
Structured design - 1 © Minder Chen, Produce Paycheck Retrieve Employee Record Global Data Store Offpage Calling Module Called Module System.
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.
Jump to first page (C) 1998, Arun Lakhotia 1 Design Quality Metrics Arun Lakhotia University of Southwestern Louisiana Po Box Lafayette, LA 70504,
Refactoring Agile Development Project. Lecture roadmap Refactoring Some issues to address when coding.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Key Principles of Software Architecture and Design (II) adapted from Dave Penny’s.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Rohini Sharma Roll No. RA1809A01 Regd. No M.Tech.(CSE) Part Time 3 rd Semester.
Object Oriented Programming and Data Abstraction Rowan University Earl Huff.
Systems Development Lifecycle
Chapter 2: Fundamental Programming Structures in Java Adapted from MIT AITI Slides Control Structures.
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.
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.
7. Modular and structured design
Coupling and Cohesion Rajni Bhalla.
Coupling and Cohesion 1.
System Design and Modeling
Software Design Mr. Manoj Kumar Kar.
Coupling and Cohesion By Bonnie Ngu.
Cohesion and Coupling Chapter 5, Pfleeger 01/01/10.
Understanding class definitions
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?”
CS223: Software Engineering
Software Design CMSC 345, Version 1/11.
Programming Logic and Design Fourth Edition, Comprehensive
Software Design Lecture : 9.
Software Design Lecture : 11.
Software Design Lecture : 10
Understanding class definitions
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:

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 object-oriented design Not clearly understood or effectively used No historic proof of effectiveness

Slide 3 Cohesion l Measure of degree of interaction within a module l Measure of the strength of association of the elements inside a module l Functionality inside a module should be so related that anyone can easily see what the module does l Goal is a highly cohesive module

Slide 4 Levels of Cohesion in Structured Design l Functional cohesion(Good) l Sequential cohesion l Communicational cohesion l Procedural cohesion l Temporal cohesion l Logical cohesion l Coincidental cohesion(Bad)

Slide 5 Comparison of Cohesion Levels for Structured Design Cohesion LevelCleanliness of Implementation ReusabilityModifiabilityUnderstand- ability FunctionalGood SequentialGoodMediumGood CommunicationalGoodPoorMedium ProceduralMediumPoorVariable TemporalMediumBadMedium LogicalBad Poor CoincidentalPoorBad

Slide 6 Cohesion l For structured design Deals with the cohesion of the actions in a module (unit) to perform one and only one task l For object-oriented methods Deals with the ability of a module to produce only one output for one module

Slide 7 Levels of Cohesion for Object-oriented Methods l Functional cohesion(Good) l Sequential cohesion l Communicational cohesion l Iterative cohesion l Conditional cohesion l Coincidental cohesion(Bad)

Slide 8 Functional Cohesion for Object-oriented Methods l Only one output exists for the module l Ideal for object-oriented paradigm

Slide 9 Functional Cohesion for Object-oriented Methods public void deposit (double amount) { balance = balance + amount; }

Slide 10 Sequential Cohesion for Object-oriented Methods l One output is dependent on the other output l Modifications result in changing only one instance variable

Slide 11 Sequential Cohesion for Object-oriented Methods public double withdraw (double amount, double fee) { amount = amount + fee; if (amount < 0) System.out.println (“Error: withdraw amount is invalid.”); else if (amount > balance) System.out.println (“Error: Insufficient funds.”); else balance = balance – amount; return balance; }

Slide 12 Communicational Cohesion for Object-oriented Methods l Two outputs are dependent on a common input

Slide 13 Communicational Cohesion for Object-oriented Methods public void addCD (String title, String artist, double cost, int tracks) { if (count = = collection.length) increaseSize ( ); collection [count] = new CD (title, artist, cost, tracks); totalCosts = totalCosts + cost; count++; }

Slide 14 Iterative Cohesion for Object-oriented Methods l Two outputs are iteratively dependent on the same input

Slide 15 Iterative Cohesion for Object-oriented Methods void formDet (float Equations[2][3], float x[2][2], float y[2][2], float D[2][2]) { for (int Row = 0; Row < 2; ++Row) for (int Col = 0; Col < 2; ++Col) { x[Row][Col] = Equations[Row][Col]; y[Row][Col] = Equations[Row][Col]; D[Row][Col] = Equations[Row][Col]; } x[0][0] = Equations[0][2]; x[1][0] = Equations[1][2]; y[0][1] = Equations[0][2]; y[1][1] = Equations[1][2]; }

Slide 16 Conditional Cohesion for Object-oriented Methods l Two outputs are conditionally dependent on the same input

Slide 17 Conditional Cohesion for Object- oriented Methods public boolean checkBookIn ( ) { if (this.isAvailable ( )) { //this object cannot be checked out System.out.println (“Error: “ + callNumber + “ is not checked out”); return false; } else { dueDate = null; availability = true; return true; }

Slide 18 Coincidental Cohesion for Object-oriented Methods l Two outputs have no dependence relationship with each other and no dependence relation on a common input

Slide 19 Coincidental Cohesion for Object-oriented Methods public void readInput ( ) { System.out.println (“Enter name of item being purchased: “); name = MyInput.readLine ( ); System.out.println (“Enter price of item: “); price = MyInput.readLineDouble ( ); System.out.println (“Enter number of items purchased: “); numberBought = MyInput.readLineInt ( ); }

Slide 20 Coincidental Cohesion for Object-oriented Methods public String AcceptItemName ( ) { System.out.println (“Enter name of item being purchased: “); name = MyInput.readLine ( ); return name; }

Slide 21 Cohesion Decision Tree for Object- oriented Methods

Slide 22 Coupling l Measure of degree of interaction between two modules l Measure of interdependence of modules l Goal is to have so little coupling that changes can be made within one module without disrupting other modules

Slide 23 Types of Coupling for Structured Methods l Data(Good) l Stamp l Control l Common l Content(Bad)

Slide 24 Comparison of Coupling Types for Structured Design Coupling TypeSusceptibility to Ripple Effect Modifiability Understand- ability Module’s Usability in Other Systems DataVariableGood StampVariableMedium ControlMediumPoor CommonPoorMediumBad ContentBad

Slide 25 Data Coupling for Structured Methods l Just the data needed is passed between the calling and called modules through calling parameters

Slide 26 Data Coupling for Structured Methods Compute Bill Calculate Interest Interest Bill Amount

Slide 27 Stamp Coupling for Structured Methods l Whole data structure being passed as a parameter to a module but the module needs only part of data in the data structure l Types of stamp coupling: natural table record bundle

Slide 28 Control Coupling for Structured Methods l One module passes a flag as parameter to control the logic in the other module l Parameter being passed is a control flag which dictates what action to perform within the module l Example: void ProcessTransactions (bool whichFlag, DataRec data, bool& successFlag);

Slide 29 Common Coupling for Structured Methods l Use of global data l Two modules have access to the same data l Why not? Hard to maintain (ripple effect) Decreases reusability Hard to debug Data change Module change

Slide 30 Content Coupling for Structured Methods l One module reaches into the internal code of another module to grab or deposit data or to control its function

Slide 31 Coupling Decision Tree for Structured Methods

Slide 32 Coupling Example p rs q tu #inout 1Aircraft typeStatus flag 2---List of aircraft parts 3Function code--- 4 List of aircraft parts 5Part numberPart manufacturer 6Part numberPart name p, t, and u access the same database in update mode

Slide 33 Coupling Example pqrstu p DataData or Stamp Common q ControlData or stamp r Data s t Common u

Slide 34 Levels of Coupling for Object-oriented Methods l No coupling(Good) l Sequential coupling l Computational coupling l Conditional coupling l Common coupling l Content coupling(Bad)

Slide 35 No Coupling for Object-oriented Methods l No global data sharing or functional calls between two modules

Slide 36 Sequential Coupling for Object-oriented Methods l Two modules exist where the outputs of one module are the inputs of another

Slide 37 Computational Coupling for Object-oriented Methods l Two modules exist where one module passes a parameter to another module and the parameter has control or data dependence on the output

Slide 38 Conditional Coupling for Object-oriented Methods l One module passes a parameter to another module and the parameter has control dependence on an output

Slide 39 Common Coupling for Object-oriented Methods l One module writes to the global data and another module reads from the global data

Slide 40 Content Coupling for Object-oriented Methods l One module references the contents of another module

Slide 41 Coupling Decision Tree for Object-oriented Methods

Slide 42 Coupling Decision Tree for Object-oriented Methods From this point forward, Design Reviews will be done using these metrics.