Castlevania Dungeon Forums

Off Topic => Off Topic => Topic started by: TheouAegis on May 07, 2011, 10:57:14 AM

Title: What's the term for spacing computer code out?
Post by: TheouAegis on May 07, 2011, 10:57:14 AM
I heard someone use it in another forum, but forgot what the word was. In other words, say I have the following code:
Code: [Select]
for (i=0;i<10;i+=1){if x/16=i{y+=2;sprite_index=spr_fish;image_index=2;image_yscale=-1;flipped=true;}}What is the term for making it look like this instead:
Code: [Select]
for (i=0;i<10;i+=1)
{
     if x/16=i
     {
          y+=2;
          sprite_index=spr_fish;
          image_index=2;
          image_yscale=-1;
          flipped=true;
     }
}
Title: Re: What's the term for spacing computer code out?
Post by: Jorge D. Fuentes on May 07, 2011, 11:02:53 AM
Umm... indenting?
That's what comes to mind, but our resident programmers might know more about this.
Title: Re: What's the term for spacing computer code out?
Post by: Aridale on May 07, 2011, 07:45:14 PM
making it more human readable
Title: Re: What's the term for spacing computer code out?
Post by: TheouAegis on May 07, 2011, 09:49:35 PM
I. Am. Not. Human. But. Some. Day. Humans. May. Want. To. Read. My. Code. So. I. Want. To. Lower. My. Standards. To. Human. Levels.
Title: Re: What's the term for spacing computer code out?
Post by: uzo on May 07, 2011, 09:57:51 PM
Formatting I suppose would be the commonly used term. Though in itself formatting doesn't necessarily mean that style, or using those conventions, but its an accepted use of the word.

A common value convention is using capitals instead of '_'. Also by prefixing the value names with their types. Example;

image_index

would be

intImageIndex

Not sure if Game Maker specified between numbers though. In this case I would use int because it is an integer. Though I myself am guilty of leaving the type off, since I usually can tell by the wording, or looking at the class. In which case the above example gets changed to simply; imageIndex
Title: Re: What's the term for spacing computer code out?
Post by: TheouAegis on May 08, 2011, 09:01:52 AM
They started using integer specifications in GM8. I personally use '_' and capitals both. Like, spr_bat and obj_Bat to specify it's a sprite of a bat (minor code) or the actual object of the Bat (major code).
Title: Re: What's the term for spacing computer code out?
Post by: Aridale on May 08, 2011, 09:18:05 AM
yeah I do that too. I name em for their use like that too like for effect graphics I name em efx_whatever for the objects. For graphics tho its either spr_ or bg_ or ts_

I reminds me I really should work on my lil project today instead of sittin around watchin ncis
Title: Re: What's the term for spacing computer code out?
Post by: TheouAegis on May 09, 2011, 06:06:26 PM
Do both: one line per commercial break.

AND THAT'S WHY THERE'S NO CASTLEVANIA ENGINE v0.02 YET!!
 ;D
Title: Re: What's the term for spacing computer code out?
Post by: Aridale on May 09, 2011, 10:46:22 PM
that would work... if there were commercials...