DEV Community

Discussion on: When do you create a function or method?

Collapse
 
andrewlucker profile image
Andrew Lucker

I create methods if they make sense as a verb:

"send the file to the user when they specify the file to be sent" send, specify, when? stuff like that.

FactoryFactoryRefactorFactoryDetractor... no.

Collapse
 
codevault profile image
Sergiu Mureşan

Interesting take on it. I always think you should start the name of the function with a verb but didn't take it that far. It does sound reasonable.

I'm sure there was a post about Factory/Manager/Something-er classes on here... can't find it at the moment.