This year I decided that I'll talk more about software testing, especially TDD and automated tests. Today I want to talk about the ability to incrementally view the design of a system shape up as you do TDD (Test Driven Development). It's an interesting visualisation exercise. 🥋 When there's nothing, you start with simple definitions and your tests reflect that. They might be simple tests to to check if a function is defined. As you incrementally build the system, the tests get more nuanced and complex. There are mocks, test datasets, fixtures and several other testing mechanisms weaved into the "tests fabric". Together, all of this, or the test fabric as I call it, is a blueprint of your design. This is a valuable insight because once you understand this, you will be able to spot "cracks" in your design. As we continue to add tests and refactor existing ones, several design decisions become intentional & conscious. These decisions tell us about the building blocks of the system. They provide insight into the behaviour & implementation of the system in a compact, clearly specified manner. At any point, simply reading the test cases is like flashing a bright light on a dimly lit architecture diagram that resides in our minds! While I describe this feature in terms of a TDD workflow, the same insights can be derived even if you don't follow TDD. Being able to visualize the design of a software system via it's tests is a feature of automated testing itself! Let that sink in and remember this the next time you work on a project. If you join a startup and there are no tests, write them! (Topic for another day!) The next time you write tests, pay close attention to your design and how the tests subtly, and sometimes, quite evidently impact it. These small, simple acts of observation and reflection can take you a long way in your craft. What are your thoughts? Let me know in the comments section! ✨ #SoftwareCraftsmanship #TestDrivenDevelopment #TDD #SoftwareEngineering #Programming #AutomatedTesting #SoftwareDesign
Articles are really nice and insightful.
Software Craftsperson | Indie Hacker | Tech Consultant | Hip Hop Enthusiast | Meditation Teacher
6dYou can also read the same post on my SubStack (The Hacker's Playbook)! https://thehackersplaybook.substack.com/p/tests-a-gateway-into-system-design