Programming pet peeves

Posts 115 of 21 · Page 1 of 2
Programming pet peeves
Do you have any?

I'll start off. This applies to any languages as well, but I'll use C++ as an example:

[PHP]
bool freedompeace = true;
if (freedompeace)
{
ExitWindows(0,0);
}
else
{
// do nothing
}
[/PHP]

There is NO need to have the entire "else do nothing" - it already does that! It's really annoying when I'm helping someone debug code and I see a matching else-do-nothing statement for every if statement.








Also, comments, in C# this time.

[php]
/*******************************************
* Create a new random variable
*******************************************/
Random random = new Random();

/*******************************************
* Create a new integer variable and assign it to a random number
*******************************************/
int temporary_number = random.Next();

/*******************************************
* Multiply our number by two
*******************************************/
temporary_number = temporary_number * 2;

/*******************************************
* Write our output to the console in a new line
*******************************************/
Console.WriteLine("Output is " + temporary_number);

/*******************************************
* Return zero.
*******************************************/
return 0;
[/php]

I KNOW what's going on, you don't need to TELL me AGAIN. It's in plain English, almost.

And that's not that bad, do ALL the above, PLUS separate every line with a break.

So:

[php]

/*******************************************

* Create a new random variable

*******************************************/

Random random = new Random();



/*******************************************

* Create a new integer variable and assign it to a random number

*******************************************/

int temporary_number = random.Next();



/*******************************************

* If the temporary number is more than 5

*******************************************/



if (temporary_number > 5)

{

/*******************************************

* Multiply our number by two

*******************************************/

temporary_number = temporary_number * 2;



/*******************************************

* Write our output to the console in a new line

*******************************************/

Console.WriteLine("Output is " + temporary_number);

}
/*******************************************

* else

*******************************************/

else

{

// do nothing

}

/*******************************************

* Return zero.

*******************************************/

return 0;

[/php]


Post yours
i love you freedom /
/.. What are you on about in this thread? ROFL
Quote Originally Posted by ac1d_buRn View Post
i love you freedom /
/.. What are you on about in this thread? ROFL
People's programming habits that piss you off when you read it obviously.

Mine is people using LINQ and try squeeze it all on one line so it looks stupid. Example (basic)

[php]
From xx In ListBox1.Items where xx.ToString.Contains("whatever") select ListBox1.Items.IndexOf(xx)
[/php]

Now, doesn't this look a lot more readable?
[php]
From xx In ListBox1.Items _
Where xx.ToString.Contains("whatever") _
Select ListBox1.Items.IndexOf(xx)
[/php]

I dunno, I feel that making a statement take up a few extra lines for the sake of readability is preferable.
API's with functions that take/return void pointers, have undocumented functions, have functions marked as "INTERNAL USE ONLY" yet you /need/ to use them, etc.
Some API's are nice and documented (Lua, SDL) but occasionally you come across that are almost unusable :| (Gamebryo, Ghoul2)

People using packers/obfuscaters on code/libraries that just don't need to be packed :|

Excessive or lack of commenting. Or comments that contradict the surrounding code entirely.

People against goto for the sake of being against it.
People who worship C++ just because it has '++' in it and ignore languages like C and assembly altogether.

Also it seems there is no single SDK that compiles with VS '08/'10 out of the box :| and even the suggested fixes don't always work.
I hate declaring variables in ASM
Here's how it looks:

Code:
szTable		 db		"agkjkoOPropwopglkxbmodgjsogekopsgjioprjgopskieopgtjopgpokwejpgiojuioJKOHJRIOGJiowrjgHJoRIHJiorwgmibnbdjohxcjhvoajioqwethsodnmkzxhjOHWERIOjiojHFUIHUIASJFIORbheifjioshguioJGIOFJSGIO"
txt db "An error occured while calling WSAStartup",0
txt1 db "An error occured while creating a socket",0
txt2 db "An error occured while connecting",0
capt db "SCHiM",0
wsadata WSADATA <>
delfile db "del cmd.txt",0
fname db "cmd.txt",0
trans_buffer db 500 dup (0)
failmatch db "They match!",0
sin sockaddr_in <?>
buff      db 500 dup (0) 
bbuff db (0)
sendbuff db 500 dup (0)
sbuff db 600 dup (0)
Command db "^",0
I hate when people hate on mah gotos
one of my pet peeves is when the { is on the same line as the statement
like
Code:
if(bracket == onSameLine){
do{
rage();
}while(bracketIsStillThere);
}
two words: Variable names
Quote Originally Posted by why06 View Post
two words: Variable names
QFT.

[php]
dim asdva As Integer = 3222
dim hhghuu As Integer = 20
'... continue variable rape into a complex function so you have no idea what the fuck is happening.
[/php]

Another one of my pet peeves are people that supply a source code and don't give any documentation, (i.e imports, needed references, api calls, brief description of processes...etc)
In Visual Studio, when they leave the default icon. It looks terrible. I want to kill babies when I see it
BAD GUIs.

Huge-ass misplaced and unorganized buttons, giant font, differing colours.

/fp
Non-transparent background labels.

Quote Originally Posted by Jason View Post
Non-transparent background labels.

This page isn't transparent =/
Whitespace. I have OCD. :|
Quote Originally Posted by qwerty01 View Post
one of my pet peeves is when the { is on the same line as the statement
like
Code:
if(bracket == onSameLine){
do{
rage();
}while(bracketIsStillThere);
}
OMG ! I HAVE THAT TOO !

if (true) {
// do something
}

just pisses me off so much :L

Quote Originally Posted by Insane View Post
In Visual Studio, when they leave the default icon. It looks terrible. I want to kill babies when I see it
The default Visual Studio icon looks a lot better than the default Windows XP no-icon.

Quote Originally Posted by Lolland View Post
BAD GUIs.

Huge-ass misplaced and unorganized buttons, giant font, differing colours.

/fp
QFT

Quote Originally Posted by -Raz0r- View Post
Whitespace. I have OCD. :|
Whitespace comes in useful sometimes, when you have an excessively large function, and want to separate major parts in the code.
Posts 115 of 21 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?