3 ms·
> More recently, out of curiosity, I pitched the same question as a poll on Twitter. On Twitter, roughly 80% of respondents said that they would save the applic
by slver 5y ago
> More recently, out of curiosity, I pitched the same question as a poll on Twitter. On Twitter, roughly 80% of respondents said that they would save the application code and 20% said they would save the tests.
Surprise, common sense.
Saving the tests is like needing to know the answer to the Ultimate Question of Life, the Universe, and Everything (which is 42) and discarding the question.
- cogman10 5y agoI'm shocked that 20% of devs value tests over working code. This should have been a 99% to 1% thing.
- jokethrowaway 5y agoPeer pressure and the TDD religion
- aszen 5y agoI'll try to justify, imagine you have working code with no tests, it's been running for years but no one can understand it or change any of it. It's providing a very fixed value. Now imagine you have all the tests laying out exactly how the features should work. Sure you don't have anything to show for yet but it's not going to take a lot of time to implement these features. The hardest part in most companies is not building features but what features to build and how should they work. This usually takes domain knowledge and a lot of trial and error. So let me put it this way, if there was a competitor in the business, I would definitely like to see their tests rather than their working code. Since tests actually define how their app should work and not their code which merely tells me how their app is working.
- cogman10 5y agoI have worked on exactly that sort of code base. I've also worked on codebases which did super test coverage. And honestly, the 0 test coverage base was actually easier to deal with. Tests are good, but like all code they can be implemented poorly.
- aszen 5y agoSome test cases are really important and cover the whole domain, take as example the tc39 tests, they are really all you need to fulfill to create a compliant javascript implementation.
- lakis 5y ago> it's not going to take a lot of time to implement these features That's so wrong. Have you ever worked in a complex program?
- aszen 5y agoYes ofcourse. Having tests helps a lot, take as example someone building a markdown parser. If u have the knowledge of how to build parsers, then an existing suite of tests is going to speed your work quite a bit by ensuring that you build the right thing and covering the exact features you need without any ambiguity. Ofcourse I do realise that in real world examples there's not many test cases which cover a feature fully. But this was all thinking hypothetically.