Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Everyone should read this.

wizzie Baldwin
Registered User
Join date: 23 May 2004
Posts: 52
08-07-2004 02:36
Hi everybody :-)

I'm fairly new to SL and LSL.
This is a long post, but I have a lot I want to say. I hope I won't offend anyone for being too wordy.

I've reading some posts in the scripting forums.
I've seen a lot of really good stuff, by some really talented and good hearted people.
Thanks to those who contribute some really stellar stuff.

I'm not going to name names .. I'm NOT trying to single any particular person or people out.
But, I am on the attack! hehe lol

My intention is not to make anyone mad. But I am sure that I'll more than ruffle a few feathers and
probably make everybody mad at me anyway :-(

These are a few of the various posts I have seen that concern / disturb me:

... If you strip out the comments there's like... 5 lines of code in there ...
... Could you please post it as 5 lines of code without all the comments? ...
... Comment-less version.
... For reasons of brevity, I have removed the comments ...

To all of you who wrote those or similar posts ....
SPANK! SPANK! SLAP! SCRATCH! CLAW! HISS! KICK! SMASH! STOMP! ETC.!
and ... that's just for starters! lol

What are you thinking when you post crap like that?

Duh... The first thing anyone learns in any programming language
(traditional "Hello World" excluded) is how to create comments.
So what does that mean?
Not to be harsh... BUT..., Anyone, even those with dim brains, with little
or no programming experience, can strip comments out of code and repost it.

So what have you accomplished there? Hmmm? Oh... I see. Yes! You, were able to
save the individual who is too PHUCKING ("Could you please post it as 5 lines of
code without all the comments? ";) lazy to take the comments out.

SHAME! SHAME! SHAME! SHAME! SHAME! ON YOU!

Not only do you discredit all of the other really good posters but you
encourage more people to post the same crap that you just did!

When you reply with a version that's stripped of comments you are not only
wasting everyones time, but you are also wasting space on the forum and
providing absolutely no, zero, nada, zip, diddly intellectual gain!
Any moron can strip comments. The only thing you folks are doing is serving
your own self serving purpose! Cause the only people you are edifying is
yourself (gee look at me I have 9 million posts - to bad most of them are
worthless pieces ofshit) and you edify anyone else at your level of LSL programming
skill and above. That's it!

Those of you who are too PHUCKING lazy to take the comments out yourself?
Why not IM the orignal poster to send you a comment-less version. Or else,
get a new life somewhere... maybe you could go to ah .. ummm.... "Third Life"
the avitar-less, speech-less, object-less, script-less, comment-less,
action-less game. You should feel right at home there.

OK... enough ranting and raving

MY UNDERSTADING IS:
THAT THIS IS SUPPOSED TO BE A LEARNING FORUM.

There should not be any reasons or cause for brevity, or anything else that
limits the use of comments in this forum! No one should feel like they bothering
someone if they put too many comments in (cept for the doofuss's that don't like em)
In fact all posts should be bloated with comments and instruction!

Many of you 'experts' seem to forget there are new people coming to SL every day.
Some with no programming experience at all... others having massive amounts
of programming experience .. just not LSL.

So let's just take me for example... I have massive amounts of programming experience
in Assembler (VAX, PC, WE3200), C, Objective C, Pascal, Ada, Fortran, Visual Basic, PHP,
Unix Shell, State Programming, a little Swish Script, some Flash .fla and lots of others)
all of this on various (Apple, Cray, Digital Equipment, Intel/Microsfot, Next, Silicon Graphics,
Sun Solaris, Auxpex and many more) platforms. I've slung a lot of code, probably as much as
any three or four of you folks combined. But that doesn't mean a darn thing when you are just
coming on board to a new development environment. The advantage I do have is I know how to program.
I still have to learn the envrionment, and grasp the subtle nuances of the languange and its
shortcomings and strengths.

Ok, so what does that mean for me? Well for starters, I am brand new to LSL. I understand the
C-like syntax so the decision, looping, function calling/creating, variable declarations
(local , global), etc are not a problem. Casting or using operators is not a problem.
States are not a problem. So many things are familiar yet there is a lot that is
unfamiliar to me. Some things that are not so clear.


The following is a heavily commented example in C with LSL/C++ style comments

CODE


// starting a line with "//" is a comment that will be ignored by the computer
// when it is processing the code or script.

// when this example program is run it will print out "The sum = 6"
// it is an illustration of how to create a global variable, a global function,
// a local variable and use them while processing the code/script.

// most statments end with a ";" semi colon
// some statements don't but we'll explain that if the occasion arises

int sum; // this declares a variable that is an integer
// It is a global variable which means it can
// be used by any function in the entire code / script..
// Another way to say it is that the variable is
// to the entire script or code.
// the reason it is global is because it is
// declared outside of a function. In this
// case it is declared outside of both the add()
// function that will be declared in the next
// programming statement and the main()
// function. Variables that are declared inside
// the { } curly braces of a function are called
// local variables to that particular function.

// Next we create a global function declared as type int.
// This means that the function returns a value that is an integer value.
// In this case the sum of two integer parameters passed to it.
// One parameter is a value assigned to a variable, the other
// parameter is a numeric value that is simply entered.
// This program accepts no external input so all of the
// values are assigned by the programmer.

// we don't put a semi-colon here because the language syntax dictates that when you are
// creating a function you don't use a semi-colon.
// You do however use a semi-colon in most circumstances to call the function.
int add(int a, int b) // declare a function that has to parameter arguments of type int
{ //each function has a beginning brace and an ending brace
return (a+b); // return the sum of the passed variables
}

main() // This is the start of the program.
{
int x; // this declares a Local integer variable x,
// this variable's scope or visibility is limited only to the main() function.
x = 3; // assigns the new value of x to be equal to the number 3.

sum = add(x,3); // the new value of sum will be the result of what
// is returned from the add function
// the add function could have been called
// using just numbers like sum = add(3,4);
// or with just variables. sum = add(num1,num2)

// we use printf to display the value of sum.
// What is enclosed in quotes will be printed out.
// The %d is a place holder for an integer parameter
// The '\n' means that after the value of "sum" is printed start a new line
printf("The sum = %d\n",sum);
}// end of program



The example is heavily commented, but, for someone who knows another language that is
NOT C, or if they are just beginning to program, he/she will have a little more
understanding of what they are looking at.

Here's why I like comments. There are a lot of questions I have that are not explained
very well in the Linden documentation and very rarely to any great extent in the forums.

Just one example... The permissions stuff is a little confusing to me. I was at an SL club
the other day. In order to dance I had to touch some object. I pressed this gadget to
start the dance animation. After I pressed the thing, a blue Yes/No dialog box came up and asked
if I wanted to give permission to dance.

So, how is that different then when I sit on an object that animates me to lie down on a bed.
I never got asked if it could animate me for that. Why is that? How come the bed didn't ask
me if it was ok to lie down?

What about pushing? You don't need permissions to create a gadget that will
push another avatar into the next century lol so for me there's still some confusion.

I understand the basic principle of permissions in that there's a variable that has bits set
(OR'd together) that indicate what permissions are available. But, I have not found any really
good documentation that describes how, why,when these are set when they have to be used or not
be used. I've seen lots of code examples, but very little explaining the WHY.

How do you know when and why and how the permissions are going to work for any given situation?
This is a place where comments would be real helpful when those kinds of functions are being used
to explain not only what but also why. Why sometimes you have to ask for permissions and sometimes
you can just push someone 100m meters if they get too close to a radar/sensor gadget.
I built one of those. (need to put in the code fix so it will quit pushing me. lol)

None of this LSL stuff would be the least bit tricky if the Lindens had a little more code examples
and some better documentation (like the legal ranges that variables can have in their function calls.
Ever look at the llParticleSystem function? It tells you that PSYS_SRC_BURST_SPEED_MAX is a float
and that's it! I like to know what the ranges of the different parameters are. Knowing those, you
almost visualize after a few test runs what you are going to get and what to not use so you don't bomb.

For those of you who wish to continue with the crappy comment-less junk posts that are of little
value to a true learning forum then I suggest you create a comment-less, advanced, privileged,
not-very-enlightening-for-very-many super advanced forum for yourselves.
Then the 2 to 3 of you "super" wizards can get together and post comment-less code to your hearts content.

For those wonderful people who are kind enough to take the time to post examples that are heavily
commented, creating superb informative examples, sharing your expertise for the benefit of all.
I am sure I am not alone whe I say I can't thank you enough. You have my undying respect and gratitude.

Please continue doing as you are doing and for me, I'll say, you can never have enough coments. lol

Oh and please ... completely ignore those worthless (comment-less wonders) who do absolutely
nothing with respect to furthering the scripting craft as a whole. Just tell them if they want
comment-less code go to the comment-less scripting forum.


With all that being said:

Here's my challange to improve the overall quality of this forum.

If you are going to take the time to share some knowledge that you have worked hard to get and feel
good about sharing, then why not post a heavily commented, well crafted, informative post:
- that describes what it is you are doing ,
- why it is done a particluar way ,
- or if it can be done another way,
- and several clear and consise examples that give a step by step approach of
how to implement the code ... A recipe ... something along the lines of:
OK first you create object A and place it so and so
Then you create object B and put this script in it.
Next you start it by ... etc.
- that indicates why, or where you would use what you are illustrating
if it's not obvious.

Teaching is the absolute best form of learning there is. Don't assume that a potential reader knows
anything at all. You really have to know your stuff very deeply in order to explain it to someone that
has little or no understanding of what it is you are tyring to explain.

Don't fall into the trap thinking that if you are explaing something in a kindergarten way that you are
being condesending. The gurus will look past the post if they already understand it or they may find
something new, something they have forgotten within it. The more detail you can put, the more
understandable you make it the better it will be received by all.

Think about what you want to present. The intended audience, if it's advanced say so and go with it.
That does not mean you should put any less comments in it. But imagine how well received your post
would be if you could take a NOOB and explain channels well enough for them to create say three little
balls that communicated with each other and the owner in a tidy package that had all the information
and step by step how to's to pull that off. The hall of fame is just around the corner. lol

Why I feel this is so important? Unfortunately, I only get about 5 to 15 hours of SL play time each week.
Very little of that is devoted to scripting because I am interacting with people (my friends) and
still learning about the SL world. There's a lot to see and do here.

So when I search the forums for some solutions to things that I am working on I really appreciate it
when I find an answer that is clear and understandable so that I don't have to spend hours digging and
searching. It just makes my experience that much more enjoyable in that the few hours I have are quatlity
hours which makes me appreciate the efforts of anyone who takes the time to post all the more.
Years ago I was consumed with programming, it was all I lived for. I couldn't get enough and if I
was in that frame of mind now, I would spend all of my time in SL scripting, but that's not as important
to me as it used to be. So I'm grateful to those who do have the scripting bug and are willing to share.

Soon, I hope to connect some more dots on this LSL and contribute some specific stuff myself.

I'm currently putting together the materials for a beginning non-language specific course for programming,
the concepts of variables, problem solving, structure, iteration, decisions, states, program flow and
logic can be applied to any language including LSL. I hope I can swing enough time and energy to get that project off the ground and finished.

Many regards,

wizzie :)
Loki Pico
Registered User
Join date: 20 Jun 2003
Posts: 1,938
08-07-2004 03:03
From: someone
wizzie said...
I'm currently putting together the materials for a beginning non-language specific course for programming,
the concepts of variables, problem solving, structure, iteration, decisions, states, program flow and
logic can be applied to any language including LSL. I hope I can swing enough time and energy to get that project off the ground and finished.


I dont script at all, just edit some existing ones that allow mod. I dont really have a strong desire to learn script from scratch, but if presented in a manner that is easy to understand, I might make an effort someday. I hope you do find the time to prepare a good tutorial, there cant be too many resources available.

Perhaps these are a couple of reasons for less comments. Just speculation, however. I always suspect that the SL scripters are usually pretty busy. They assume that if specific questions are asked, they assume the questioner knows enough about whats going on to understanding the reasoning. And, good scripting skills can be highly profitable in SL, its in their best interests to not just hand over the tricks they have learned through their hard work.

Welcome to SL, I hope you have a good time learning the lsl and teaching what you learn to those that desire the knowledge. And, just in case you havent seen it yet, this address is the premier resource for the lsl. www.badgeometry.com/wiki

PS. As I stated, I am not a scripter. My assumptions are not meant to offend anyone.
_____________________
Adam Zaius
Deus
Join date: 9 Jan 2004
Posts: 1,483
08-07-2004 04:49
Commenting is not always beneficial, it depends on your target audience; if your audience has prior experience; they dont want to be ridiculued with inane comments; the best comments are concise and to-the-point, addressing _only the function concerned_.

Overcommenting can make your code harder to read, and certainly significantly longer.

If you are aiming at a new-to-programming target; then by all means, put comment-to-code line ratio's greater than one, but if you are programming something with a clear distinct purpose, that is clearly aimed at an experienced coder, then you are hindering the programmer's progress more than anything else. :)

-Adam
_____________________
Co-Founder / Lead Developer
GigasSecondServer
Misnomer Jones
3 is the magic number
Join date: 27 Jan 2003
Posts: 1,800
08-07-2004 12:45
As someone who knows very very little about LSL, I appreciate commented scripts. They help me learn.
_____________________
Jack Digeridoo
machinimaniac
Join date: 29 Jul 2003
Posts: 1,170
08-07-2004 13:21
read the source luke.
_____________________
If you'll excuse me, it's, it's time to make the world safe for democracy.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
08-07-2004 13:46
Dude, for god's sake, LSL is SIMPLE.
I don't have the mountain of experience you mentioned and I could learn it just fine on my own. Heck, Christopher Omega is one of the best scripters in SL and he had never typed a single line of code before arriving on SL.
If you have problems with LSL, check the wiki: www.badgeometry.com
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
Too long, didn't read
08-08-2004 01:22
From: someone
Originally posted by wizzie Baldwin
diatribe

ZZZZZZZZZZZZZ
Paradigm Brodsky
Hmmm, How do I set this?
Join date: 28 Apr 2004
Posts: 206
08-08-2004 03:07
LSL simple?? heh, I guess it depends on how much you like to chalenge yourself.

I comment everything. My scripts may be sold to people or given away, or just stored away for months. I don't want to have to reverse engeener my own work. That's just not smart. If you want to be a good coder, you will learn to comment it's that simple. Or else enjoy deciphering your chicken scratch code months from now, or and try to remember why you did something the way you did before you *fix* it so that it stops working. lol

And that's my 2 cents on the subject. If you don't agree yet, you will.
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
08-08-2004 07:51
What Huns Said.
_____________________
Darko Cellardoor
Cannabinoid Addict
Join date: 10 Nov 2003
Posts: 1,307
08-08-2004 07:55
what huns said. that is a freakin novel!

ya and what my man hank said! :D
_____________________
Francis Chung
This sentence no verb.
Join date: 22 Sep 2003
Posts: 918
Re: Everyone should read this.
08-08-2004 11:17
From: someone
Originally posted by wizzie Baldwin

x = 3; // assigns the new value of x to be equal to the number 3.



I got confused. Is this supposed to be an example of what to do, or what not to do?
_____________________
--
~If you lived here, you would be home by now~
Grim Lupis
Dark Wolf
Join date: 11 Jul 2003
Posts: 762
08-08-2004 11:39
dude, there's a bug in your code!

And I didn't even have to read the comments to spot it. I didn't read any of the comments, except the one Francis quoted.

Have you ever heard of eXtrame programming? Or the concept of self-documenting code?

I'm an RL programmer. I don't comment my code unless I'm implementing a concept/logic set that I think another programmer on my team might not be able to grasp from the (self-documenting) code. Or if it's so complex that I'm not sure I'd remember what I was doing if I came back to look at it a year later.

For me, excessive comments just make the code harder to read.
_____________________
Grim

"God only made a few perfect heads, the rest of them he put hair on." -- Unknown
Adam Zaius
Deus
Join date: 9 Jan 2004
Posts: 1,483
Re: Re: Everyone should read this.
08-08-2004 11:54
From: someone
Originally posted by Francis Chung
I got confused. Is this supposed to be an example of what to do, or what not to do?


Francis;
If you did that, I would have no choice but to find my preffered mechanism for distrobuting clue, and employ it. :)
_____________________
Co-Founder / Lead Developer
GigasSecondServer
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
08-08-2004 13:02
Wizzie, Id really like to see an example of the posts you are describing. I commonly comment my code, but not to the point of it becoming an essay.

If a person feels that they do not understand parts of the code, the wiki is there to help them. LSL is composed of a small number of different parts, if you focus on one script, and have the wiki at hand, Im sure it can be understood. Plus, a good number of scripters in world can offer assistance to those who need it, realtime.
==Chris
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
08-08-2004 22:35
I have decided that this thread is actually a brilliant troll, designed to support the notion that you shouldn't ramble on and on.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
08-08-2004 23:02
but i like writing scripts i have to reverse engineer :p

I'm hoping someone will run another obfuscated programing contest. I'm hoping to win. I've developed a library of very bad programing techniques for LSL. :D
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
08-09-2004 00:50
Concise comments good.

good: change=paid-price; // get correct change

bad: change=paid-price; // You need to get the correct change and so how you do this is take the amount that the person has paid and subtract the price of the item they are buying and there you go.

Diatribes bad.

If you don't like comments, I suggest:
1. Getting an editor that allows you to minimize / not show the comments.
2. Take 1 minute and write a script that will read a text file and spit out a text file without commented lines.

While we're at it, how about people start using pre and post conditions so that their code is less buggy? Thanks!

-Hiro Pendragon
Serving SL from Varney 200,200
Apotheus Silverman
I write code.
Join date: 17 Nov 2003
Posts: 416
08-09-2004 10:59
This thread is pointless.

Those who prefer no comments whatsoever will remain at the bottom of the newbie pile and will continue to think they're l33t. Maybe someday they'll understand, but don't hold your breath. (1)

Those who write a book of comments for each line should go write a book and get published. (2)

Coding standards sets cover how and when to comment for a reason. Go get some standards if you don't understand why or why not to comment any particular line/block/whatever.



1) Sure, there are some awesome coders who don't comment. Lack of comments, especially in larger projects, invariably leads to bugs and inefficiency when said project is in maintenance mode. If the project is large and/or complex enough, said bugs and inefficiencies show up in the last 3rd of initial development and cause no end of nightmares.

2) I generally don't bother with books. They're too long-winded. Give me a concise reference and I'm set.
_____________________
Apotheus Silverman
Shop SL on the web - SLExchange.com

Visit Abbotts Aerodrome for gobs of flying fun.
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
Re: Everyone should read this.
08-09-2004 14:02
From: someone
Originally posted by wizzie Baldwin
I've slung a lot of code, probably as much as any three or four of you folks combined.

Welcome to these forums wizzie, I have a feeling you'll do just fine here.
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
Re: Re: Everyone should read this.
08-09-2004 14:16
From: someone
Originally posted by Wednesday Grimm
Welcome to these forums wizzie, I have a feeling you'll do just fine here.
I like your sig :)
Bosozoku Kato
insurrectionist midget
Join date: 16 Jun 2003
Posts: 452
08-10-2004 06:10
Quick someone thumb-tack this post for future referenc to.. umm I dunno, I didn't read it, it was long.

I did read francis' post, and huns' too! They were short.

Comment however you want. Then we'll use LSL's editor's Replace feature to.. oh nevermind.

Boso
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
08-10-2004 07:24
From: someone
Originally posted by Bosozoku Kato
Comment however you want. Then we'll use LSL's editor's Replace feature to.. oh nevermind.


Do people still use the built-in editor? That's so quaint! :)

Anyway, I don't know if I've misunderstood what you're getting at, Wizzie, but I have to say, I really don't feel that those are terribly productive comments for anyone but the very greenest of newbies. If I post my code, soliciting feedback or offering advice, I'm not going to comment what each variable does. If the code itself isn't readable, or the function can't be discerned at a glance, THEN comments are necessary.

If I want to teach someone the basics of programming, I'll do that. I don't see why 10 lines of comments for every line of practical code I write makes my script or program better. It doesn't seem really practical to me.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Wraith Jensen
I can walk thru walls....
Join date: 8 Aug 2004
Posts: 130
08-10-2004 08:23
While a bit overstated, I think the comments (no pun intended) presented here are valid.

When writing code that I have to go back and fix later, I often wonder what I was thinking when I wrote it. I'll sit there and scratch my head for 5 minutes or so, then remember what I was trying to do. A short comment helps that. It doesn't help that I have a short memory.

I think the main point that the original post was trying to make is that some people take a posted script, strip all the comments out, and re-post the script in a new thread, then say "see what I did? neat!". Not neat. All you did was add clutter to the forum.

I've been an avid BBS and forum user for about 17 years. I can reasonably say that I know more about netequiette (except how to spell it) than just about anybody that's likely to post here. Its ALL our responsibility to keep the forums free of clutter, and this starts with not simply re-posting someone else's work unless we're genuinely adding somethimg new that deserves attention.
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
08-10-2004 08:54
I am going to tell you a big secret about computer programming. You have to promise not to tell anyone, ready? Here it is:

Programs are not for computers to read, they are for people to read. Computers read assembly and byte code. People read source code.

Keep this in mind, and you'll be fine.
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Codswallop Cassidy
Registered User
Join date: 30 Dec 2003
Posts: 53
08-11-2004 11:41
I think Wizzie is onto something here and I agree with him. Ive seen some amazing things done by new-to-programming newbies as opposed to programming newbies. Ive seen someone declare variables twice "just to make sure the computer gets it". Ive seen someone try and give names to every line of code to reference it. (and they never touched basic before :D ). This is a pretty good example actually of someone who never knew about functions, methods, subroutines but actually was thinking ahead in a different kind of way if misdirected :) (non programmer type initially).

A lot of programmers, especially the "elite" ones tend to assume that a lot of people will have come in through a computer science background, and they also forget about their own which makes it easier for them to learn straight away without comments.

Another factor might be due to lack of interaction with non-programmer types so you can't see what they might possibly do or more importantly why. SL is not programming school (not officially) and they provide a reference but not the means to teach it. By teaching I don't mean learn the API but actually teach programming theory so people can actually understand how to put together scripts from scratch, especially the how's and why's. Like I said people trying to "learn on their own" without this background will be hopelessly lost so the best thing we can do for a learning forum is to provide clearer comments and otherwise, follow Wizzie's suggestions :)
1 2