8
kiki
4y

You had two additional weeks to improve your project.

You could research different marketing strategies to increase revenue. You could add some new features to attract more users and ensure your existing users are satisfied. Finally, you could optimize performance to make your UI quicker.

But you’ve chosen to write some unit tests. Now that two weeks are gone, you got no new features, no performance improvements and no new marketing strategies while your competitors got them all.

Tests caught obvious bugs that can even be caught by static typing, but you by definition couldn’t write tests that’ll catch unpredictable bugs, so they are still present.

After six months you realize you have to rewrite a major part of your project because your project (surprise-surprise) has to chase market needs to stay relevant. Your tests are thrown into trash along with your old code.

“Having trouble with code quality? Write a lot of tests. And I mean a *lot*. Test every file in isolation. Mock as many imports as possible.

When you're done, your code will still be bad, but now your tests will make sure it's impossible to improve anything in any meaningful way.”

Comments
  • 4
    Personally I write tests not only to check the correctness of my code but to know if I mess up existing feature while adding a new one.

    Why is your test thrown out of the trash when you decided to do a rewrite?

    You are still going to use the part of old code right?
  • 1
    @mr-user while you spend time on this (https://devrant.com/rants/2835964/...) I implement new features
  • 0
    @uyouthe

    You discover my dark past :)

    Is it your personal project (if you don't mind me asking)?

    If it is a company project , you can *delegate* the testing to someone.
  • 1
    @mr-user I once convinced my company to drop unit testing and only test manually. Code quality remained the same while shipping rate increased significantly. It was a plane tickets aggregator
  • 2
    @uyouthe

    If the good quality remain the same who am I to say otherwise.

    Good job convincing it to drop unit testing. How do you do it? Care to share some tips?
  • 1
    @mr-user basically this rant. Quality wasn’t exactly GOOD though, but tests did nothing to improve it
  • 1
    @uyouthe

    If test did nothing to improve it , it is not a test fault. It's not a technical problem. It's human fault.

    Did department politics mess it up?

    Did it have mess up architecture?

    Do you want to kick your co worker and boss every day? :)
  • 1
    @mr-user not good by my standards and compared to my own projects but better than the industry
  • 1
    @uyouthe

    You care too much and it is a good thing.

    I like you having a good standard but we have to *compromise* when your co worker and company don't care much about the project as you do.

    Just having a decision the team have decided or your suggestion in writing so they don't blame you when thing goes wrong.

    I like emailing the team members the *notes* of meeting,decisions,suggestions so they (including me) can be accountable.

    I assume you do the side project to contains your anger :)
  • 1
    @mr-user if your employees don’t care, unit tests won’t save you
  • 0
    @mcfly do you have a CS background and/or have you studied UML?
  • 0
    @mcfly I think this is why you need such a framework as tests to structure your code. I clearly remember the transition period at the uni when the amount of structure and architecture-related questions I was constantly thinking about was reduced to almost zero. I’m not saying that my ways are superior. I spent a lot of time studying this all but now I save time not writing unit tests
Add Comment