Scripting style: Verbs in function names

Bob Sneidar bobsneidar at iotecdigital.com
Fri Nov 4 20:13:25 CET 2016


Hmmm... interesting. Well for instance I have some contact functions and commands like addContact, updateContact, deleteContact, saveContact etc. and I use this regularly so getSomething() for my vote. The assumtion otherwise is that the value returned is the something you are trying to get. What if all you want is to know if the call succeeded or failed, and if failed, why? If the latter, then something() is itself misleading. 

Bob S


> On Nov 3, 2016, at 15:16 , Monte Goulding <monte at appisle.net> wrote:
> 
> Hi LiveCoders
> 
> In a PR I have open Peter has asked me to `Please name this function with a verb` and I recognised that in LiveCode this is something I don’t do out of habit while in other languages it is. Why? Because in the context the a function is used there is already a verb in the statement in our language. I definitely think verbs should be used for custom handler names though. It seems to me that if my gut feeling and what I’ve been practicing for a long time is seen as general best practice for the community then it should be documented.
> 
> I notice that there’s a mix of noun and verb engine functions.
> 
> What do people think:
> 
> put GetSomething() into container
> 
> or 
> 
> put Something() into container
> 
> BTW I’m happy to change my ways I’m just curious what people think.
> 
> Cheers
> 
> Monte
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list