Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Examine the goals of coupling and cohesion and the approaches to design you use

ID: 3778699 • Letter: E

Question

Examine the goals of coupling and cohesion and the approaches to design you use to achieve those goals for your design. Examine the concepts of coupling and cohesion as they are defined and used in both an object-oriented design approach and in a structured design approach. Thinking as a systems analyst, which approach best enables you to design a system that meets the goals of low coupling and high cohesion? Support your position with examples (e.g., functional, sequential, communicational, or iterative).

Explanation / Answer

Coupling and cohesion in object oriented design:

Coupling and cohesion are used to indicate the qualitative analysis of the modularity in a system, and they help us to identify and measure the design complexity of object oriented systems.

Coupling:

Coupling defined as the degree of interdependence that exists between software modules and how closely they are connected to each other.

There are several dimensions of coupling:

·         Content coupling -- this is a type of coupling a particular module can access or modify the content of any other module.

·         Common coupling – in this type multiple modules having access to a share global data.

·         Stamp coupling -- this is a type of coupling in which data structure is used to pass information from one component in the system to another component.

·         Control coupling – in this coupling in which one module can change the flow of execution of another module

·         Data coupling -- two modules interact by exchanging or passing data as a parameter

Cohesion:

Cohesion is a measure of the degree in which the responsibilities of a single module or a component form a    meaningful unit.

Cohesion types:

·         Co-incidental cohesion – in this co incidental cohesion breaking a module into smaller modules.

·         Logical cohesion -- multiple logically related functions or data elements are placed in the same component

·         Temporal cohesion -- the elements of a module are grouped into a manner in which they are processed at the same point of time exactly.

·         Procedural cohesion -- the functions in a component are grouped into a way to enable them to be executed sequentially and procedurally

·         Communicational cohesion -- the elements of a module are logically grouped together in a way that they execute sequentially and they work on the same data correctly.

·         Sequential cohesion -- the elements of a module are grouped in manner that the output of one of them becomes the input of the next they all execute in process. if the output of one part of a component is the input of another component, we say that the component has sequential cohesion.

·         Functional cohesion

·         -- this is the best and preferred cohesion

·         in which the degree of cohesion is the highest.

·         the elements of a module are functionally grouped into a logical unit and they work together as a logical unit

·         -- this also flexibility and reusability.

Coupling and cohesion in Structured design:

Coupling:

• In this coupling two modules are independent if each can function completely without the presence of the other module.

– They are decoupled or uncoupled.

• High coupled modules are joined by many interconnections or dependencies

•Low coupled modules are joined by few interconnections or dependencies

Levels of Lack of Cohesion:

• Coincidental – No reason for doing two things in the same subroutine

• void computeAndRead(double z, double& sqrtz, char& c);

• Logical – Similar(same) class of things

• char input(bool fromFile, bool fromStdin);

• Temporal – Things that happen int the process of one after the other

• void initSimulationAndPrepareFirst()

Procedural – Operation are together because they are in the same loop or decision process (but no higher cohesion exists) – typeDecide(m)

• Communicational – In this communicational All operations are on the same set of input data, or produce the same set of output data.

• void printReport(data p, data q, data r)

• Sequential – A sequence of steps that take the output of the before(previous)step and process it into input for the next step sequentially.

• string compile(String program) { parse, semantic analysis, code generation process}

• Functional – That which is none of the above ones

• double sqrt(double z);

– Does one and only one conceptual thing in structured design.

– Equal to Information Hiding

Object oriented approach is better for the your design cause Loose coupling makes it possible to:

·         Understand one class without reading others class

·         Change one class without affecting others class

·         Thus improves maintainability.

·         Easy to maintain

High cohesion makes it easier to:

·         Understand what a class or method does Properly

·         Use descriptive names for class or method.

·         Reuse classes

·         Reuse methods

Examples of Low cohesion and high coupling:

Low cohesion example:

class

element 1;

element 2;

element 3;

method 1()

{uses element1}

method 2()

{uses element2}

method 3()

{uses element3}

Low coupling example:

class A class B

element A ---uses-----implements---- element B;

method A() | method B()

{ Interface {element B}

}

Thank You :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote