Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
12 couplingand cohesion-student
1. Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
2.
3. Coupling: Degree of dependence among components No dependencies Loosely coupled-some dependencies Highly coupled-many dependencies High coupling makes modifying parts of the system difficult, e.g., modifying a component affects all the components to which the component is connected.
4. Range of Coupling High Coupling Loose Low Content Common Control Stamp Data Uncoupled
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19. Range of Cohesion High Cohesion Low Functional Informational Sequential Communicational Procedural Temporal Logical Coincidental
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35. Examples of Cohesion-1 Function A Function B Function D Function C Function E Coincidental Parts unrelated Function A Function A’ Function A’’ logic Logical Similar functions Time t 0 Time t 0 + X Time t 0 + 2X Temporal Related by time Function A Function B Function C Procedural Related by order of functions
36. Examples of Cohesion-2 Function A part 1 Function A part 2 Function A part 3 Functional Sequential with complete, related functions Function A Function B Function C Communicational Access same data Function A Function B Function C Sequential Output of one is input to another
37. p q t r s u 1 2 3 4 5 6 No. In Out Interface Description p, t, u access the same database in update mode Problem: Define coupling between pairs of modules. 1 Aircraft type Status flag 2 ----- List of aircraft parts 3 Function code ----- 4 ----- List of aircraft parts 5 Part number Part manufacturer 6 Part number Part name
Example of good: Sort that takes a comparison function as an argument. The sort function is clearly defined: return a list in sorted order, where sorted is determined by a parameter.
In right hand side, the sort code is unchanged.
Be sure you know the difference between the insightful designer and the lazy programmer. Know what tradeoffs you are making in your design.