Introduction
System Analysis & Design (SAD) में Coupling एक महत्वपूर्ण concept है, जो यह बताता है कि system के modules एक-दूसरे पर कितना dependent हैं।
अच्छे design में modules के बीच dependency कम (low coupling) होनी चाहिए, ताकि system flexible और maintainable बना रहे।
Coupling क्या है
Coupling modules के बीच interconnection या dependency को दर्शाता है।
Simple शब्दों में:
Coupling = modules के बीच dependency का स्तर
Types of Coupling
1. Content Coupling (सबसे खराब)
एक module दूसरे module के internal data को directly access करता है।
2. Common Coupling
Multiple modules shared global data का उपयोग करते हैं।
3. Control Coupling
एक module दूसरे module के behavior को control करता है।
4. Stamp Coupling
पूरे data structure को pass किया जाता है, भले ही जरूरत कुछ हिस्सों की हो।
5. Data Coupling (सबसे अच्छा)
Modules के बीच केवल आवश्यक data pass किया जाता है।
Block Diagram of Coupling
Module A ---------> Module B
(Dependency)
Diagram Explanation
इस diagram में दिखाया गया है कि एक module दूसरे module पर dependent है।
Dependency जितनी कम होगी, system उतना बेहतर होगा।
Importance of Coupling
- low coupling system को flexible बनाता है
- maintenance आसान होता है
- modules independent रहते हैं
- errors का impact कम होता है
Important Points
- low coupling अच्छा design दर्शाता है
- high coupling से system complex बनता है
- data coupling सबसे बेहतर होता है
Conclusion
Coupling system design का महत्वपूर्ण concept है, जो modules के बीच dependency को दर्शाता है।
एक अच्छा design हमेशा low coupling को prefer करता है।
Cohesion
Introduction
Cohesion यह बताता है कि एक module के अंदर के elements आपस में कितने related हैं।
अच्छे design में module के अंदर strong relationship (high cohesion) होना चाहिए।
Cohesion क्या है
Cohesion module के अंदर functions और elements के बीच संबंध को दर्शाता है।
Simple शब्दों में:
Cohesion = module के अंदर internal strength
Types of Cohesion
1. Coincidental Cohesion (सबसे खराब)
Random tasks एक module में रखे जाते हैं।
2. Logical Cohesion
Similar type के functions एक module में होते हैं।
3. Temporal Cohesion
Same time पर execute होने वाले tasks एक साथ होते हैं।
4. Procedural Cohesion
Tasks एक sequence में execute होते हैं।
5. Communicational Cohesion
Tasks same data का उपयोग करते हैं।
6. Sequential Cohesion
एक task का output दूसरे task का input होता है।
7. Functional Cohesion (सबसे अच्छा)
Module एक single well-defined function perform करता है।
Block Diagram of Cohesion
+----------------------+
| Single Module |
| Related Functions |
+----------------------+
Diagram Explanation
इस diagram में एक module के अंदर related functions दिखाए गए हैं।
जितना ज्यादा relation होगा, उतनी high cohesion होगी।
Importance of Cohesion
- high cohesion system को मजबूत बनाता है
- module clarity बढ़ती है
- maintenance आसान होता है
- reusability बढ़ती है
Important Points
- high cohesion अच्छा design दर्शाता है
- low cohesion से system confusing बनता है
- functional cohesion सबसे बेहतर होता है
Conclusion
Cohesion system design का एक महत्वपूर्ण concept है, जो module के अंदर internal relationship को दर्शाता है।
एक अच्छा design हमेशा high cohesion को prefer करता है।
Key Concept
- Low Coupling + High Cohesion = Best Design