Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to overcome the anti-pattern "Big Ball of Mud"?

What causes a computer program to turn into a Big Ball of Mud? Is it possible to recover from this anti-pattern? Are there proven refactoring methods that can be applied?

like image 748
comichael Avatar asked Jun 23 '09 02:06

comichael


People also ask

How do I stop big balls of mud?

By creating smaller modules that limit their coupling can help prevent a big ball of mud. You may end up with smaller balls of mud, but that's much easier to tackle and comprehend in a large system.

What do we mean by a big ball of mud regarding software architecture?

A big ball of mud is a software system that lacks a perceivable architecture. Although undesirable from a software engineering point of view, such systems are common in practice due to business pressures, developer turnover and code entropy. They are a type of design anti-pattern.

What are spaghetti code and big ball of mud considered?

"A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spaghetti-code jungle. These systems show unmistakable signs of unregulated growth, and repeated, expedient repair.

How do you identify anti patterns?

In an organization, there are three main opportunities to identify anti-patterns: During design reviews, during code reviews and during refactoring of legacy code. Design reviews are a great opportunity to find anti-patterns.


2 Answers

A Big Ball Of Mud normally occurs because of one of the following:

  • Change of Requirements - You architect a solution with one set of requirements, which over time change and now, you are probably catering to a different audience who wants to use the same product with slightly different requirements. You bake those requirements into the same product and you end up with a BBOM.

  • Change of Developers - The original product has been created by one set of developers with certain design and architectural assumptions which are not entirely evident to a whole new set of developers who 'take over' the product for maintainence or further development. The new developers make their own assumptions and over time, the product degrades into a pile of unmaintainable junk.

  • Incompetency - of the developers (they are unaware of anti-patterns), the management (too demanding, lack of knowledge of the product) or the users (they don't really know what they need). This is hard to solve.

Sometimes, the best solution is simply to rewrite the application catering to the new requirements. But this is normally the worst case scenario. The cumbersome solution is to stop all new development, start by writing a set of tests and then redesign and rearchitect the whole solution. This could take years, depending on the size of the product, though.

like image 68
Anirudh Avatar answered Nov 10 '22 13:11

Anirudh


BBOMs I have encountered were usually created organically, in a Darwinian process. It goes something like this:

  1. Initally, a system is created (not designed) and poorly documented.

  2. Original resources go on to create more havok elsewhere, so there isn't even an oral history for this "legacy" system.

  3. Fresh blood is brought in. These developers try to uncover workings of various system parts, but it's like several blind men trying to understand the elephant when one has grabbed the tail, one a leg, and one the trunk. They make changes but never really feel confident about them.

  4. In this way, a system "evolves" by blind natural selection, but parallel to this is an evolution of the most intractable, unreproducible bugs that persist precisely because they remain under the radar screen, until of course they surface at a customer installation.

like image 25
Buggieboy Avatar answered Nov 10 '22 15:11

Buggieboy