Published Dec 11, 2017

Clean Architecture - Components and Component Cohesion

Allen, Michael, and Joe dive into Clean Architecture, focusing on component cohesion, effective software release strategies, and the benefits of microservices, while emphasizing principles from Robert C. Martin to ensure high-quality and maintainable code.
Episode Highlights
Coding Blocks logo

Popular Clips

Episode Highlights

  • Reuse Principle

    The Common Reuse Principle emphasizes not forcing users to depend on unnecessary components. Michael Outlaw explains how this principle is often violated, leading to bloated dependencies that complicate simple tasks 1. Joe Zack illustrates this with an example where an email client unnecessarily depends on a logging client, dragging along unrelated dependencies 1. Alan Underwood discusses the dilemma of refactoring code, where breaking projects into smaller components can lead to additional complexities like build orders and versioning 2.

    There should be a don't make mistakes principle, but it's still just the idea of this email code. It's got a very specific functionality and it's now it's being tied with this other stuff. And so anytime you need one, the other comes along.

    --- Joe Zack

    Balancing these dependencies is crucial for maintaining clean and efficient code.

       

    Versioning

    The Release Equivalence Principle focuses on proper versioning and documentation for shared software components. Joe Zack highlights the importance of having distinct release numbers for each component to avoid unnecessary dependencies 3. Michael Outlaw and Alan Underwood discuss the merits of semantic versioning, emphasizing its role in ensuring compatibility and clarity for both developers and end-users 4.

    If you use something like semantic versioning, it's very easy to reason about just looking at the numbers, assuming that people aren't, you know, lying and fudging about their numbers.

    --- Michael Outlaw

    Proper versioning practices help maintain the integrity and usability of software components.

       

    Closure Principle

    The Common Closure Principle advises bundling classes that change for the same reason and at the same time. Joe Zack explains that this principle helps minimize the impact of changes by keeping related classes together 5. He also connects this principle to the Common Reuse Principle, emphasizing the importance of separating unrelated functionalities to avoid unnecessary dependencies 1.

    Gather together those things that change at the same times and for the same reason. Separate those things that change at different times or for different reasons.

    --- Michael Outlaw

    This approach ensures that changes are localized, reducing the risk of widespread issues.

       

    Tension Triangle

    The Tension Triangle illustrates the balance between the three cohesion principles: reuse, release equivalence, and closure. Michael Outlaw describes how focusing on one principle can impact the others, creating a dynamic balance that shifts throughout a project's lifecycle 6. Joe Zack elaborates on the costs associated with neglecting each principle, emphasizing the need for a balanced approach 7.

    The key is trying to find a balance between these things, because there's no perfect scenario. Right. Like, there never is.

    --- Alan Underwood

    Understanding this balance is crucial for effective software architecture.

Related Episodes