Here's a breakdown of stamp coupling in architecture:
What it is:
- Stamp coupling occurs when modules within a system share a composite data structure, but each module only uses a portion of that structure.
- It's like passing a whole book when someone only needs a single chapter.
Example:
- Imagine a function that needs a customer's name, but it's passed a whole customer record containing name, address, phone number, and more.
- The function only uses the name, but it's now tied to the entire structure.
reference : https://en.wikipedia.org/wiki/Coupling_(computer_programming)
https://www.youtube.com/watch?v=ExbDmyXfBnw
If it is a distributed call: it directly affects to bandwidth
If it is an internal it may affect memory consumption
Distributed Calls:
- Increased bandwidth consumption: When a large composite data structure is passed over a network in a distributed call, it consumes more bandwidth than if only the necessary fields were transmitted. This can lead to:
- Slower response times
- Higher network costs
- Potential network congestion
Internal Calls:
- Increased memory usage: When a large composite data structure is passed around within a system, it occupies more memory than if smaller, focused structures were used. This can lead to:
- Memory pressure
- Performance issues (e.g., slower processing, garbage collection overhead)
- Potential memory leaks
To mitigate these effects, it's important to follow the best practices for reducing stamp coupling:
- Break down composite structures into smaller, more focused ones.
- Pass only the specific data that's needed by each module.
- Use interfaces or abstract data types to hide implementation details.
- Consider messaging or event-driven architectures to decouple modules.
By addressing stamp coupling, you can improve system performance, resource utilization, scalability, and maintainability.
No comments:
Post a Comment