Naming conventions

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Naming conventions

Post by anmldr » Thu Apr 16, 2020 12:16 am

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Naming conventions

Post by FourthWorld » Thu Apr 16, 2020 2:27 am

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Naming conventions

Post by dunbarx » Thu Apr 16, 2020 2:53 am

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

anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

[Solved} Re: Naming conventions

Post by anmldr » 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.

Thank you,
L

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: [Solved} Re: Naming conventions

Post by FourthWorld » Thu Apr 16, 2020 6:26 am

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply