Everything I don’t like about unit testing

…brilliantly summed up by Alexey Golub in “Unit Testing is Overrated”.

My main complaint is that they greatly expand the complexity of the code with interfaces and abstractions that only exist for the sake of the unit tests, without actually testing the application the way it will be used. Users don’t care how high your code coverage is if the app doesn’t work.

He comes out swinging right after the bell:

Focusing on unit tests is, in most cases, a complete waste of time.

Kinder, gentler version:

If you treat unit testing as a goal in itself, you will quickly find that, despite putting a lot of effort, most tests will not be able to provide you with the confidence you need, simply because they’re testing the wrong thing. In many cases it’s much more beneficial to test wider interactions with integration tests, rather than focusing specifically on unit tests.

The alternative:

Writing high-level tests that are driven by user behavior will provide you with much higher return on investment in the long run


Simple rules for keeping dev teams out of trouble

I’ve been leading small software development teams on big projects since 2004. Painful experiences taught me some simples rules to make it less painful. Here they are, presented in order of discovery:

      1. If it can be null, it will be null
      2. The clipboard is a cruel mistress
      3. Size really does matter
      4. Inside every small problem is a larger one, struggling to get free
      5. Every bug you fix creates 2 more
      6. The law of the motorcycle shop is non-negotiable
      7. Cleverness is the mother of regret
      8. Just in time requirements are neither
      9. Don’t solve problems you don’t have yet, Nostradamus
      10. Later == never, temporary == forever, shipped > not shipped
      11. Only change 1 thing at a time
      12. Always redo, never fix
      13. Finish the most important feature first
      14. Tomorrow you hates the code you write today, so don’t plan too far ahead
      15. Character data is nvarchar(max) until you can prove otherwise (see rule 2)
      16. Schrodinger’s Spec – you can know what the client wants, or what will be best for them, just not at the same time
      17. Solve the toughest problem first
      18. Legacy == proven. Try out the newest thing on your own time and dime.
      19. Naming stuff is hard
      20. You’re not going to reuse that
      21. Process: never fix, always redo. Code: never rewrite, always fix
      22. Fix problems upstream
      23. Never use a black box when a text file will do
      24. Normalize until it hurts, denormalize until it works
      25. The original sin of code is writing it
      26. An unbound task is the Devil’s workshop
      27. Developer time is vastly more expensive than CPU time