4 ms·
So a comment could explain why MySQL is shit, what versions, whether it applies to MariaDB, whether there's an open defect, how your algorithm is different, etc
by foobarbazqux 13y ago
So a comment could explain why MySQL is shit, what versions, whether it applies to MariaDB, whether there's an open defect, how your algorithm is different, etc. Presumably whoever wrote this code learned some of that metadata, so it's helpful to keep a record of it.
- IanCal 13y agoMost usefully, I'd like to know what the consequences of doing the obvious thing are. Maybe they don't matter any more (high memory usage, cpu use, etc) and we can trim the codebase, or it's still a NEVER CHANGE THIS OR WE LOSE OUR JOBS level issue. I'd much rather see a comment like /* * Inputs of integers near INT_MAX cause significant CPU load * in MYSQL versions 4.2 <= x < 5.8 (latest at time of writing) * Bug tracker http://mysqlbugtracker/issue/4 */ Than lolz_mysql_is_shit(foobar) As a relevant point, we've got a large comment in our codebase linking to issues and discussions of the problem of excel reading csv files containing £ symbols with particular encodings. If you didn't know the issue, having `format_excel_is_dumb(file)` wouldn't help. I am happy classifying comments as "you should have a reason to add it and keep it" rather than "bad code, always remove". Still, I suppose it's hard to generate buzz with an article that says "use your common sense" rather than repeating an old absolutist viewpoint.
- Shish2k 13y agoThose things are commented within the function; but the name of it allows the casual reader to know that madness lies within and they would be happier for not looking at the innards at all :P
- foobarbazqux 13y agoOk, makes sense. By the way, switching on a type code like that is the classic use case for virtual functions. http://sourcemaking.com/refactoring/replace-conditional-with-polymorphism http://sourcemaking.com/refactoring/replace-conditional-with...