“Why are there no tests?”
This question is often answered with “We do not have enough time to write tests, we have very tight deadlines”. Whatever the crowd is at a hospital, it will lose its business if it decides to skip hygiene practices. You don’t see them reusing needles & syringes or not discarding wastes properly. It is practiced only because it is visible, if testing is that visible, it won’t be skipped.
Any profession which has a sudden need for a lot of skilled people and is managed by unskilled people is bound to lose its practice of craftsmanship. Craftsmanship requires discipline and time, a professional’s job is such that it is very hard to get it wrong because of strong unconscious competence. Highly competent people get great results in a shorter amount of time and effort, in fact they make it look like it is effortless.
Businesses have to keep running else someone else who can run faster will eat them for breakfast, but that urgency should not percolate down to every last bit of detail which turns from a sense of urgency into haste. What are some of the things that should not be lost in haste during software development?
-1. Test driven development – Without this, we are just fooling ourselves that our work is of high quality
0. Continuous integration – This does not mean just running builds on every branch that has a commit, but developing on trunk and making sure that there is a collective progress.
1. Quality code – Human readable, domain reflecting code that is easy to read, understand and modify
The list would go endless, but I am sure most of the teams don’t follow any of the above three. Practicing just the above items requires a great amount of discipline, time and effort in the initial stages which will pay back compounded in the long run. Then it is easy to achieve milestones which were never thought about.
Well said! When I look at a new piece of code, tests help me understand what the code is actually trying to do, in a way it makes it more understandable, especially from a domain point of view.
Also something I had not really given much thought to is that refactoring becomes much easier (and trustable) when there are enough tests written.