Juggling

  • Junior Engineer: Creates complex solutions to simple problems
  • Engineer: Creates simple solutions to simple problems.
  • Senior Engineer - Creates simple solutions to complex problems.
  • Rockstar Engineer - Makes complex problems disappear.

(taken from here)

Lately I have been faced with a complex problem. Its solution is quite easy - honestly, a junior dev could come up with something in half day. Yet, I have been looking at it for 3 days now. In this specific case, a single edge case, can turn a simple implementation into a complex one 1.

It's not a crash, UI glitch, or anything that will ruin the user experience directly. There will be some duplicated work internally and that's about it.

More broadly, when I am thinking about a solution, I am faced with:

  • Deadlines
  • Code extensibility and maintenance
  • User happiness
  • Developer happiness
Deadlines

It establishes how much time I can dedicate to the problem. In this particular case, a simple solution with the edge case, is faster to implement than the more complex one. Obviously, an application is more than just one single problem, so other parts need some ♥️ as well.

Code extensibility and maintenance

This is an important topic. On the long term, a codebase that looks like a rat's nest, will resist new features. Not only that, a complex code base might hide subtle bugs. With every new release, a user would expect a more stable app, but he might have another thing coming.2 Making an effort to have code that is simple and modular, in the mid to long term, will make the difference between a feature taking 1 hour or 1 week.

User happiness

The user is the one that pays your salary. He should have the best possible experience, always.

Developer happiness

Every single developer that I know, never said to me: "I hate greenfield projects". Why is that? Because you don't have to put up with the stuff the previous guy did. There is no technical debt, there is nothing really, so you are free to do as you please. In case you have to work in an existent project, it is always a pleasure to deal with good code. Complexity, if's nesting and other pearls only makes us feel miserable.

Bottom line
  • Problems and potential solutions need to be seen holistically.
  • There are always compromises.
  • More than often, what seems to be the right thing at first, isn't.
  • Code can always be improved, be pragmatic about it.

Hopefully, one day, I will be able to make complex problems disappear.

  1. Suffice to say, an implementation with little to no state, suddenly gets riddled with it.

  2. "Just because your car has the latest version of the firmware -- that is what we call embedded software -- doesn't mean it is safer necessarily than the older one" - Toyota Unintended Acceleration and the Big Bowl of “Spaghetti” Code