Junior — Middle
Can you explain the concept of connectivity or relationship between system components?
sobes.tech AI
Answer from AI
Coupling is a measure of the dependency between components of a system. The higher the coupling, the more the components depend on each other, which complicates maintenance and modification of the system.
Ideally, components should be loosely coupled so that changes in one component minimally affect others. For example, in Python, modules or classes should interact through well-defined interfaces rather than directly using each other's internal details.
Example: if class A calls methods of class B through an interface rather than directly accessing B's internal variables, the coupling between them is lower.
Loose coupling increases flexibility, makes testing easier, and promotes code reuse.