Essential and accidental complexity

I’ve been reading Neal Ford’s series of articles on Evolutionary architecture and emergent design and in the one about ‘Investigating architecture and design‘ he discusses Essential and accidental complexity which I’ve previously read about in Neal’s book, ‘The Productive Programmer‘.

Neal defines these terms like so:

Essential complexity is the core of the problem we have to solve, and it consists of the parts of the software that are legitimately difficult problems. Most software problems contain some complexity.

Accidental complexity is all the stuff that doesn’t necessarily relate directly to the solution, but that we have to deal with anyway.

I find it interesting to consider where the line is for when something becomes essential complexity and when it’s accidental complexity although Neal suggests that there’s a spectrum between these two definitions upon which a piece of complexity sit.

I recently read 37 signals book ‘Getting real‘ and one of the things that really stood out for me was the idea of keeping an application simple and writing less software wherever possible.

I’m intrigued as to where this would fit in with respect to essential and accidental complexity because quite often we end up implementing features which aren’t part of the application’s core value but do add some value yet become way more complicated than anyone would have originally imagined.

Quite often these won’t be the first features played in a release because they’re not considered top priority and therefore when they are played the amount of analysis done on their potential impact is often less and as we implement these features they end up pervading across the application and increasing its overall complexity.

Another thing that often happens is that we start developing these features, complicating the code base as we go, before the business eventually decides that it’s not worth the time that it’s taking.

By this time the complexity has spread across the code and it’s quite difficult to get rid of it cleanly.

What typically seems to happen is that some of it will just end up staying around in the code base pretty much unused and confusing people who come across it and don’t understand what it’s being used for.

If we were coming from the angle of Domain Driven Design then we might say that any complexity in the core domain of our application is essential and we should expect that complexity to exist.

On the other hand perhaps we should be more strict about what complexity is actually essential and try and ensure that only complexity around the absolutely vital features is allowed and look to compromise on simpler solutions for features which play a more supporting role.

If we were to follow a definition along these lines then I think we would recognise that there is actually quite a lot of accidental complexity in our applications because although some complex features do contribute to the solution it probably causes more pain than the value that it adds.

The take away for me is that we should be aware that this type of accidental complexity can creep into our applications and make sure that the business knows the trade offs we are making by implementing these types of features.

This entry was posted in software-development. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

2 Responses to Essential and accidental complexity

  1. Eric Smith says:

    I notice that you haven’t differentiated between domain complexity and infrastructural complexity. Would there be a correlation between (domain,infrastructural) and (essential,accidental)?

    Also, is the term “accidental” the most appropriate term? Isn’t “incidental” more descriptive?

    Ironically in the case of software development, application of KISS isn’t as simple as it would seem—it’s a very tenuous balancing act. Often an *attempt* to KISS results in the introduction of complexity. KISS is a dangerous design imperative because it can be interpreted in so many ways.

    Classic example: a highly normalised DB design is KISS (at least, conceptually), but has the potential to un-KISS the data access code, especially when considering a small project.

  2. Steve Py says:

    Personally I think a lot of the unnecessary complexity I’ve seen in solutions I’ve been a part of over the years is permitted in the name of consistency if nothing else. “What’s good for the goose…” seems to be a common theme with development teams.

    “Process A is superior for this important scenario, so it will be adopted throughout the application so that everything is done consistently.”

    The problem is that Process A is a total pain in the ass when what the client wants doesn’t fit. Then you’re left pounding square pegs into round holes.

    In general, the simpler you keep “everything” the easier it is to learn what the middle ground is and ensure that everything works in a relatively consistent manner. (That and not being afraid to change things.)

Leave a Reply