experienced it, I am usually met with skepticism. On paper, creating code does seem like a long and
convoluted process. The benefits cannot be ignored, however:
➤ TDD ensures quality code from the start. Developers are encouraged to write only the code needed to make the test pass and thus fulfill the requirement. If a method has less code, it ’ s only logical that the code has fewer opportunities for error.
➤ Whether by design or by coincidence, most TDD practitioners write code that follows the SOLID principals. These are a set of practices that help developers ensure they are writing quality software. While the tests generated by the practice of TDD are extremely valuable, the quality that results as a side - effect is an incredibly important benefit of TDD.
➤ TDD ensures a high degree of fidelity between the code and the business requirements. If your requirements are written as tests, and your tests all pass, you can say with a high degree of confidence that your code meets the needs of the business.
➤ TDD encourages the creation of simpler, more focused libraries and APIs. TDD turns development a bit on its head, because the developer writing the interface to the library
or API is also its fi rst consumer. This gives you a new perspective on how the interface
should be written, and you know instantly if the interface makes sense.
➤ TDD encourages communication with the business. To create these tests, you are encouraged
to interact with the business users. This way, you can make sure that the input and output combinations make sense, and you can help the users understand what they are building.
➤ TDD helps keep unused code out of the system. Most developers have written applications in which they designed interfaces and wrote methods based on what might happen. This leads to systems with large parts of code or functionality that are never used. This code is expensive. You expend effort writing it, and even though that code does nothing, it still has to be maintained. It also makes things cluttered, distracting you from the important working code. TDD helps keep this parasite code out of your system.
➤ TDD provides built - in regression testing. As changes are made to the system and your code, you always have the suite of tests you created to ensure that tomorrow ’ s changes do not damage today ’ s functionality.
➤ TDD puts a stop to recurring bugs. You’ve probably been in situations where you are developing a system and the same bug seems to come back from QA repeatedly. You think you ’ vefinally tracked it down and put a stop to it, only to see it return two weeks later. With TDD, as soon as a defect is reported, a new test is written to expose it. When this test passes, and continues to pass, you know the defect is gone for good.
➤ When developing applications with testability in mind, the result is an architecture that
is open, extensible and flexible. Dependency Injection is a key component of both TDD and a loosely coupled architecture. This results in a system that by virtue of its architecture is robust, easy to change, and resistant to defects.
1 comments: on "THE BENEFITS OF TDD"
How to work TDD practitioners
Regards
Urvashi | Online Shopping
Post a Comment