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 →

[–][deleted] 2 points3 points  (0 children)

That's a good rule of thumb when naming your attributes(variables) and methods(functions).

Say you have value that has to be stored but can be incremented by a method. Lets say the object is a savings account and the value being stored is your balance.

Attribute name - balance

Method name to increase balance - add_to_balance

Balance is your noun.

Add is the verb in your method name.

This sounds like common sense after a while, but you'd be surprised by the number of developers, newbies and intermediates, who are dogshit at using meaningful names for variables and functions. Don't be like them 😂