Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I saw the rules on how to type code for UNITY project or GNU software in general. Why do they write code in such an ugly form? Is there a particular reason why they don't put brackets the way (from what I know) most people do?

Why like this:

for (i = 0; i < 5; i++)
   {
      //do something
   }

and not like this:

for (i = 0; i < 5; i++)
{
    //Do something
}

or this:

for(i = 0; i < 5l i++) {
   //Do Something
}

???

share|improve this question
2  
linux kernel coding style is better in my opinion: kernel.org/doc/Documentation/CodingStyle –  Sam Nov 12 '12 at 5:42
    
I totally agree with you Sam, those spaces under a loop an if or whatever seem to me like just waste of time, and they are NOT nice to the eye either. I asked a friend who has no clue about coding, which text seems better to his eyes, he said the last one. I don't agree, I like the second, BUT the first one is ugly as hell and I believe it was done like that just to be different. –  Deus Deceit Nov 12 '12 at 20:34
add comment

3 Answers

Look at it ike this. People in England drive their vehicles to the left and the Americans on the right side of the road. And then we have people criticising on the advantages and disadvantages.

It is a formatting style, and it began the way the GNU founders saw it. You wish a change, bring it on!

share|improve this answer
1  
One of the best answers to this kind of question I've ever seen. Intelligence 1 : religious wars 0. –  neon_overload Nov 12 '12 at 5:04
add comment

The first rule about writing code is that it be readable, otherwise no-one else will ever help you write it, it will never get checked through by a second pair of eyes, and will be harder to debug.

The first way of presenting braces is beautiful: poised, elegant, clear, refined; it shows the programmer cares and loves their code.

The second way is rude, leveraging so much importance on a squidgy character that just doesn't deserve the first column, and leaving the braced content alone towards the middle of the screen without the cuddling embrace of its dearest relatives.

The third way is pure ugly, unbalanced, cramped and will lead to relatively more erroneous code. Don't do that.

share|improve this answer
add comment
up vote 0 down vote accepted

I shouldn't even ask this question. The nature of the question was about an actual reason and not just taste. I guess GNU guys just want to be different and that's what they did by putting the brackets in a way that I consider ugly. As for an answer (if I want change, then bring it on) I don't want change cause I use a style that most people do. It makes it easy for me to read their code and easy for them to read mine. When it comes to change I would prefer if possible to bring it in essential stuff and not change how people write code just because.

I guess it all boils down to taste. I can't accept any answer cause no answer was an actual answer.

I guess there's no reason for it, just taste.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.