For all of your programming needs and wants.

  • Post new topic
  • Reply to topic

Programming style

Share

SoulRed12
Moderator
Moderator

Posts: 129
Join date: 2009-05-08
Age: 19
Location: West-coast USA

Programming style

Post by SoulRed12 on 11/3/2009, 2:44 pm

What's your programming style?

i.e., describe how you format your code. Do you comment a lot, not enough, indent using two spaces or the tab key, put curly braces on their own line, etc.

When I program, I kind of mix and match...I'll put curly braces on their own line, for example, except when I'm getting impatient and I just stack all the statements inside the condition/loop/whatever on one line and surround them with the braces on the same line. Also makes it look neater IMO when you have multiple statements inside both parts of an if/else construction. For example,

Code:
if (this)
{
  Do this
  Do that
}

if (that) {Do this; do that;}
else {Do something; do another thing;}

Tirade
Stranger
Stranger

Posts: 11
Join date: 2009-10-30

Re: Programming style

Post by Tirade on 11/3/2009, 6:42 pm

My style is alot like yours, but I often forget to use semicolons.

Vivi_IX
Stranger
Stranger

Posts: 36
Join date: 2009-11-04
Age: 19
Location: USA: Painesville, Ohio

Re: Programming style

Post by Vivi_IX on 11/3/2009, 10:17 pm

I could never bring myself to puting the actions on the same line of a condition. There's nothing wronge with it, it just dosn't seem right to me though. I always put semi-collens after action. I tab to indent. If I know what I am doing I don't really comment, but if I am just learning something difficult I'll comment the hell out of it!

Code:

//Some sort of greeting message
draw_set_color(c_white);
draw_set_alpha(1.0);

draw_text(5,5,"Hello everyone");

if reputation < reputation.other
{show_message("You are my superior.");}
else
{
show_message("I'm cooler than you :P");
reputation.other -= 10;
}

dixee
Moderator
Moderator

Posts: 127
Join date: 2009-10-27
Age: 18
Location: Orange County

Re: Programming style

Post by dixee on 11/6/2009, 1:50 am

I don't comment a whole lot. Only when I have long scripts and it helps break it up (for instance, all the different attributes of player control get a label in the character's step event).

Something like this:

// I don't like to use '/*' and '*/' for comments

if keyboard_check_pressed(vk_up) and pos==0 {
__vspd=-8;
__pos=1;
} else if keyboard_check_pressed(vk_up) and pos==1 {
__pos=2;
__vspd=-6;
__if place_meeting(x,y-1,obj_wall) {
____vspd=8;
__}
}


Last edited by dixee on 11/10/2009, 3:32 pm; edited 1 time in total


_____________________
♥ ♥ ♥

Mars
New Member
New Member

Posts: 59
Join date: 2009-11-08
Age: 21
Location: Alaska

Re: Programming style

Post by Mars on 11/10/2009, 11:15 am

I'm awesome, I use drag and drop.
Cool

dixee
Moderator
Moderator

Posts: 127
Join date: 2009-10-27
Age: 18
Location: Orange County

Re: Programming style

Post by dixee on 11/10/2009, 3:31 pm

Mars001 wrote:I'm awesome, I use drag and drop.
Cool


_____________________
♥ ♥ ♥
  • Post new topic
  • Reply to topic

Current date/time is 11/24/2009, 10:57 pm