Scripting style: Verbs in function names
Richard Gaskin
ambassador at fourthworld.com
Thu Nov 3 21:06:22 EDT 2016
Monte Goulding wrote:
> 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.
Many languages have only functions, so to describe any action you have
no choice but to use a verb in function names.
Pascal, xTalk, and others have both commands and functions, each with
its own semantic role.
Every statement must have a command, and may also contain one or more
function calls.
Since the command is the verb, it makes sense that a function would be a
noun, a thing that the verb acts on.
When in doubt, imagine you're in a meeting with some major industry
player and you want to show off the beautiful simplicity of LiveCode's
"English-like" nature - do you really want do show this?:
get getWindowList()
So much more elegant, so much more natural, so much more tTalk, to
simply write:
get WindowList()
--
Richard Gaskin
Fourth World Systems
Software Design and Development for Desktop, Mobile, and Web
____________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list