Comment programming
![]() | Template:Wikify is deprecated. Please use a more specific cleanup template as listed in the documentation. |
![]() | The topic of this article may not meet Wikipedia's general notability guideline. (December 2008) |
Comment programming, also known as Comment-driven Development is a software development technique that is based on the regular use of comment tags. In comment programming the comment tags are not used to describe what a certain piece of code is doing, but rather to stop some parts of the code from being executed. The aim is to have the commented code at the developer's disposal at any time he might need it. This is especially useful when the requirements change rapidly. In this case they happen to revert to older versions of themselves, thus making the programmer either write the code again, or revert parts of the code from the versioning repository, which would be more time-consuming. With comment programming, when such a request for reverting to an old implementation arises, the developer just comments the current implementation and uncomments the previous. It is advisable to add short descriptive comments to blocks of commented code.
Practical Uses
This programming process can be used for prototyping a new design pattern. This is done by creating a new structure of classes without any implementation, and then you can add the implementation later.
Pseudocode Example:
function onClick() { // this is where we handle mouse click // the result of this function is that a button will be highlighted }
As you can see in the example, there is a structure around a click event handler. However, comment programming is used instead of a real implementation. The idea is that many functions can be written like this, and then the design can be reworked and revisited without having to refactor a lot of source code.