Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It is not academic at all, but utterly practical. In your example of a 10+ line code block that is preceded by a comment, the correction is to extract that code into a subroutine and name it accordingly and maybe write actual documentation* for the usage of said subroutine.

Your second example is valid, though i have to admit i've not once been in that situation in my years of work, despite often working with legacy code, and suspect it's fairly rare.

* Note here that comments are not documentation, these are two different entities, one being aimed at the maintainer of a library, the other aimed at the user.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: