I worked at a place that had a rule - no comments - and I was very frustrated by that. You see I often used to write code by first writing a set of comment blocks, explaining in English what the code was (going) to do. I would actually be doing high level design as I wrote these comments and could then later "fill in" the empty spaces with real code, already thought through at a high abstract level.I know a few companies that have the policy that code should not be commented (except for standardized information at the top of each file), except as absolutely necessary (meaning that each comment has to be accepted during code review as being extremely valuable/important). When I first encountered that, I was quite taken aback. But the rationale actually makes sense, provided it is enforced during code reviews. Essentially, it adopts the position that code should be written so that it is sufficiently self-documenting, requiring very good use of variable and procedure names and structural organization that makes each code block's relevance to the task being performed extremely apparent. It zealously emphasizes readability over performance.
That place I worked at had first rate programmers, the interviews for the role took two days full time and most of the coders were high caliber (perhaps the most intelligent teams of programmers I've ever worked with) many were ex-Microsoft and had deep insights, part of the interview was a pair-programming session where I was paired up (seated right at his desk) with an experienced coder to work with him on a task I knew little about, the goal was to gauge my ability to adapt quickly to an unfamiliar problem (and even language) and constructively work with whomever I was paired with.
But I never enjoyed the work, the restriction on comments (among other things) was a drag for me because I felt (and still feel) that code can sometimes be unintelligible without some human level explanation or description. Writing code that is "obvious in intent" is a burden that can conflict with intelligibility.
Perhaps with AI we might reach a new level of sophistication where the comments too can be analyzed and issues called out by tools. For example an AI tool could easily detect that a block of code has changed fundamentally and report that the associated comment has not been changed, perhaps an INFO message or something.
So far as @Embededd is concerned I'd encourage him to write as many comments as he wants (after all they have zero influence over code behavior) since he's learning a lot of new stuff and restricting how he expresses his thoughts isn't helpful. Over time he can review his commenting style and adapt and improve, I've often written code with very wordy comments but later, once the code is stable, go back and review and rephrase the comments.
Last edited:
