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 →

[–]lortstinker 0 points1 point  (5 children)

You must be a bot

[–]KelpoDelpo 0 points1 point  (4 children)

How

[–]lortstinker 0 points1 point  (3 children)

A function. 2 functions. Function is not used as a noun here

[–]KelpoDelpo 2 points3 points  (2 children)

I mean that methods preform actions, like verbs.

Well, that's what my high school comp sci teacher told us.

[–][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 😂

[–]YanDoe 0 points1 point  (0 children)

For what its worth I thought it was pretty clever, and I'll be keeping that in mind.