2
kiki
3y

Okay. Here's the ONLY two scenarios where automated testing is justified:
- An outsourcing company who is given the task of bug elimination in legacy code with a really short timeframe. Then yes, writing tests is like waging war on bugs, securing more and more land inch after inch.
- A company located in an area where hiring ten junior developers is cheaper than hiring one principal developer. Then yes, the business advantage is very real.

That's it. That's the only two scenarios where automated testing is justified. Other such scenarios doesn't exist.

Why? Because any robust testing system (not just "adding some tests here and there") is a _declarative_ one. On top of already being declarative (opposed to the imperative environment where the actual code exists), if you go further and implement TDD, your tests suddenly begins to describe your domain area, turning into a declarative DSL.

Such transformations are inevitable. You can't catch bugs in the first place if your tests are ignorant of entities your code is working with.

That being said, any TDD-driven project consists of two things:
- Imperative code that implements business logic
- Declarative DSL made of automated tests that also describes the same business logic

Can't you see that this system is _wet_? The tests set alone in a TDD-driven project are enough to trivially derive the actual, complete code from it.

It's almost like it's easier to just write in a declarative language in the first place, in the same way tests are written in TDD project, and scrap the imperative part altogether.

In imperative languages, absence of errors can be mathematically guaranteed. In imperative languages, the best performance (e.g. the lowest algorithmic complexity) can also be mathematically guaranteed. There is a perfectly real point after which Haskell rips C apart in terms of performance, and that point happens earlier on than you think.

If you transitioned from a junior who doesn't get why tests are needed to a competent engineer who sees value in TDD, that's amazing. But like with any professional development, it's better to remember that it's always possible to go further. After the two milestones I described, the third exists — the complete shift into the declarative world.

For a human brain, it's natural to blindly and aggressively reject whatever information leads to the need of exiting the comfort zone. Hence the usual shitstorm that happens every time I say something about automated testing. I understand you, and more than that, I forgive you.

The only advice I would allow myself to give you is just for fun, on a weekend, open a tutorial to a language you never tried before, and spend 20 minutes messing around with it. Maybe you'll laugh at me, but that's the exact way I got from earning $200 to earning $3500 back when I was hired as a CTO for the first time.

Good luck!

Comments
  • 1
    I won't laugh at you, but I've yet to meet a CTO this opinionated in real life. By the time we get to that level we're normally at the 'meh, horses for courses' stage, and no longer ranting online about how X sucks or Y is great.
  • 0
    @MM83 next time try to dismantle the arguments and not the person who presents them
  • 0
    @kiki I find your contributions here entertaining for the most part, but after a fair few 'nobody but me knows what they're talking about re. CSS' comments, I find this one even more so.
  • 0
    @MM83 I’m not sure I’m getting what you’re trying to say.
  • 0
    Doesn't the declarative language need to be really flexible / malleable to keep up with the dynamism of TDD + imperative?

    Also do you have any resources to recommend to get into your thought process better?
  • 0
    @hardCoding “TDD + imperative” is as flexible as declarative because TDD itself is declarative
Add Comment