Most Efficient Symbol/Letter for Separating Text

Miscellaneous Forums/General Discussion/Most Efficient Symbol/Letter for Separating Text

From experiments with my keyboard, I have found that the letter m has a greater width than other normal symbols and letters. So, the letter m logically seems to be the most efficient "spacer" to use, i.e. good visible block of m's around comment text and/or code. Does anyone else have a better/more efficient "spacer"?

@ can do the trick depending on the font type used, although I normally use mono-spaced fonts whenever possible.

W
M

What about:

'LARGE'

I like that.

You would.

Why do it anyway?

I don't understand why lines of dashes aren't acceptable. I keep most of my code shorter than 80 columns of text to ensure that I can read it easily on any PC I use. I also use a monospaced font, so a - is the same as a m or w.

Bitstream Vera Sans Mono size 10.

What's wrong with using a space to seperate text? Compared too.

What'sMwrongMwithMusingMaMspaceMtoMseperateMtext?

What are you actually trying to space out?

I thought everyone used monospaced fonts in their IDEs. I know I always do.

Some people don't use mono spaced fonts in their IDE? Are they MAD?

; MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
; This code does something.
; MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

; WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
; This code does something.
; WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

; ---------------------------------------
; This code does something.
; ---------------------------------------

The last is clearly the most readable.


I guess if you want something more efficient than M and more readable, you could go with tilde:

; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; This code does something.
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For readable vertical separators (as per sswifts recommendation) :

; ----------------------------------------
; rhubarb
; ----------------------------------------

or for more emphasis :

; ========================================
; more important rhubarb
; ========================================

All monospaced fonts of course.

Not sure what exactly is meant by 'most efficient' ? Easy to type, read ? Energy efficient ? ( guess space would win that one )

Good Lord!

another alternative ..
; <><><><><><><><><><><><><><><><><><><><><><><><>
; <>                                            <>
; <>  Create_AAGame_at_once()                   <>
; <>                                            <>
; <><><><><><><><><><><><><><><><><><><><><><><><>


I preffer to navigate via the function tab rather than hunting through the source code window. I find I can generally remember what a function looks like onscreen so I just want to skip the IDE to that function as fast as possible.

To aid this I put false functions into my code and order my functions so...

function GAME_SETUP_____________()
end function
function init3D()
;code
end function
function createPlayer()
;code
end function
function PARTICLE_SYSTEM________()
end function
function createParticle()
;code
end function
function realtimeParticles()
;code
end function

I find comments just get in the way of reading the code, I rarely do any comments at all and when I do they're very succinct.

I go heavy on the comments to describe functions. I try to name variables in such a way that a top-to-bottom read of my code will actually tell you what is going on, without describing it all with comments.

I think my bitmap font code is a reasonably good example of where, and where not to comment (consider that it was always intended for public consumption).

This thread is a bit like those "How many [insert profession]s does it take to change a lightbulb?" jokes.
More time is being spent trying to decide what character to use, than would normally be spent just using anything.

I put false functions into my code and order my functions so...
Wouldn't it be easier on the program to use labels? (Like for Goto and such)

Why do you comment? Why write the code twice?

Because it looks more finished and official ... well that's why I do it. I do understand the 'do it as fast and efficient as possible' method but somehow it irritates me to not over complicate things ... I'm not quite sure why. Anyway, I see your point.

If you look here you can see what my code pretty much looks like ... although it's improved a lot since this was about 1.5 years ago.

Not much use in commenting code that reads like english by itself. Only comments I add now and then is for quick navigation through the source.

Only real comments I usually add in bmax is a small example on how to create an object, and how to use it. Tho even that is more of a luxury rather than something compulsary. Best way to code is -imho- by making the code so complete, modular and automated that everything runs by itself. Being lazy is good! Lazy programmers want their computer to do their work! :P

I've found that working with Torque this is usually true ... it's very good code and you never need to know how everything works to get part of it to work ... the ultimate definition of modular. However, that's already knowing how to program ... if any beginners are going to be following your code it's better to make sure it's taking baby steps that let them see the big picture.

Very usefull advice in this thread. SSwift, seeing the comparison, I agree that the dashes are much more readable. Sometimes I over-comment things just to instill in myself a better understanding of what I need to do next, because I'm a beginner going on a few years. In the future I'm going to try to leave out useless comments and make the code read easier by itself.

Thanks All!

Edit: I didn't know there was such a thing as mono-spaced fonts. I'm not that savvy I suppose, but now I know!

I agree with CS_TBL, there's no use in commenting code that is so easily readable. But at the same time, what the code is doing isn't always clear. Line-by-line, there's no point in having comments. But the big picture, that's where commenting is usually needed. You may be able to figure out that such-and-such code sorts out a list, for example, but what kind of order is it in? And why are we sorting it to begin with? Those kinds of comments are what's needed.

Even if code is designed to be modular, I still think the code must be commented. The comments will never be needed if the module works exactly how it's supposed to. But what if there are bugs, or if the module has to be modified to work with new problems? Comments in the code will definately help matters here.

Comments are there to be your friend, but you shouldn't over-do them, as they'll be more of a nuisance then. Everything in moderation. :)

I've always had trouble with the spacing on the IDE not being consistent :( I've learned to live with it but how do I go about setting up the default to one of these mono-space fonts?

Cheers
Stevie

I've always had trouble with the spacing on the IDE not being consistent :( I've learned to live with it but how do I go about setting up the default to one of these mono-space fonts?
Change the font to fixedsys (size 9).

Click here: http://www.dafont.com/download/?os=win&file=bitstream_vera_mono

Copy the font files to your font directory (Start->Control Panel->Fonts) and then configure your editor to use "Bitstream Vera Sans Mono". Looks beautiful and gets nicely anti-aliased (if you've got font smoothing switched on in Windows).

I found this font when it got installed by OpenOffice and now I can't go back to using non anti-aliased alternatives because they look so ugly :)

I use the font from blitz3d :P used it in blitz+, now use it in bmax again. Heck I even use that font in visual c++ :D

That Bitstream Vera Mono mentioned by VinylPusher is a pretty nice one... Especially since it gives a more distinctive look to some of the characters that can easily be mixed up, such as 1, I and l, or O and 0.

Great when mixing letters and numbers, like writing code.

@ VinyPusher,

I downloaded the Bitsteam Vera Sans Mono and changed the config file in the cfg directory to this.

Every time I save it though it just returns back to the original for some reason ( see below ) ??

font_editor blitz 12
font_tabs couriernew 12
font_debug couriernew 12

WTF is going on!!!?

Comments are there to be your friend, but you shouldn't over-do them, as they'll be more of a nuisance then. Everything in moderation.
True but the issue of comments 'getting in the way' could easily be resolved if the IDE would only allow comments to be hidden/folded. I asked for this feature ages ago, not that I expected to get it. :)

Rather than typing all those characters does anyone know
of a way to assign a key combination to insert them.
Not including ctrl-c ctrl-v

There need to be tutorials here on how to create modular code.. I see way too many ppl creating non-modular code, in the forum, in the code-archives. Strictly speaking, if it isn't modular I won't even use.
Tho I must say I've no exp with game-creating, only with app-creating.. dunno how good modularity applies @ games. And well, it *is* a bit of a game-community after all.. :D


halo (Posted 16 hours ago)
Why do you comment? Why write the code twice?



Okay smart guy, tell me what this does:

AniBOB_PositionX(ThisEnemy\BOB, -32, 200-32,  500, 3, 1, 0, False, 0)
AniBOB_PositionY(ThisEnemy\BOB, 500,    100, 1000, 0, 0, 0,  True, 0)


No idea? That's not surprising. Heck, I wrote that function and I couldn't even tell you what that line does exactly. Not without searching for the function and reading the names of the parameters.

But if I comment that line like so:
; AniBOB_Frame(BOB.BOB, Start_Frame, End_Frame, Anim_Time, Anim_Mode, Anim_Velocity, New_Image=0, Trigger_Delay=0, Free_BOB=False, StartAge=0)

   AniBOB_PositionX(ThisEnemy\BOB, -32, 200-32,  500, 3, 1, 0, False, 0)
   AniBOB_PositionY(ThisEnemy\BOB, 500,    100, 1000, 0, 0, 0,  True, 0)

Well now I have a lot more information. I'll still have to look up Anim_Time and Anim_Mode to see what they are six months from now, but right now at least I remember what the different values mean.

A better comment however would be the following, becayse while the above does show me what the function parameters mean, it doesn't tell me what that code DOES.
; AniBOB_Frame(BOB.BOB, Start_Frame, End_Frame, Anim_Time, Anim_Mode, Anim_Velocity, New_Image=0, Trigger_Delay=0, Free_BOB=False, StartAge=0)

; Make enemy follow a half circle path emerging from the left side of the screen.
   AniBOB_PositionX(ThisEnemy\BOB, -32, 200-32,  500, 3, 1, 0, False, 0)
   AniBOB_PositionY(ThisEnemy\BOB, 500,    100, 1000, 0, 0, 0,  True, 0)


Before every function definition, and occasionally for bits of code within functions, I throw a line of text such as sswift wrote in that last comment. Just seeing a line of code doesn't tell me what it does (in the high-level sense); for that I need some actual english.

I stick to a pretty strict convention with my functions. They all look like so:

;---------------------------------------
;description of what the function does
Function Name()
     code
End Function
;---------------------------------------


This way it's easy for me to visually focus on one function and ignore what's around it. Saying it's strict is misleading though; it's total habit so I never think about it or expend any extra effort. Also, I keep an empty example function at the bottom of my code so that I can just copy/paste it whenever I'm placing a new function, rather than having to write out that formatting every time.

Line-by-line, there's no point in having comments. But the big picture, that's where commenting is usually needed. You may be able to figure out that such-and-such code sorts out a list, for example, but... why are we sorting it to begin with? Those kinds of comments are what's needed.

I like that example. I believe I will steal it. A lot of people have difficulty grasping the notions of low-level and high-level.

In blitz+ you can highlight your own functions with that decl-trick-thingy .. that helps a bit.

Apart from that.. there's a discussion on how many arguements a function could have, without going to appear insane towards the user, and which workarounds there are for that.

Good example would be the panel from B+

A panel is: the panel, and a panelcolor.
Tho the panelcreation is: createpanel x,y,w,h,parent
And the panelcolor is: setpanelcolor panel,r,g,b

While you could as well make 1 function out of it: createpanel x,y,w,h,parent,r,g,b .. but you get a large function then..

Another way is to have 1 type as arguement and put all the junk into the type instance..

Don't turn this into a comment or not flamewar as we've had those before, suffice to say that many clever people don't Comment but many dumb people also don't comment. If you want a decent job in programming and don't want to get fired, LEARN TO COMMENT! PLus I personally find it 100% useful for all the reasons mentioned above and more.

Anyway I use

///////////////////////////////////
as a separator in Delphi because // means comments so it's easy to continue on.
In Blitz I use ;-------------------------------

but since I got protean with function folding I don't need to use anything as everything is all squished up! I just search (instead of scrolling) on the function names (named with the backwards/object naming convention) so I don't need any "fake" function ;-)

I use *, -, +, |, _ and just about any other non alphanumeric character. Depending on what I'm padding, I'll use a different character depending on the situation so there's some kind of visual cue as to what the padding relates to.

For expressions I like to pad it right out. e.g.

ant=((bull+cat)/(frog*goat)-dog)

becomes

ant = ( ( bull + cat ) / ( frog * goat ) - dog )

I tend to give each function/method/object the following comments:

- an overall description of what processing is done.
- a list of all input and output variables/data and what they do.
- a list of any dependencies on other variables/code and why.

Combine all that with sensible naming/spacing/indenting and hungarian notation.

There's books on this subject anyway. I find these methods work for me, but everyone has a different way of commenting. I think the most important thing with all commenting/layout/naming is finding a set of rules which work for you and then being consistant with using them.

I downloaded the Bitsteam Vera Sans Mono and changed the config file in the cfg directory to this.

Every time I save it though it just returns back to the original for some reason ( see below ) ??


Have you tried just going to File -> IDE Options -> Editor and setting the font through there?


Have you tried just going to File -> IDE Options -> Editor and setting the font through there?



I don't have that option within the IDE if that's what your talking about? I feel like a bit of a numpty here but this is getting kinda frustrating. Please help!!

Stevie