LiveCode Readability and Comments

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
CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

LiveCode Readability and Comments

Post by CodeTRUCKER » Wed Oct 16, 2013 3:21 pm

Many moons ago (Assembler, PL1, COBOL, CICS, C, C++, etc.) it was common practice and sheer survival to make verbose and frequent use of comments in the code. Given the way LiveCode writes/reads in the Scripts, is commenting still necessary?

I realize this is somewhat subjective, but I am only involved in very simple coding at present. I am curious as to whether future, more mature coding will require comments amongst the code. I hope this makes sense?

Thanks.
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

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

Re: LiveCode Readability and Comments

Post by dunbarx » Wed Oct 16, 2013 3:57 pm

I am sloppy and stingy with comments. I always regret it, as I forget what I intended every four lines of code.

In HC days, when there were limits to the length of a script (since it was based on textEdit at that time, 30K) I tried to save as much verbiage as possible. This is no longer an excuse.

But I would LOVE to be able to have comments in a "sticky" or textTool-like way, that does not extend the length of a line of code or use up adjacent lines, still a hassle.

Craig Newman

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

Re: LiveCode Readability and Comments

Post by FourthWorld » Wed Oct 16, 2013 4:26 pm

It's possible to write spaghetti in any language, even LiveCode. Comments never hurt.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: LiveCode Readability and Comments

Post by jacque » Wed Oct 16, 2013 5:30 pm

I comment extensively on everything but the most elementary scripts. In complicated projects I add a few lines at the top of each handler that notes what other handlers call this one, and what should be contained in each parameter. That makes it easy to see how things link up and what the order of execution is. Some people go all-out on those headers but mine are minimal. I don't bother for simple or obvious things.

I also use comments to mark handlers or lines that need further attention. I use a unique string for that which is instantly recognizeable and easily searchable ("--###").

Even though LiveCode scripts are easy to read, it isn't always obvious later why you did something a particular way. So my comments serve as a kind of notepad too.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

edgore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 197
Joined: Wed Jun 14, 2006 8:40 pm

Re: LiveCode Readability and Comments

Post by edgore » Wed Oct 16, 2013 6:23 pm

In my own experience Livecode is readable enough to figure out *what* I am doing, but I still need a lot of comments to explain *why* I am doing it. A lot of the stuff that I write involves taking data from external sources and massaging it, so I find that I need a lot of comments to prod me into remembering why I wrote something (usually it's to make up for some deficiency in my inputs...).

At a very minimum I try to comment each code section enough to at least understand the purpose of the section. If nothing else, it provide context for those that will come along after I get hit by a bus and have to convert everything I've done over to Java or something.

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

Re: LiveCode Readability and Comments

Post by CodeTRUCKER » Tue Oct 22, 2013 5:07 pm

Thank you all for commenting. I appreciate the help!
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

Post Reply