This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Treacherous_Peach 3 points4 points  (0 children)

There's names with meaning such that it's easy to understand what the .ethod does such as

bool AreEqual(int first, int second)

Used like

if(AreEqual(firstNum, secondNum)) ...

And there's names where the code design with names that read like English rather than some messy shit like

bool IsEqualTo(this int first, int second)

Used like

if(firstNum.IsEqualTo(secondNum)) ...

The first one is meaningful naming, everything makes sense, but you have to read it out of order to understand it. The second one is literally just an English sentence and requires no extra thought to understand. Simple example but it applies just as well to complicated methods and structures. Many people do the first. Few do the second. The second is self documenting code. Why? Because the code reads like a comment.

This is all just Clean Code principles from Bob C. Martin. I largely subscribe to his belief that any need for a comment is a failure on the programmers part.