Subscribe by Email


Saturday, May 5, 2012

What is the development style used in test driven development?


Several aspects, approaches and styles have been designed for carrying out the test driven development process. Adequate focus is kept on the writing of the code so that only the necessary code is produced that is required for passing the tests. Such an approach makes sure that the program designs are simple, clearer and cleaner. 

Popular aspects used in TDD


Below mentioned are few of the aspects that are quite popular among the programmers and developers using the test driven development methodology:

KISS:  
- It stands for 'Keep it Simple Stupid' and states that keeping some systems simple yields better outcomes rather than keeping them complex. 
- It defines simplicity as a key goal in the process of program designing and avoids unnecessary complexity. - Some examples of failure to follow Kiss are given by the function creep, scope creep and so on. 
- This principle of software programming was coined by Kelly Johnson.


YAGNI:  
- It stands for 'You Ain’t Gonna Need It'. 
-This though being one of the primary principles of the extreme programming is followed in the test driven development also.
- According to this principle, the functionalities should not be added until they are very much required.
- In other words, it says that the functionalities should be implemented only when they are actually needed and not merely by what one foresees. 
- This aspect has got a few drawbacks.
- The time required is obtained from the other processes like adding, testing, etc. 
- It calls for the need of debugging and documentation of the new features. 
- New features might impose certain constraints which can conflict with the working of a necessary feature in the future. 
- The program may experience the code bloat i.e., it may get bigger and complex and thus complicated. 
- A strict revision control is needed. 
- Addition of more and more features may cause snow ball effect leading to the creeping featurism.


Fake it till you make it:
- This aspect boosts the real confidence of the developers, thus preventing them from getting stuck in to their self fulfilling prophecies. 
- This technique can effectively combat the depression that most of the developers and programmers experience.

Tests are written to achieve the desired design of the software system or application whether is it advance or primitive. The code may pass all the tests being simpler as compared to the target pattern. This may sound odd at the first go but it eventually helps the developer to keep a sharp focus up on the important elements.

Whichever style is followed, there are two basic steps that should be compulsorily followed

1. First write the tests: 
It is required that the tests are written first before the functionality is actually implemented. This step is    known for having two benefits:
       (a)  It ensures that the application is worth testing i.e., it provides testability to the application. The application is considered to be tested via the outset by the developer and he/ she does not need to worry about testing later.
      (b) It ensures that every feature and functionality has a unique test developed for it so that the functionalities are tested as the executable specifications.


2. First fail the test cases: 
This step is carried out in order to ensure the correctness of the test and also its error detection ability. Once this is done, it becomes easy for the implementation of the functionality. This step is the essence of the test driven development. The following steps are constantly repeated:
(a)    Adding of tests cases that fail.
(b)   Writing ode to pass them.
(c)    Refactoring
The productivity is also enhanced following the above two steps. 


No comments:

Facebook activity