Today I read an interesting post by Sam Atkinson about a few new Java coding conventions. One of his suggestions is to use zero comments. While I am not saying the idea per se is wrong I am suggesting to stay open for exceptions. Consider this:
// manage your api key at private static final String apiKey = "...";
I think we agree that hinting at where to manage the api key is sensible. Any developer maintaining this code may have to manage the key. But if we remove the comment we need to pass the info elsewhere. I doubt that we should name a variable
apiKeyCanBeManagedAtHttpWwwExampleCom. Should we?
This is a (slightly updated) repost of a piece I published on my blog Tommi’s Blog. I deleted the blog in the wake of the GDPR, so the original version is no longer available, or only through the WayBack Machine of the Internet Archive. Please note: code usually has not been updated, so language feature reflect the time the original post was written.