logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

Simple-correct-fast.md (2742B)


  1. ---
  2. date: 2018-07-09
  3. layout: post
  4. title: "Simple, correct, fast: in that order"
  5. tags: [philosophy]
  6. ---
  7. The single most important quality in a piece of software is simplicity. It's
  8. more important than doing the task you set out to achieve. It's more important
  9. than performance. The reason is straightforward: if your solution is not simple,
  10. it will not be correct or fast.
  11. Given enough time, you'll find that all software which solves sufficiently
  12. complex problems is going to (1) have bugs and (2) have performance problems.
  13. Software with bugs is incorrect. Software with performance problems is not fast.
  14. We will face this fact as surely as we will face death and taxes, and we should
  15. prepare ourselves accordingly. Let's consider correctness first.
  16. Complicated software breaks. Simple software is more easily understood and far
  17. less prone to breaking: there are less moving pieces, less lines of code to keep
  18. in your head, and fewer edge cases. Simple software is more easily tested as
  19. well - after all, fewer code paths to run through. Sure, simple software *does*
  20. break, and when it does the cause and appropriate solution are often apparent.
  21. Now let's consider performance. You may have some suspicions about your
  22. bottlenecks when you set out, and you should consider them in your approach.
  23. However, when the performance bill comes due, you're more likely to have
  24. overlooked something than not. The only way to find out for sure what's slow is
  25. to measure. Which is easier to profile: a complicated program, or a simple one?
  26. Anyone who's looked at a big enough flame graph knows exactly what I'm talking
  27. about.
  28. Perhaps complicated software once solved a problem. That software needs to be
  29. maintained - what is performant and correct today will not be tomorrow. The
  30. workload will increase, or the requirements will change. Software is a living
  31. thing! When you're stressed out at 2 AM on Tuesday morning because the server
  32. shat itself because your 1,831st new customer pushed the billing system over the
  33. edge, do you think you're well equipped to find the problem in a complex piece
  34. of code you last saw a year ago?
  35. When you are faced with these problems, you must seek out the simplest way they
  36. can be solved. This may be difficult to do: perhaps the problem is too large, or
  37. perhaps you were actually considering the solution before considering the
  38. problem. Though difficult it may be, it is your most important job. You need to
  39. take problems apart, identify smaller problems within them and ruthlessly remove
  40. scope until you find the basic problem you can apply a basic solution to. The
  41. complex problem comes later, and it'll be better served by the composition of
  42. simple solutions than with the application of a complex solution.