May 26th, 2011
In Technology
No Comments
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
Method names should explain your intentions
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.
One part of the “agile” philosophy that I really agree with is that methods should have names that reveal their intent. I like this anecdote:
Martin Fowler has a great test to see if his code is clear. He will write code using intention revealing names and straightforward logic but without comments and then give it to his wife to read. Martin Fowler’s wife is not a programmer but if she can get the gist of what’s going on by reading the names and seeing the basic layout he considers the code understandable. If she can’t figure out generally what’s going on in the code he will go back and rewrite it until it is clear.
That’s a good goal to aim for, that a non-programmer can roughly figure out what is going on, because if a non-programmer can roughly figure out what is going, then the programmer who needs to adjust your code in 6 months will have a much easier time.
Post external references
- 1
http://www.agilecooperative.com/2009/08/code-comments-good-or-bad/
February 8, 2022 9:33 am
From Michael S on How I recovered from Lyme Disease: I fasted for two weeks, no food, just water
"Did you have Bartonella, too? Seems it uses autogenesis..."