







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Bellaachia; Class: Software Paradigms; Subject: Computer Science; University: George Washington University; Term: Unknown 1989;
Typology: Study notes
1 / 13
This page cannot be seen from the preview
Don't miss anything!








1. Goals - Maximize interaction within each ( cohesion ) and minimize interaction between modules ( coupling ) 2. Cohesion - the degree to which the internals of a module are related - A module has high cohesion if all of its elements are strongly related: elements are grouped together for a logical reason, not just by chance. They cooperate to achieve the common goal of the module. - High cohesion Î well-designed reusable module - There are seven cohesion levels: 1. Coincidental cohesion Î BAD 2. Logical cohesion 3. Temporal cohesion 4. Procedural cohesion 5. Communication cohesion 6. Informational cohesion 7. Functional cohesion Î GOOD
Problems: Î Module interface is difficult to understand ÎDifficult to maintain
2.3. Temporal cohesion
A module has temporal cohesion when it performs a series of related actions in time.
Ex. Î An initialization module: Initial several unrelated objects: customer_table, item_table, etc.
Î Modules to manipulate these objects are located in other modules
Problems: Maintenance and Reusability
2.4. Procedural cohesion
A module has procedural cohesion if it performs a series of actions related by the sequence of steps to be followed by the product.
Ex. Read(part_number, part_table);
Update(repair_record) maintain(cutomer_table)
Better than temporal cohesion
Problem: Reusability: actions are weakly related.
2.5. Communicational cohesion
A module has communicational cohesion if it performs a series of actions related by the sequence of steps to be followed by the product and if all actions are performed on the same data.
Better than procedural cohesion: actions of the module are closely related.
Ex. Update_record(R,table); Write_record(R,audit_table);
2.6. Informational cohesion
A module has informational cohesion if it performs a number of actions each with its own entry point, with independent code for each action, all performed on the same data structure. All actions in an informational cohesion level are closely related.
3. Coupling - Originally designed to support programming in the large Modules Encapsulation Interfaces
Uncoupled no dependencies
Loosely coupled some dependencies
Highly coupled many dependencies
Module A and B have high coupling if they depend on each other heavily.
Î Modules are Reusable Î Modules are easily tested and modified Î Reduction of the maintenance cost
3.1. Content Coupling
¾ Any change to q may require a change to p.
¾ It is impossible to reuse module p without reusing q
Î global_variable may be changed by function_1() or function_2().
Î Modification of the declaration of the global_variable may yield a modification of every module that accesses the global variable.
¾ Common-coupled are not reusable Î They depend on modules where global variables are declared.
3.3. Control Coupling
Î q informs p as what to do Î Control-coupling
3.4. Stamp Coupling
¾ Passing different variables Î slower ¾ Passing one single record Î faster
Knuth's first law: Don't!!
¾ Required optimization Î Leave it to the experts
Knuth's second law: Not yet!!
3.5. Data Coupling
Where Ri is the number of internal links and Re is the number of external links. o Example:
The cohesion of M1 and M2 in Figure 1 are:
CH(M1) = 2/ CH(M2) = 1/
o The cohesion of a software system is the average cohesion of all its n modules:
CH = (1/n) * ∑ CH(mi) for all mi of the system.
o Example: The cohesion of the system in Figure 1 is:
CH = 7/
o The coupling of a module is the ratio of the number of external links to the total number of links:
CP(mi) = Re /(Ri+Re)
o The coupling of a system is the average coupling of all its n modules:
CP = (1/n)* ∑ CP(mi) for all mi of the system.