Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Comment Your Code Snippets!!! ... (Such a frustration!)

Author
Message
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 2nd May 2012 02:21 Edited at: 2nd May 2012 02:23
A lot of the time when I'm sifting through the forums I see questions being asked that are so vague, only a psychic would have a better chance. And then there's those that post a code snippet!!!

Why can't people format their code!?!?

Please will magazines, other website, even "TEACHERS" teach people how to indent their code... It's annoying...

Simple things like:

. Using the TAB, Indenting functions, loops, etc.

. Comments, comments, comments, comments (by the way more comments on large snippets)

IT REALLY IS THE DIFFERENCE BETWEEN THIS: (make NO difference about the language)
(from a piece of my own code)


And THIS:


DBP SNIPPETS are so much worse off without formatting...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 2nd May 2012 11:40
hahaha. Chill Winston! I must admit, I generally ignore all posts asking for help when the code isn't readable. It's not worth the effort. However, when these people go from dabbling to serious coding, and start to go insane dealing with their own chaos, they'll start making more use of comments and structure.

In the meantime, you can just give people a good talking to when they ask for help with rubbish code examples and get them to come back when they've sorted themselves out.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 2nd May 2012 12:06
Well, sometimes people just want to show off their code, they aren't necesserily trying to teach anyone anything, just showing an effect, or providing a function that people might not need to understand.

I mean, come on, it's DBPro - anyone with complex code tends to comment it, but most code snippets here are quite straightforward. It's a code snippet, a snippet of codes, it's not a tutorial. If people want to be vague, then it's all good - just so long as the code snippet is interesting. Sometimes it's fun to find code that you can't understand, seeing code like that which does something cool, makes you want to figure it out, and there's no better way than picking through code. If someone comments it, then you might not delve further. Like vectors, someone hasn't dealt with vectors before might find those commands pretty daunting - I think with those, it's better to take time to learn them properly, understand them, then take the code apart. This applies to things like memblocks, and vertex modifications especially - these aren't the kind of things that you would tend to rely on someone elses code for, it's much more beneficial to learn them properly. If the code is heavily commented, then it removes some of the mystique. Really the best thing a code snippet can achieve, is to encourage someone to learn how it's done.

Health, Ammo, and bacon and eggs!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd May 2012 14:56 Edited at: 2nd May 2012 15:00
When I first started coding I correctly aligned all of the code, and used a few REM's. But I found that after 32 years it was faster to use spaces than tabs. So my If / Endif are spaced. I can see them that way, and have got used to it. It's not as easy to see as tabs, but it is faster for Cut/Paste coding. My coding method is to write a line of code, and when I need something similar I Cut/Paste something similar, and quickly edit it. Cut/Pasting Tabs requires some Tab editing, and Backspace jumps all over the place, and your text is soon scrolled off the screen. What I would prefer in an editor rather than tabs is a IF ENDIF colour code system. No tabs just colours. So first nest Red, second nest BLUE, 3rd Nest Green. Maybe a palette to click at the side of the screen.

I Just think that Tabs create editing problems, and slow you down a lot.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd May 2012 15:14
Here's my spacing technique. It's easier to edit...




Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 2nd May 2012 17:24
Oh Pincho. WLGfx is going to go mental!!!

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 2nd May 2012 17:38
Pincho, you do realise it's faster to indent using tab than using space...

Just select the entire block of code you want to change the indentation of and press "tab" to indent or "shift+tab" to unindent. Why is that so difficult?

[b]
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd May 2012 18:07 Edited at: 2nd May 2012 18:15
I space downwards, not across. It has many benefits..

1/ Your code doesn't get scrolled off the side of the screen so easily.

2/ Copy/Paste is separated ready to be used.

3/ Copy/Paste doesn't require re-tabbing

4/ Text Selection works better without tabs.

5/ Editing lines of similar code...

If A = 1 Then
If A = 2 Then

Is vertical so you can just use the down arrow, which is really fast.

I think that Editors need something that doesn't use Tabs, maybe a 3D editor with layers would be good.

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 2nd May 2012 18:45
Pincho, that's a silly formatting habit you have.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 2nd May 2012 20:00
Quote: "1/ Your code doesn't get scrolled off the side of the screen so easily."


Just means you're either nesting too much or putting too much on each line.

Quote: "2/ Copy/Paste is separated ready to be used."

Quote: "3/ Copy/Paste doesn't require re-tabbing"


Copy/paste works with tabs too, you don't need to re-tab anything.

Quote: "4/ Text Selection works better without tabs"

How?

Quote: "5/ Editing lines of similar code..."

Why do you have code that consists of almost identical lines one after another? And in any case, for fast navigation there's home/end and the mouse.

[b]
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd May 2012 20:27 Edited at: 2nd May 2012 20:30
Your way already sounds more complicated. I've never used Home, or End in my life, and the mouse means that you have to look at the screen, whereas the arrow keys are like juggling your fingers.

lazerus
18
Years of Service
User Offline
Joined: 30th Apr 2008
Location:
Posted: 2nd May 2012 20:36
You fail 20% of the marking criteria if you dont comment your code at uni so they do teach it. As for indents? I OCD ALL THAT SHIZ. Bad habit/compulsion when you break the 1k mark aha !

Portfolio; Arthiccup.com
Lazerus Reborn on Polycount and a few other places.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd May 2012 21:18
I come from an age before college taught programming. I used the correct style for about 7 years, and then found that I could program faster without it.

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 2nd May 2012 21:44
I never use comments - except an emergency note. It's waste of time.

«It's the Shader, shader me this, shader me that»
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 2nd May 2012 22:11
Indenting and comments are all about code readability. There's nothing wrong with doing it in a way that feels faster to you, just so long as you don't expect anyone else to have to read/edit it.

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 2nd May 2012 22:22
Once i had a comment "and now calculating lighting and diffuse..." under a 300-characters line of math. Since then no comments

«It's the Shader, shader me this, shader me that»
Seppuku Arts
Moderator
21
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 2nd May 2012 22:32 Edited at: 2nd May 2012 22:37
What I would like to see in DBP or one of its IDEs is the ability to 'region' your code. Since trying it out in C#, I've found it great for dealing with large amounts of code. I know you can collapse stuff in DBP like types & functions, but being able to define and label the collapses I think would be great.

The way I tend to lay out my code in C# is like this.



This is only one part of the actual GUI code, but I'm not copying and pasting the entire thing. But you can imagine it's big bit of code and jump in to make edit would be time consuming if it's a massive wall of text especially when there's something specific you're looking for. I find laying out my code into regions allows me to collapse the bits I don't want to look at. And because you can have a region within a region, you only need to collapse the main bulks. In DBP (I use the Indigo editor) it's possible to do it to a degree - in fact, I tend to section my code out into functions, so that helps a lot. Plus functions can be reused so really if you're flexible with how your functions work you won't have to recode things.

Gosubs & gotos tend to bug me, but they can be good when used effectively.

The other way I lay out my code is to have multiple sources, each serving a purpose, in C# you're kind of pushed to do that anyway, but I do it in DBP anyway. The other thing I would note is naming conventions, keep them consistent and make them understandable. There's no point having a function like this:

n(1) = ActFunct(n1, n2, n3)

ActFunct = Action Function, all one could derive from a name like that is, "this does something" (okay, it's a little exaggerated) and with those variable names, it's impossible to work out what they're for. Perhaps, player(1) = VectorMove(x,y,z) would be more appropriate or something like that. I do hate looking at a function or a piece of code where the names are hard to figure out. Or where I've actually done it on old code - looking back thinking, "there's something I can salvage and reuse here" and you can't for the life of you remember what any of this stuff actually means so you're sat translating it command by command to yourself to suss out your own methods.

Not an issue with DBP, but those using DGDK or DGDK.NET may find it useful to use a capital letter at the start for a Public Variable and a lower case letter for a Private Variable because you can reuse your own labels.

Like:
Public String Title;
Private String title;

At least it's the method I seem to be practised in snippets I read and I find it useful myself.

[edit]
On the note of indenting, many languages will do it for you. Obviously you'll use the method that best suits you. But the Indigo IDE actually will auto indent for you, I find it quicker to code that way and makes it easier to read IMO.

puppyofkosh
19
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 2nd May 2012 23:09
Quote: "I never use comments - except an emergency note. It's waste of time.
"


Heh, you might change your mind in a few months when that code becomes "foreign" to your brain and you have to look at it again. I think it was someone on this forum who said something like: "It might as well have been written by another person [after that long]"
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 2nd May 2012 23:10 Edited at: 2nd May 2012 23:12
@Pincho - Deffo need to indent, but I'm not going mental yet as as Fallout said, he he, I'm looking forward to much to going away for a few days tomorrow so I'm in a good mood today...

Indentation and comments help me out a lot with debugging large sections of code. I cringe when I see snippets with everything cramped up. Often I pass by when I see snippets like that, but if I can help with something specific than I'll have to copy and paste and re-format everything. Grrr...

Most editors nowadays auto-indent for you, even Notepad++ does it. If anything DBP could do with using Notepad++.

Line spacing is a must between separate chunks of code. Block commenting groups of functions I always do if I throw everything into a single source file. Although most of the time when I work on a new section of code, it will go into it's own source file.

I'm not heavy as some are when it comes to commenting but enough to know where I'm at when I quickly scroll through my code. It'd be so much handier if the monitor was 40 inches downwards.

Just for you Pincho - Something a little easier to read... he he he


EDIT: Even years ago when everything was in just pure assembler on the Amiga and Atari I still commented and indented.

Quote: ""It might as well have been written by another person [after that long]""

I remember that too... The 6 months mark when it's all double dutch...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Kezzla
17
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 3rd May 2012 01:10 Edited at: 3rd May 2012 01:12
I use lots of comments, use vertical spacing like pincho(and indent too) I also heavily break up my code into functions and subroutines.
I know some people frown upon using too many subroutines and functions, but I like to make my main loop almost readable in plain english.

eg


that's just a pseudo loop but that's my main method.

I can easily see my general program flow and then if i want more detail i go to the correct chunk of code and then go through it.

my subroutines and functions are where I comment everything, I find if i don't indent my loops and if statements then i just plain miss them when i'm scanning for them, my eyes glaze straight over the keywords, I find the indents lock me onto the block more clearly.

Sometimes I like to use words out of contents
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 3rd May 2012 01:25
@Kezzla - That's the same way I do it. Everything gets split up into functions. Write code first, optimise later.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 3rd May 2012 02:18
That makes great sense. It's almost like creating your own programming language of sorts and using it to program!

Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 3rd May 2012 04:12 Edited at: 3rd May 2012 04:28
Quote: "I like to make my main loop almost readable in plain english."

I tried doing that, but I couldn't do it without unnecessarily abstracting out the functions and doing a lot of redundant function calls.

Here's what one of my main loops looks like(I use a finite-state machine for my game):


I usually only comment on the really tricky stuff, like quaternion rotation manipulation or to explain some doesn't-work-quite-as-expected-functions in the libraries I use.

Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 3rd May 2012 12:20
Quote: "I know some people frown upon using too many subroutines and functions, but I like to make my main loop almost readable in plain english."


Those people are stupid. You are right. Carry on. Obviously there is no hard and fast rule, but generally speaking, if a function is longer than a page/screen, it's too long. If you ever copy and paste something out of a function into another function, it's also too long and poorly organised. Keeping it granular like that is the way to go it mate!

@Sep - Nice comments mate. It'd be great for someone else to pick up and run with, but for you personally, with your nice sensible naming conventions, you'd probably be able to return to it in 6 months without half those comments.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd May 2012 14:26
Quote: "But I found that after 32 years it was faster to use spaces than tabs."


I find tabs totally confusing. If I want an extra bit of space I just type an extra space. If I type an extra space in a line containing tabs (which you can't see) then the text may or may not move along. Without tabs simple edits have the expected effect. With tabs present you just don't know where you are.

Whatever Diggsey says about cunning tricks with tabs I get totally lost when I'm trying to edit other people's code with tabs.

Spaces every time for me.

Returning to the main topic, often the first thing I ask people to do is to indent their code. It is very tiresome to be given 500 lines of unreadable code and to be asked "Why doesn't this work?". Comments in the code are pure luxury - often these same posts give you no clue what the non-working code is supposed to do if it were to work (PP are you listening? ).

But we do need to bear in mind that many forum members are new to coding and need help with this basic stuff (unlike PP ?).
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd May 2012 14:51 Edited at: 3rd May 2012 14:53
Well I don't post a missing Endif thread. I find that the compiler tells me where an Endif is missing. The longest I take over an indentation problem is about 1 minute in my code, because of the spaces. I've not found a problem that is due to indentation. Most of my problems are doing things that have never been done before.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd May 2012 19:28
Quote: "I've not found a problem that is due to indentation."


I'm not surprised . Such problems are indeed hard to find.

Perhaps other people trying to help you could help you more quickly if you did indent.
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 3rd May 2012 20:44 Edited at: 4th May 2012 03:00
Quote: "Not an issue with DBP, but those using DGDK or DGDK.NET may find it useful to use a capital letter at the start for a Public Variable and a lower case letter for a Private Variable because you can reuse your own labels."

I've actually found that using underscores as a prefix for private variables distinguishes between the private and public members fairly well.



versus



Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 4th May 2012 00:32
Quote: "I find tabs totally confusing. If I want an extra bit of space I just type an extra space. If I type an extra space in a line containing tabs (which you can't see) then the text may or may not move along. Without tabs simple edits have the expected effect. With tabs present you just don't know where you are."


The reason I like the tab key is because of tab and shift+tab for block indenting.

Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 4th May 2012 01:20
I always use two spaces as opposed to tabs....

wë¡·sEæ
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 4th May 2012 04:51
I use tabs here, since they are more flexible than spaces. You guys that use spaces are obviously just weird.



Support a charitable indie game project!
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 4th May 2012 05:36
Flexible? I tried bending mine but it didnt work.

wë¡·sEæ
ShaunRW
DBPro Developer
18
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 4th May 2012 05:53
In DBPro I use tabs, but when I use html,css & javascript I use spaces.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 4th May 2012 15:58
The default DBP editor uses spaces and the 'TAB' option is greyed out which is an annoyance. The Code::Blocks IDE has a handy code formatting plugin. Apart from that, it's mostly tabs I use. If only DBP and Visual Studio had code formatting plugins.

Now that monitors have a bigger resolution I always use a tab of 4 spaces but years ago when you had to use a TV it was 2 space tabs for C and 8 or more for asm.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 4th May 2012 19:57
Quote: "Now that monitors have a bigger resolution..."


I don't go higher than 1024,768 no matter what screen res my graphic card can use. All of my internet viewing is scaled up with the Ctrl key. My monitor is not widescreen either. So maybe that's why I avoid text scrolling off the edge, and avoid the use of Tabs.

Seppuku Arts
Moderator
21
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 4th May 2012 20:15
I don't think I could go back to 1024x768, when coding I'm usually using my 1920x1020 HDTV as a monitor. I think it would deffo explain why you're so concerned about the width. For 3D I find the high resolution helps too and the extended display means even more space, especially useful for reference images.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 4th May 2012 20:22
I've only just recently found out that in DBP you can use '...' to extend a command onto another line, where-as years ago in C you could use '\' or something, which is handy for reading a long command with lots of parameters. In C++ you can anyway, there's lots of long winded functions and the formatting comes in when on the line below you tab up to the previous parameter and fill out the rest so it's not confusing reading it as a new line.

If I was stuck with a low resolution then my tabs would only be 2 spaces but I would still use indenting for when there comes that 90% of the time debugging.

Widescreen monitors are handy for me now when it comes to a re-write of functions, using the split source window I can copy down a function to speed it up...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th May 2012 22:43
Quote: "The default DBP editor uses spaces and the 'TAB' option is greyed out which is an annoyance"


Not to me it isn't.

Quote: "I've only just recently found out that in DBP you can use '...' to extend a command onto another line"


I thought that went out with the old editor.
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th May 2012 15:20 Edited at: 10th May 2012 15:28
Holy crap-balls! I didn't even know you could tab and un-tab whole sections of code at once! I had to test it out. Thanks Diggsey! Maybe I will start using tabs again, I usually use a double space.

I absolutely HATE the DBP editor: you can't run a file on its own, it has to be part of the project open, so if you want to test something you have to close EVERYTHING else first! Also what the hell is up with the cursor in that editor? You change lines and it shoots to the end of the line instead of the same column position! So irritating that I use DarkEdit and then copy and paste into DBP only to run.

Does anyone have any solutions to those problems or can recommend a better editor for DBP?

Back on topic...

I have to disagree with Pincho: indentation is essential for me, I would miss so many errors and optimizations if I didn't indent.

What if you had an editor which automatically added indentation on-the-fly and you could toggle between the tabs effecting the position of the cursor, tabs being purely visual (the start of the line would begin with the first character) or no visible tabs at all. That would be a good compromise for Pincho as he could continue to use his style and even have it display as if indented (if that helps him) but then switch to tabbed mode when he is going to copy something for the rest of us to read. All the speed and all the tabbiness!

WARNING: The above comment may contain sarcasm.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th May 2012 15:50
I suppose the solution is for me to get a widescreen monitor, but that's a long way off yet.

Kezzla
17
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 10th May 2012 15:51
nah, i hate auto formatting. I turn off auto statement close and indent. it annoys me more than it helps me.

i wanna close my own statements and I can press tab for myself thank you very much. (we need a nose up in the air smiley)
I do agree with the idea of the cursor staying in its position when you move up and down. that would be nice.

Sometimes I like to use words out of contents
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th May 2012 15:54
Quote: "I do agree with the idea of the cursor staying in its position when you move up and down. that would be nice."


Well mine does, that's why I like my fast editing formatting.

Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th May 2012 16:02
Quote: "Well mine does, that's why I like my fast editing formatting."

How? I just tried with no indentation and it still jumps to the end of the line.

WARNING: The above comment may contain sarcasm.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th May 2012 16:17 Edited at: 10th May 2012 16:19
I don't know, but I am using the standard editor. I tried it with a Tab, and it still goes up/down properly.

Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th May 2012 16:22 Edited at: 10th May 2012 16:26
@Pincho
Hmmm... TO THE SETTINGS!

[edit]
I just remembered another extremely retarded feature of the default editor and that is the collapsible functions. What use is this feature if it completely hides the function? It should leave the first line visible so you know where the bally thing is!

WARNING: The above comment may contain sarcasm.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th May 2012 16:23 Edited at: 10th May 2012 16:24
I think that the editor was updated a few months ago. It fixed the loss of saved files.

Dazzag
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Cyprus
Posted: 11th May 2012 19:16
When we used to QA code back at work years ago you could fail for being too annotated. Some newbies would annotate anything just so that they don't get blamed for lack of annotation. When we used to have a 64k limit on programs that could get annoying fast.

A good example of failing QA because of too much annotation would be something like this:-
LET A=1 //Assign 1 to the variable A
FOR N=1 TO LEN(A$) STEP 2 //Loop through A$ two at a time
...etc..
NEXT N //Complete the loop
RETURN //Return to the main code

Honestly it was like they didn't know we could code or something (we taught them)....

Meh, back in the day (ie. about 1999 or 2000) I remember Dr Av giving me some DBC code for rolling 3D balls around (was quite complicated at the time) and he intentionlly (and didn't tell me) changed the code to be slightly incorrect. It didn't quite work and I had to debug it and test it quite a bit before I spotted the (very small) flaw. Annotation is like a spoiler! And programmers *never* need manuals!

But seriously, annotate the damn stuff just a little. Ta.

Cheers

Current fave quote : Cause you like musicians and I like people with boobs.
Jeku
Moderator
23
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 12th May 2012 22:12
The great thing about using tabs is you can set the tab spacing to any size you want in the editor. If you're on a team everyone can set their spacing and all the code will look good. With spacing that's not possible.


Senior Developer - CBS Interactive Music Group
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th May 2012 23:38
@Dazzag - The problem with newbies trying to annotate their code is that they learned from tutorials which understandably go into much more detail than is required for ordinary programs. This is one reason why it's important to look at other people's code not just tutorials.

But yes I find it kind of rude when people don't annotate their code. Why should I bother going through every single line to work out what you are trying to do when you could just write a few short words.

@Jeku - I find the editor forgets what I set my tab spacing to until I go back into settings.

WARNING: The above comment may contain sarcasm.
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 16th May 2012 18:36 Edited at: 16th May 2012 18:37
I had the pleasure of recently using Synergy (probably quite an older version since I haven't updated in a long time) and the whole spaces-instead-of-tabs thing is a huge pain in the rear. Every time you want to remove a level of indentation you have to tap backspace several times to remove each individual space, rather than just once per level. And I had to give up using the tab key after a while since it kept just placing a random amount of spaces. Hmm.



Support a charitable indie game project!

Login to post a reply

Server time is: 2026-07-21 18:55:24
Your offset time is: 2026-07-21 18:55:24