A critical design decision in the object-oriented world is whether to choose cohesion or coupling.  These two approaches are not mutually exclusive.  However, it is rare to see a mix of the two.  Therefore, this decision in the architecture will profoundly impact the rest of the project.

Big or Small, Cohesion or Coupling

It helps to set the stage for this discussion.  The decision comes down to either building your system with small components or large (more full-featured) ones.  The result can range from microservices up to a monolithic class that stands alone.  A single object option is a cohesive approach, while coupling uses smaller classes that work together.

Pros and Cons

Each of these approaches has pros and cons.  Thus, we need to evaluate which option is better for our specific situation.  While most solutions can be implemented using either method, some will only be useful if done with one of the options.  In general, considerations like performance, quality, and maintainability will be impacted by this choice.

Fast or Flexible, Not Both

There are several nuances involved in each of these options.  Nevertheless, the decision will often boil down to building a system that is fast or that is flexible.  This situation is not an uncommon trade-off that needs to be decided on during the architecture (and design) phase.  A cohesive solution will often perform faster and tighter.  On the other hand, a coupling approach is more flexible at the cost of overhead and speed.

Either of these two options can be implemented poorly.  Thus, selecting one or the other does not guarantee a specific outcome.  However, it is easier to stay simple and fast using cohesion.  Likewise, the coupling approach tends to be easy to adjust and extend.

Rob Broadhead

Rob is a founder of, and frequent contributor to, Develpreneur. This includes the Building Better Developers podcast. He is also a longtime student of technology as a developer, designer, and manager of software solutions. Rob is a founder and principle of RB Consulting and has managed to author a book about his family experiences. In his free time, he stays busy raising five children (although a few have grown into adults). When he has a chance to breathe, he is on the ice playing hockey to relax.

Leave a Reply