Page 1 of 1
LiveCode Readability and Comments
Posted: Wed Oct 16, 2013 3:21 pm
by CodeTRUCKER
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.
Re: LiveCode Readability and Comments
Posted: Wed Oct 16, 2013 3:57 pm
by dunbarx
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
Re: LiveCode Readability and Comments
Posted: Wed Oct 16, 2013 4:26 pm
by FourthWorld
It's possible to write spaghetti in any language, even LiveCode. Comments never hurt.
Re: LiveCode Readability and Comments
Posted: Wed Oct 16, 2013 5:30 pm
by jacque
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.
Re: LiveCode Readability and Comments
Posted: Wed Oct 16, 2013 6:23 pm
by edgore
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.
Re: LiveCode Readability and Comments
Posted: Tue Oct 22, 2013 5:07 pm
by CodeTRUCKER
Thank you all for commenting. I appreciate the help!