Art of Coding, Chapter 6: Abstraction and Modularity

This is post 9 of 26 in the Art of Coding blog series. The previous post was Art of Coding, Part III: Practices That Shape Good Code.

The House Without Walls

I once reviewed a project that had sprawled beyond recognition. The core logic—once elegant—had become a tangle of special cases and hidden rules. Adding one new feature required touching half a dozen unrelated files. Nothing stood alone anymore.

It reminded me of a house built without walls. The kitchen bled into the living room. The bedroom opened into the garage. At first, you could live in it. But as soon as guests arrived or renovations were needed, the lack of boundaries made everything impossible.

That's what happens when code grows without abstraction and modularity. It might work, but it cannot breathe.


Why Boundaries Matter

💡 Key idea: Abstraction hides complexity so you think at a higher level. Modularity draws boundaries so responsibility is clear. Together, they make systems that bend without breaking.

The book explores how to shape code so it grows in clarity rather than confusion. Here's what that means in practice:

Functions, classes, and modules done right. A function that stretches for a thousand lines isn't just hard to read—it's fragile. Every small change risks breaking something invisible. Good functions are thoughts made small. Good classes are characters with one clear role. Good modules are rooms in a house, each with its own purpose.

The DRY vs. TMA tension. Don't Repeat Yourself is wise, but not absolute. I've seen teams destroy flexibility by unifying code too early, before they understood whether the similarity was real or coincidental. Too Much Abstraction can be worse than duplication. The book goes deeper into knowing when to unify and when to wait.

Boundaries as contracts. A good interface says: "Here's what you can expect. Nothing more, nothing less." Clear boundaries let systems evolve without cascading changes. Without them, every small change ripples unexpectedly.


AI and Structure

AI can generate functions and classes in seconds, but it won't naturally know where the seams should be. Left unchecked, it mixes concerns, blurs responsibilities, scatters logic. The human role is to place the walls, decide where the doors go, and ensure what the machine generates lives in the right room.

⚠ Warning: Over-abstraction kills just as surely as under-abstraction. The book explains how to recognize the difference and when restraint is actually wisdom.
Curious about the specifics? The full chapter details practical patterns for building modules that scale, DRY principles that don't strangle flexibility, and how to design interfaces that teams actually want to use. Read the full book on Amazon.
2025-12-31

Sho Shimoda

I share and organize what I’ve learned and experienced.