Page 1 of 1
Naming conventions
Posted: Thu Apr 16, 2020 12:16 am
by anmldr
I have been a "newbie" for a lot of years. I get started, then for some reason, I start other things besides programming again.
So, I am starting over during these stay at home times.
Can someone point me to a discussion or article about naming conventions that people use in LiveCode. i.e. calling a button something like "btnNext" or for local variables "varMyVariable", or global variables "gVar". I know that I can create my own but it makes more sense for me to not reinvent.
Thanks,
Linda
Re: Naming conventions
Posted: Thu Apr 16, 2020 2:27 am
by FourthWorld
This document covers the most commonly used conventions in our community, with some of the background behind them:
http://fourthworld.com/embassy/articles ... style.html
Please reply if there's anything you're looking for not covered there.
Re: Naming conventions
Posted: Thu Apr 16, 2020 2:53 am
by dunbarx
Hi.
What Richard said. But in the end, you have to weigh what floats your boat, versus a convention that might be more familiar to others to whom you might send your scripts. There is an advantage to the "common" language for sure, when you share code.
I do about half. There can be enormous advantages to naming a button, say, "btn34" (do you see why?). Much depends on what you are up to. In the end, though, you should adopt a consistent schema; it will help you read your own code down the road.
Craig
[Solved} Re: Naming conventions
Posted: Thu Apr 16, 2020 6:20 am
by anmldr
I was looking for theory and besides the link above, I found answers under "Tips for Writing Good Code" of the User Guide.
Thank you,
L
Re: [Solved} Re: Naming conventions
Posted: Thu Apr 16, 2020 6:26 am
by FourthWorld
anmldr wrote: ↑Thu Apr 16, 2020 6:20 am
I was looking for theory and besides the link above, I found answers under "Tips for Writing Good Code" of the User Guide.
Thanks for that feedback, Linda. The team works hard on the docs, and the community has been helping out. It's especially useful to learn of cases like yours to see how it was able to meet a specific need well.