Preventing Bugs in Products
Since I started working for Optum in June 2018, I have noticed two main types of bugs that are especially relevant to my work: specification bugs and implementation bugs. Both are extremely important to catch early, especially in a field like Healthcare. One solution is Behavior-driven development (BDD), which uses elements of test-driven development (TDD) and domain-driven design (DDD).
Test-driven development is where the developer writes a test that should initially fail. This test defines an intended function that is then implemented and tested. This guarantees the highest likelihood that your code actually works– if your test passes right away, you know that something is wrong and are able to diagnose it easily. As you repeat the process, it is easy to find where your bugs are so you don’t waste hours trying to locate the problem. This can also help with specification bugs. If it is not clear what tests should be written, or if the tests don’t make logical sense, you can catch this early and ask for clarification before the product is delivered to clients. There are however, limitations to TDD. It is not enough to prevent bugs in code, and TDD is limited by the thoroughness of the tests that are written.
Domain-driven design aims to easily connect related pieces of information into a changing model by focusing on the core domain and logic, using models of the domain as a basis for complex models, and collaborating with “domain experts” regularly (Powell-Morse). It emphasizes continuous integration, which is necessary when working on large-scale projects. This allows for a clear and organized structure that will assist with making clearer specifications. One disadvantage, however, is that is doesn’t work without a domain expert and it isn’t well-suited for projects that are highly technical yet lack domain complexity.
Out of the various design models I’ve encountered, BDD seems to be the most fitting for a team that wants to focus on preventing specification and implementation bugs. However, it is not perfect, and its combination of TDD and DDD makes it more fitting for some teams than others. It is probably not a great choice for a personal project, but it is much more likely to work in a professional team setting.
Powell-Morse, Andrew. “Techniques for Preventing Software Bugs.” December 26, 2017.