DEV Community

Discussion on: Clean Code

Collapse
 
mtrantalainen profile image
Mikko Rantalainen

I was thinking a case where logically you should use some code but due a problem in a library that you're using, you have to use some kind of workaround (with possibly worse runtime performance).

However, until the library maintainer has fixed the problem you cannot be sure if the correct code you are currently thinking is the actual final implementation because it could turn out that the library maintainer cannot fix the current API due backwards compatibility issues and you have to use a newly introduced function to get the fixed behavior for the use case you need. And if you use programming language such as C you cannot keep the "probably soon to be implemented code using currently non-existing API" visible to compiler so you have to hide it from the compiler. Putting the code in comments is one common way to do it.

Of course, you can also keep track of such future changes somewhere else but the actual source code. It really depends on how the whole project is implemented.

Some comments have been hidden by the post's author - find out more