DEV Community

Discussion on: 10 golden rules for becoming a better programmer

Collapse
 
okolbay profile image
andrew

Give your methods a clear name for what they are going to do

I would put it “give your methods honest names for what they are doing”

even if this name will have “and” in it
like validateAndFormat()
this is the best todo hint for others (including future you) to split it.

I’ve seen so many method names like do() process() handle() doAction() and on half of occasions its because developer came up with a method too long and was confused by himself, how to name it. Probably trying to follow a rule that method name should be short, and its not possible to give a short name to something that has 500 LOC, such generic names are born. Really, it would be better to have a 128 chars long name, so that someone else could help )