Correct option is C
In software engineering, coupling refers to the degree of interdependence between software modules. The lower the coupling, the better the modularity and maintainability of the system.
The correct answer is (c) B, C, D, A, E because it orders the coupling types from the weakest to the strongest within the given set. Stamp coupling is the least intrusive here—modules share a composite record/struct and typically use only parts of it. Control coupling is stronger since one module steers another’s logic via flags or control parameters. External coupling binds modules to outside formats/devices/interfaces, increasing rigidity beyond mere control flow. Common coupling shares global data, creating broad, hard-to-track dependencies. Content coupling is the strongest (worst), where a module reaches into another’s internals or its code structure.
Information Booster
- Definition Ladder (weak → strong in this list): Stamp (B) → Control (C) → External (D) → Common (A) → Content (E).
- Stamp Coupling (B):
- Type: Share a whole record/struct; callee uses only some fields.
- Example: Passing Customer when only Customer.id is used.
- Applications/Uses: Common in APIs where DTOs are passed; acceptable when records are stable.
- Advantages: Lower logical dependency than control/common/content; clearer interfaces than globals.
- Disadvantages: Over-passing data can hide what’s truly needed; potential for unintended future use of extra fields.
- Control Coupling (C):
- Type: Caller sends flags/modes that alter callee’s internal flow.
- Example: processOrder(order, isExpress=true).
- Applications/Uses: Mode switches, feature toggles.
- Advantages: Single entry point for multiple behaviors.
- Disadvantages: Logical entanglement; callee behavior depends on external control knowledge.
- External Coupling (D):
- Type: Dependence on external data formats, protocols, device interfaces, environment variables.
- Example: Two modules tightly bound to a specific CSV column order or hardware driver spec.
- Applications/Uses: File I/O, device comms, third-party protocol integrations.
- Advantages: Standardization through external contracts.
- Disadvantages: Fragile to external changes; versioning/compatibility burdens.
- Common Coupling (A):
- Type: Multiple modules share the same global data area/state.
- Example: Global configuration map read/written by many modules.
- Applications/Uses: Legacy systems, quick prototyping.
- Advantages: Easy access to shared state.
- Disadvantages: Hidden side effects, poor testability, tight ripple effects across the system.
- Content Coupling (E):
- Type: One module accesses/modifies another’s internal data or jumps into its code.
- Example: Directly manipulating another class’s private fields or using offset-based memory pokes.
- Applications/Uses: Rarely justified; seen in low-level hacks/legacy code.
- Advantages: None architecturally; only short-term hacks.
- Disadvantages: Breaks encapsulation; maximal fragility; maintenance nightmare.
- Practical Tip (Exam & Projects): Prefer interfaces that pass only needed data (data coupling, not in options). If you must pass a struct, keep it stable and documented (stamp). Avoid control flags when separate functions or strategy patterns can express intent. Treat globals as last resort; never reach into internals.
Additional Knowledge:
· Lower coupling is desirable in software design as it increases modularity, testability, and maintainability.
· High coupling increases complexity, risk of errors and tight dependency, making changes harder to manage.