3 ms·
It has always been amazing to me that almost all developers are convinced that it is not possible to write programs that work on the first try. This is as sill
by lmilcin 6y ago
It has always been amazing to me that almost all developers are convinced that it is not possible to write programs that work on the first try.
This is as silly as stating that you need to build at least couple skyscrapers that fall before one that can stand up and can be occupied.
It is not at all difficult. Instead of spending my entire career writing couple of lines of code and then running it, to see if it works (which is training at being perpetually newb at programming), I spent it learning to write longer and longer pieces of code that I understand exactly what they are going to do and that work on the first try.
I can work weeks writing thousands of lines of complex code and have very good chance that the effect will be working code that needs no corrections.
Do I make silly mistakes? Sure I do. But I then try to figure how it happened and how to make sure I don't make those kinds of blunders in the future.
I also try to design the modules in such a way that it is not possible to misuse them (well, at least requires malicious intent or gross incompetence).
You see, unit tests reward people who break a lot, not people who put a lot of effort into not breaking things. I prefer to focus my efforts into not breaking things in the first place.
I wish this was more popular: https://en.wikipedia.org/wiki/Personal_software_process https://en.wikipedia.org/wiki/Personal_software_process
- Nursie 6y agoI’m afraid I would not hire someone with that sort of outlook, nor do I believe that you could reliably produce software at any great speed that way. Unit tests show you that the code does what it’s supposed to. Without them you haven’t demonstrated that, just asserted it, nor have you left a system that can be picked up by others with a reasonable expectation that if something does break, it will be caught.
- lmilcin 6y agoYou are blinded, that's what it is. Unit tests became popular relatively recently. When I started development decades ago there was no talk of unit tests at all. Do you want to suggest that people were unable to effectively write working software back then? Just think about this. Unit tests are just one way to help make it more likely the code works. It is neither the only way nor the best way.
- Nursie 6y ago> You are blinded, that's what it is. Others might call it experienced. > Do you want to suggest that people were unable to effectively write working software back then People are still unable to effectively write working software. Unit tests are useful for catching problems, which are inevitable, early. They have grown in popularity over the last couple of decades precisely because of the prevalence and costs of preventable errors in the industry. I'm afraid I don't believe that simply by trying really hard you can eliminate said errors, nor do I believe the productivity trade-off would be worth it. > Unit tests are just one way to help make it more likely the code works. It is neither the only way nor the best way. Absolutely, they are part of a whole spectrum of techniques and are far from enough in isolation. I've never claimed they are the be-all and end all. They're a useful and essential part of a system of checks and validations, not the only thing you need to do. The clue's in the name, they test units.
- ric2b 6y ago> Do you want to suggest that people were unable to effectively write working software back then? On the first try? Yes, absolutely they weren't, and still aren't. > Unit tests are just one way to help make it more likely the code works. It is neither the only way nor the best way. Agreed.