If you start working on a development project

Hyperblaze

Lifer
May 31, 2001
10,027
1
81
And the person before you coded a very different style then the way you do, do you....

1) Match his or her style as much as you can to keep the flow going?

or

2) Code your own style because it makes the most sense to you, making the development go faster, but at the same time, the project will have two entirely different styles embedded.

 

brandonb

Diamond Member
Oct 17, 2006
3,731
2
0
I try to keep it consistant with what was in the program already even if I don't like the style.

But most places I've worked have standards so its always pretty much similar to begin with.
 

fleshconsumed

Diamond Member
Feb 21, 2002
6,486
2,363
136
Depends on the company policy. If no policy is in place, or they let me do whatever I want, I code my style, i.e.

private void foo(int x)
{
....if(x==1)
....{
.........dostuff1();
....}
....else
....{
.........dostuff2();
....}
}


With proper indentation of course in case forum fvsks it up.

EDIT replaced spaces with dots.

I really hate old school

function foo(int x){
}

Decreases readability tenfold all for saving one line.
 

imported_Devine

Golden Member
Oct 10, 2006
1,293
0
0
3) Try to figure out how the hell I got myself involved in a project to do something that I have absolutely no clue how to do :eek:
 

Hyperblaze

Lifer
May 31, 2001
10,027
1
81
Originally posted by: fleshconsumed
Depends on the company policy. If no policy is in place, or they let me do whatever I want, I code my style, i.e.

private void foo(int x)
{
....if(x==1)
....{
.........dostuff1();
....}
....else
....{
.........dostuff2();
....}
}


With proper indentation of course in case forum fvsks it up.

EDIT replaced spaces with dots.

I really hate old school

function foo(int x){
}

Decreases readability tenfold all for saving one line.

motto a developer once told me: why write 2 lines when you can write one?

 

Zoblefu

Senior member
Jun 9, 2004
425
0
0
option 2.. unless I happen to think their coding style is better, in which case I may try to adopt it.
 

Atheus

Diamond Member
Jun 7, 2005
7,313
2
0
If I'm in a team then I conform to their standards. If I've been given someone else's code to modify, I code my own style, but make it clear where the old code ends and where my code begins. e.g.

ihatethisbraketstyle()
{
..if(x)
..{
..foo(); }
}

/* new code added by my-name, 17/11/06 */

ilikethisbracketstyle() {
..if(x) {
....foo();
..}
}

/* end new code */
 

fleshconsumed

Diamond Member
Feb 21, 2002
6,486
2,363
136
Originally posted by: Hyperblaze
motto a developer once told me: why write 2 lines when you can write one?

So that the code will be easier to read in the future. Sure your developer "may" waste one keystroke bringing open bracket onto the next line, but should you have to modify that code in the future, any semi-complex function will take much longer to figure out because of a code mess.
 

DaiShan

Diamond Member
Jul 5, 2001
9,617
1
0
Originally posted by: Hyperblaze
Originally posted by: fleshconsumed
Depends on the company policy. If no policy is in place, or they let me do whatever I want, I code my style, i.e.

private void foo(int x)
{
....if(x==1)
....{
.........dostuff1();
....}
....else
....{
.........dostuff2();
....}
}


With proper indentation of course in case forum fvsks it up.

EDIT replaced spaces with dots.

I really hate old school

function foo(int x){
}

Decreases readability tenfold all for saving one line.

motto a developer once told me: why write 2 lines when you can write one?

LOL, last week a developer for the company I contract for asked me why he was getting an error message that went something like this "unexpected value on line 8" so I figured eh, no problem I'll just check what is going on in line 8. Nothing like finding 9400+ characters on a single line of code. He didn't understand why I wanted him to use proper indentation hah.
 

slpaulson

Diamond Member
Jun 5, 2000
4,414
14
81
Originally posted by: DaiShan
Originally posted by: Hyperblaze
Originally posted by: fleshconsumed
Depends on the company policy. If no policy is in place, or they let me do whatever I want, I code my style, i.e.

private void foo(int x)
{
....if(x==1)
....{
.........dostuff1();
....}
....else
....{
.........dostuff2();
....}
}


With proper indentation of course in case forum fvsks it up.

EDIT replaced spaces with dots.

I really hate old school

function foo(int x){
}

Decreases readability tenfold all for saving one line.

motto a developer once told me: why write 2 lines when you can write one?

LOL, last week a developer for the company I contract for asked me why he was getting an error message that went something like this "unexpected value on line 8" so I figured eh, no problem I'll just check what is going on in line 8. Nothing like finding 9400+ characters on a single line of code. He didn't understand why I wanted him to use proper indentation hah.

:Q
 

Garet Jax

Diamond Member
Feb 21, 2000
6,369
0
71
Originally posted by: Hyperblaze
And the person before you coded a very different style then the way you do, do you....

1) Match his or her style as much as you can to keep the flow going?

or

2) Code your own style because it makes the most sense to you, making the development go faster, but at the same time, the project will have two entirely different styles embedded.

(1) One if I'm working in something he/she created.

(2) If I'm creating something new.
 

clamum

Lifer
Feb 13, 2003
26,256
406
126
Originally posted by: fleshconsumed
Depends on the company policy. If no policy is in place, or they let me do whatever I want, I code my style, i.e.

private void foo(int x)
{
....if(x==1)
....{
.........dostuff1();
....}
....else
....{
.........dostuff2();
....}
}


With proper indentation of course in case forum fvsks it up.

EDIT replaced spaces with dots.

I really hate old school

function foo(int x){
}

Decreases readability tenfold all for saving one line.

I don't have a problem reading code like the second style you posted. I started doing it that way in college (before I used to code like you) and can read it quickly and match up braces fine.

As for the OP, I tend to keep the same style that was done originally, unless it's horrendous.