Coderrob brand logo Coderrob

Hi, I'm Rob—programmer, Pluralsight author, software architect, emerging technologist, and lifelong learner.


Breaking Up the Big Bottom Library: Streamlining Your Code for Long-Term Health


Wed, 11 Sep 2024

Over time, code libraries have a habit of expanding like that one “utility” drawer in your kitchen. At first, it’s helpful—everything in its right place, ready for use. But before long, that drawer becomes a catch-all for every stray function, random helper, and one-off module you couldn’t quite categorize. Eventually, it’s too bloated to find anything efficiently.

When that happens, it’s time to consider not just a cleanup, but a deeper restructuring. Because left unchecked, your code library could evolve into something far more dangerous—a monolith.

The T-Shape Growth Problem

As your library evolves, you’ll likely notice one area (probably utilities) start to grow disproportionately. It’s like the top-heavy section of a T. While other parts of your library stay lean, this one folder begins to outnumber all others combined. This is the first warning sign that your library isn’t just growing—it’s about to become unmanageable.

And just like with cells, when the growth reaches a certain point, division becomes inevitable. In nature, a healthy cell divides to maintain balance and function. The same principle applies to your library. But if you ignore the need for division, you risk something far worse: unchecked growth that spirals out of control, becoming what we call a monolith.

The Monolith: Software’s Cancer

In software, uncontrolled growth results in a monolith—a massive, tangled codebase where everything is interconnected and nothing is modular. Like a cancer in a biological system, this monolithic structure eats away at productivity and performance. Every new feature, every small bug fix, adds more weight to the already bloated system, slowing down development and introducing potential failure points.

Avoiding Micro-Monoliths: Don’t Split Too Soon

But here’s the tricky part: splitting the library too soon can have equally disastrous results. If you break apart your library without careful planning, you don’t solve the problem—you just spread it.

What you’ll end up with are micro-monoliths—smaller, isolated codebases that each have the same issues as the original, only now with the added complexity of managing interdependencies.

At first, it might seem like the right solution—breaking things up, decentralizing functions—but over time, these micro-monoliths start behaving just like their larger cousin.

The interconnectedness between these small libraries becomes a maintenance nightmare, and instead of reducing complexity, you’ve multiplied it.

Plan Before You Divide

To avoid this, don’t rush the division process. Before splitting anything, take the time to establish the basics: standardized code styles, static analysis, telemetry, configuration management, security protocols, messaging structures, event streams, and performance monitoring.

These are the foundation of a healthy library. Without them, you’re just creating chaos in smaller, harder-to-manage pieces.

Continuously Prune and Refine

The best way to keep your library healthy is to adopt a cycle of continuous pruning and refinement. Don’t let unused code sit around like dead weight.

Regularly evaluate which parts of the library are still pulling their weight and which have outlived their usefulness. And when something is no longer needed, don’t be afraid to delete it. For the love of Pete, DELETE!

Like trimming back an overgrown garden, a little pruning goes a long way. By keeping your library slim and focused, you’ll not only make it easier to maintain but also faster and more efficient for everyone who uses it.

Avoid Siloing: Keep Communication Open Across Teams

In large organizations, it’s easy for code to get siloed when teams are divided up by service or product. While this may happen naturally in enterprise environments.

It’s critical to prevent each team from operating in total isolation. When sections of the codebase become walled off, the risk of fragmentation and inconsistency grows exponentially.

To avoid this, focus on establishing a durable messaging system. Proper versioning and structured message envelopes for delivering payloads across all services are essential. Unified telemetry systems (OpenTelemFTW!) ensure that everyone is working with the same data and, at the very least, speaking the same event-driven language.

And no matter how tempting it might be, resist the urge to reinvent the wheel—open-source tools can often solve problems more efficiently and with less overhead than building a custom solution from scratch.

Over-communicating is key. Make sure that standards are so well-established and documented that a developer can jump from one codebase to another with minimal cognitive load.

The goal is intuitive navigation—where a developer doesn’t have to spend mental energy deciphering how things are set up, but instead can get straight to solving problems.

When teams are aligned and systems are simplified, the codebase becomes a place where collaboration thrives, not an obstacle course of unnecessary complexity.