TDD in Legacy Code - Legacy Code Sandbox Project
It's hard to apply TDD in Real Life Projects. That's why we'll simulate Legacy Code in a Sandbox Project, apply the TDD transformation, and then apply the same transformation to the Real Life Project.
📢Note: I’d previously defined the Sandbox Project setup instructions. However, comments and questions, I’ve now “upgraded” the instructions. Therefore, if you’ve already started the Sandbox Project, I recommend reading this updated version and updating your Sandbox Project accordingly. If you’re new, start here. 📢
🔒Hello, this is Valentina with a premium issue of the Optivem Journal. I help Engineering Leaders & Senior Software Developers apply TDD in Legacy Code. This article is part of the TDD in Legacy Code series. To get these articles in your inbox every week, subscribe:
TDD is hard to apply in Real Life Projects
If you tried to immediately jump to TDD in Real Life Projects, it would most likely fail. The reason is that Real Life Projects are often Legacy Code - they’re untestable and have poor automated testing. It’s too challenging, too time-consuming, and too risky to immediately attempt new technical practices on the Real Life Project.
That’s why we start with a Sandbox Project
Pilots go to Flight Simulator Training before they fly a real airplane.
Sandbox Projects are like “Simulator Training“ for development teams. They enable teams to acquire new technical practices incrementally, safely, and with less stress. They don’t impact the existing Real Life Project (yet).
As part of the TDD in Legacy Code series, we’ll create a Sandbox Project that reflects our current way of working at our jobs. As we go through subsequent articles, we’ll transform this Sandbox Project step-by-step. In the Comments section below, I’ll review your Sandbox Project and support you at every step.
Transfer skills from Sandbox to Real Life Project
After a Pilot completes Flight Simulator Training, they’re ready to fly the real airplane.
After you’ve completed the TDD in Legacy Code series on the Sandbox Project, you can use it as a sample project to show to your colleagues, and apply it in your Real Life Project. Essentially, you’ll repeat the same transformation process you did for the Sandbox Project, except you’ll be applying it to the Real Life Project. Of course, as you apply the steps in your Real Life Project, you may face additional complications - that’s why you’re always welcome to ask me any questions in the Comments section below.
Before we start
Individual Subscriptions
If you’re paying for Optivem Journal yourself (or your Employer is financing you with an Individual Subscription) and using it for your individual learning, then you can most likely make any technical choices you wish; these may or may not correspond to the technical choices made in your current job.
Project Member(s): Yourself
Group Subscriptions
Your Engineering Leader granted you a Group Subscription to you and your colleagues. In that case:
Project Member(s): If your Engineering Leader provided a Group Subscription to you and other colleagues, I recommend working together as a team, and creating ONE Sandbox Project. You’ll be able to learn together and support each other as a team. That’s the best learning approach.
Decision making: As you go through the steps below, keep in mind to make your Sandbox Project a simulation of your Real Life project. When you make some choices for your Sandbox Project (e.g. Tech Stack, System Architecture, etc.), try to make these closely correspond to the technical choices you have in your Real Life Project, i.e. simulate the way you’re working now. If in doubt, please align with your Engineering Leader and your team.
Existing vs new GitHub projects
If you’ve already have an existing GitHub project that you’d like to use as the Sandbox, then please update that project in accordance with the steps listed below.
Otherwise, please you’ll need to create a new GitHub project using the steps below.
Let’s get started!
Here are the steps to set up your Sandbox Project to simulate Legacy Code. You’ll get tasks to implement in your GitHub Sandbox Project. I’ll review & provide feedback in the comments: ⬇️⬇️⬇️