Comments are needed, there’s no b&w here. Sometimes, for instance, you need a quirky crutch which is not obvious in terms of goals and/or mechanics (don’t ask me why, years of working for enterprise). If you work in a team you definitely need to let your peers know the reasoning. And that’s not the only case.
Needless to say you don’t have to annotate each variable and function, ideally the names and/or input/output types should be self-explanatory. But that’s just not always possible (not meaning we don’t need to strive for that). I’ll die on this hill 😅 as well as other JS/DOM warriors I believe.
Absolutely. For example, our groovy backend integrates with Odoo ERP using xmlrpc. For some reason, it expects an extra level of nesting for its filters. If you look at the code, it looks like the developer is just nesting objects in a list for no reason, so a comment explaining that this is required with a link to the docs gives the reader context.
I think people who say "code should be self-explanatory" have not written complex systems which inevitably have peculiar behaviors and baffling quirks that you simply cannot explain without a comment.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Comments are needed, there’s no b&w here. Sometimes, for instance, you need a quirky crutch which is not obvious in terms of goals and/or mechanics (don’t ask me why, years of working for enterprise). If you work in a team you definitely need to let your peers know the reasoning. And that’s not the only case.
Needless to say you don’t have to annotate each variable and function, ideally the names and/or input/output types should be self-explanatory. But that’s just not always possible (not meaning we don’t need to strive for that). I’ll die on this hill 😅 as well as other JS/DOM warriors I believe.
Absolutely. For example, our groovy backend integrates with Odoo ERP using xmlrpc. For some reason, it expects an extra level of nesting for its filters. If you look at the code, it looks like the developer is just nesting objects in a list for no reason, so a comment explaining that this is required with a link to the docs gives the reader context.
I think people who say "code should be self-explanatory" have not written complex systems which inevitably have peculiar behaviors and baffling quirks that you simply cannot explain without a comment.