I’ve sung the praise of TDD/automated testing many times before, but recently encountered an angle I hadn’t considered yet: the importance of automated tests for onboarding.
Automated tests have several benefits:
- if you’re practicing TDD, it generally drives your design in a good direction
- it provides a safety net for refactoring
- it can catch bugs
- it speeds up development
- it provides some documentation for your code
But here’s another advantage: it helps new developers tremendously. In part, because of the above-mentioned points.
Starting From Scratch
New developers in your team enter an unknown land. Sure they might know the programming language, and maybe even the business domain. But they usually don’t know the ins and outs of the application, the pristine pieces of code and the ugly monsters, the weird quirks it has, and even the general architecture.
Getting to know this can take quite a while. In my experience it can take about 1-2 years to get the feeling that you fully grasp a piece of software. This will differ from person to person and from project to project, but I’ve heard similar numbers from other developers.
This means that new developers, regardless of experience, will need some time before they know their way around the code. This also means they will initially be quite unsure that they haven’t broken anything when they change something.
There are ways to mitigate this.
The Lengthy Explanation
I once had an explanation from a lead developer that took an entire day. This was a one-on-one explanation about the business domain and the application. I didn’t really remember much of it.
Explanations like this are highly inefficient, not to mention plain boring. There is too much information all at once, and people will forget most of it.
It’s better to get to know a subject piece by piece. And after every session, let the brain process the new information.
Pair Programming
Pair programming is a great technique to explain the code to new developers. The amount of knowledge that is transferred to newcomers is tremendous. Not only the code, but also techniques and processes:
- Which flow are we using with Git?
- How do we use the ticketing system?
- Where can I find the CI results?
- How do I deploy my changes?
- How can I see and test my changes?
- And many more details of software development
Tests
My final and main point is that tests also help get new developers on board more quickly. When there is an extensive test suite, new team members can read them to see what the code does and possibly why.
Then, when they implement a new feature, they can run the test suite to have some assurance that they didn’t break anything. This isn’t 100% fail-safe, but it will give them more confidence.
So if your codebase lacks tests, start adding them. If you need help, let me know, maybe I can help. I love applying TDD to legacy projects.
Anything Else?
Know of any other benefits of automated tests? Or other efficient techniques to get new developers up and running? Leave a comment! I’m always eager to learn.