Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Pet peeves.

This thread is locked; no one can reply to it. rss feed Print
Pet peeves.
Arthur Kalliokoski
Second in Command
February 2005
avatar

Gasoline is a rather low velocity explosive.

Without something to contain the explosion so the pressure builds up, that's true for just about anything. Gunpowder and nitroglycerin will burn quite nicely if unconfined. OTOH, gasoline explodes quite forcefully when properly confined, just check YouTube for burnout videos. The reason a gas tank doesn't confine the explosion is because the gas can't burn without air.

They all watch too much MSNBC... they get ideas.

gnolam
Member #2,030
March 2002
avatar

Gunpowder and nitroglycerin will burn quite nicely if unconfined.

Even unconfined nitroglycerin will detonate if set off by shock. But like most explosives it's flammable, and small amounts will deflagrate harmlessly if set fire to.
Black powder OTOH is a low explosive and needs to be confined to have any destructive power.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Arthur Kalliokoski
Second in Command
February 2005
avatar

gnolam said:

Even unconfined nitroglycerin will detonate if set off by shock.

It's the inertia that "confines" it.

They all watch too much MSNBC... they get ideas.

Thomas Fjellstrom
Member #476
June 2000
avatar

Without something to contain the explosion so the pressure builds up, that's true for just about anything. Gunpowder and nitroglycerin will burn quite nicely if unconfined. OTOH, gasoline explodes quite forcefully when properly confined, just check YouTube for burnout videos. The reason a gas tank doesn't confine the explosion is because the gas can't burn without air.

Now try confining a high explosive and compare the two ;)

Yes, you can get spectacular fireworks out of gasoline, but it doesn't give the same bang for the buck as it were as high explosives regardless how you set it up.

No doubt that the gasoline in a tanker is under some pressure (especially if heated), and will explode rather spectacularly, but its still mostly fire and shrapnel.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Myrdos
Member #1,772
December 2001

My pet peeve is people who use this style of bracketing:

#SelectExpand
1for (int i = 0; i < 10; i++){ 2 doSomething(i); 3}

__________________________________________________

Arthur Kalliokoski
Second in Command
February 2005
avatar

No doubt that the gasoline in a tanker is under some pressure (especially if heated), and will explode rather spectacularly

That's nothing compared to being well-mixed with air in a stoiciometrically correct ratio under 12 to 1 compression ratio and fired at the right time.

They all watch too much MSNBC... they get ideas.

Thomas Fjellstrom
Member #476
June 2000
avatar

That's nothing compared to being well-mixed with air in a stoiciometrically correct ratio under 12 to 1 compression ratio and fired at the right time.

Indeed. Vaporized gasoline can make for an awesome show.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

23yrold3yrold
Member #1,134
March 2001
avatar

My pet peeve is people who use this style of bracketing:

HELLS YES

Minus a million points for brackets that don't line up vertically, minus another million for using them to enclose a single statement. I run into the following all the time in my current maintenance project ...

   // if something is true do something else
   if(somethingIstrue()){
       doSomethingElse();
   } // end if something is true do something else

/headdesk

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Arthur Kalliokoski
Second in Command
February 2005
avatar

But lots of people will make the following mistake

   // if something is true do something else
   if(somethingIstrue())
       doSomethingElse();

Add another statement, meant to be in the "if" block

   // if something is true do something else
   if(somethingIstrue())
       doSomethingElse();
       doSomeMore();

and doSomeMore() is executed whether somethingIstrue() or not.

They all watch too much MSNBC... they get ideas.

MiquelFire
Member #3,110
January 2003
avatar

I use that style all the time (plus a space)

For single statements, either I had more and ended up removing them all (maybe I found a one-line later on), or think I'll be adding more.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

23yrold3yrold
Member #1,134
March 2001
avatar

But lots of people will make the following mistake

Define "lots". Lots of people will make mistakes when their code reads like a Shakespearean soliloquy too. If you code is written in a way that reads well (and it should) then redundant comments shouldn't be necessary:

    // describe WHY thing is important when other thing is true here
    if(somethingIstrue())
        doSomethingElse();

Can't beat that for clarity. If you need brackets for more code later, then it should be obvious to add brackets.

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

StevenVI
Member #562
July 2000
avatar

Your company should have code style guidelines so that everyone's code looks the same.

What is your opinion of a construct like this?

if (somethingIsTrue())
    doSomething1();
else {
    doSomething2();
    doSomething3();
}

__________________________________________________
Skoobalon Software
[ Lander! v2.5 ] [ Zonic the Hog v1.1 ] [ Raid 2 v1.0 ]

bamccaig
Member #7,536
July 2006
avatar

My pet peeve is people who use this style of bracketing:

for (int i = 0; i < 10; i++){
    doSomething(i);
}

^ This. Another pet peeve is when people don't add white space (I have at least one colleague that writes entire OO JavaScript scripts and C# source files with no empty lines).

int x = getX();
if(somethingIsTrue(x)){
    doSomethingAboutIt(x);
}
for(int i=0; i<getLength(); i++){
    doSomethingForEach(getItem(i));
}
Object foo = getFoo();
if(somethingElseEntirelyIsTrue(foo)){
    doSomethingAboutThat(foo);
}else{
    doSomethingAboutThat(foo + 5);
    doSomethingDifferently(foo);
}

I would much prefer to see that as:

#SelectExpand
1int x = getX(); 2 3if(somethingIsTrue(x)) 4 doSomethingAboutIt(x); 5 6for(int i=0; i<getLength(); i++) 7 doSomethingForEach(getItem(i)); 8 9Object foo = getFoo(); 10 11if(somethingElseEntirelyIsTrue(foo)) 12{ 13 doSomethingAboutThat(foo); 14} 15else 16{ 17 doSomethingAboutThat(foo + 5); 18 doSomethingDifferently(foo); 19}

StevenVI said:

What is your opinion of a construct like this?

if (somethingIsTrue())
    doSomething1();
else {
    doSomething2();
    doSomething3();
}

If one block in a single chained statement needs braces then they should all have braces.

** APPEND **

Another pet peeve is when people put a space between a statement keyword and parenthesized parameters:

if (condition) ... ;
for (start; condition; next) ... ;
while (condition) ... ;

The space is unnecessary because the parenthesis already separates the statement from the parameters that follow. If that made sense then so would:

doSomething (doSomethingElse (5));

:-X

** APPEND **

On a related note, another pet peeve is when people add unnecessary spacing inside parenthesis like this:

doSomething ( 5 );

:-X

StevenVI
Member #562
July 2000
avatar

As long as there's a set convention that everyone is consistently using, I don't care at all how it is formatted.

I happen to use the Flex SDK Coding Conventions, which is why I put the space there. :P

__________________________________________________
Skoobalon Software
[ Lander! v2.5 ] [ Zonic the Hog v1.1 ] [ Raid 2 v1.0 ]

23yrold3yrold
Member #1,134
March 2001
avatar

StevenVI said:

What is your opinion of a construct like this?

Newline between the else and the {. Otherwise, dandy.

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Matthew Leverton
Supreme Loser
January 1999
avatar

I dislike Allegro's conventions of spaces for indentation and braces that don't line up. :-/

But my biggest programming related annoyance is dealing with people who have no problem solving or debugging skills. >:(

james_lohr
Member #1,947
February 2002

I got quite a fright when I discovered a colleague, whose job title is "Java Programmer", was new to the concept of using a debugger to step through code. Mind you, Netbeans' debugger is crap compared to Visual Studio's.

Thomas Fjellstrom
Member #476
June 2000
avatar

But my biggest programming related annoyance is dealing with people who have no problem solving or debugging skills.

This +1

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

if ()
{
}

Is a waste of vertical screen real estate. You can easily find the previous { by looking for the first thing upwards that matches the }'s spacing. Also, I think it's good coding style to use { } in EVERY block. Half the time you just end up adding them anyway.

Jonatan Hedborg
Member #4,886
July 2004
avatar

Is a waste of vertical screen real estate. You can easily find the previous { by looking for the first thing upwards that matches the }'s spacing. Also, I think it's good coding style to use { } in EVERY block. Half the time you just end up adding them anyway.

Quoted for truth ;)

23yrold3yrold
Member #1,134
March 2001
avatar

My screen is big enough that I can sacrifice an occasional line for improved readability. I can see where the "if() {" appeal comes from, but I can't stand it personally. :) Pet peeve, I tell you!

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Trent Gamblin
Member #261
April 2000
avatar

If I thought the { on a separate line actually added any readability, I might use it. To me it's just a wasted line, nothing more. But I don't really care if someone else uses it in code I'm reading. I don't worry about other people's coding style until they start editing my code. On projects with multiple developers, it's always good to have a standard, and as long as that's followed, there's no issue.

james_lohr
Member #1,947
February 2002

"if() {" is for nostalgic C days.

"if()
{
"
is for readability.

23yrold3yrold
Member #1,134
March 2001
avatar

^^^

In full disclosure, it's probably at least partially my OCD kicking in. If the opening bracket isn't directly above the corresponding closing bracket, my heart rate goes up and I get a twitch in my left eye. ;)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Trent Gamblin
Member #261
April 2000
avatar

"if() {" is for nostalgic C days.

"if()
{
"
is for readability.

Just saying "it's more readable", doesn't make it so :P... if you could quantify the readability of those two and compare them, I might be convinced. But it's not going to happen.

P.S.: Most coders I know (myself not included) are very attached to their coding style so much that they find some minor change in formatting less readable. Personally, my brain is smart enough to read both of those bracket styles perfectly fine.



Go to: