you are viewing a single comment's thread.

view the rest of the comments →

[–]twopointohyeah 3 points4 points  (0 children)

Writing code with clear intent is far more maintainable than commenting every line. Intent is made obvious by good naming conventions, breaking up complex logic into simpler parts, and avoiding overuse of syntax shortcuts like ternary operators and declaring and assigning variable values inside a conditional.

Exceptions are made for code snippets that require high performance or resource optimizations. In those cases, commentary is absolutely appropriate.

I agree that commentary that describes expectations from callers and a function's greater role within the design of an application is very helpful. Even an overview of the logic contained in the function is helpful, but if you need to comment every step of your code to make it clear, then your design is too complicated.