What gives you that sinking feeling when looking at code you have inherited?
My favourite(???) so far today is seeing...
// todo - fix this
There was of course no indication of what should be fixed or why! :confused:
Re: What gives you that sinking feeling when looking at code you have inherited?
Yep, Comments that suck, and variable naming conventions. You could pull out all your hair out of frustration
Re: What gives you that sinking feeling when looking at code you have inherited?
Just found another one... :rolleyes:
// this will need modifying
Re: What gives you that sinking feeling when looking at code you have inherited?
Is it multi-threaded code? My favorite comment was this:
// Sleep here for 500ms, this seems to fix bug #XXXXX
Viggy
Re: What gives you that sinking feeling when looking at code you have inherited?
Nice one! I haven't had one of those.
I once came across a macro defined something like this...
Code:
#define BOGO DoSomething1(); \
DoSomething2(); \
return;
Re: What gives you that sinking feeling when looking at code you have inherited?
I once saw this in a student's work he submitted :
Code:
'This is my Comment
I had to give him some points as he used the ' as well as knew ( at least ) that it was a comment. I gave hime 2 out of 5 though.
See what I have to put up with on a daily basis? HAHAHA :)
Re: What gives you that sinking feeling when looking at code you have inherited?
So Hannes, it was something along these lines then:
'This is my Comment
'And this is my comment: 2/5!
:lol:
Re: What gives you that sinking feeling when looking at code you have inherited?
Code:
// I wasn't sure how to use these (and too lazy to check), so something quick...
Re: What gives you that sinking feeling when looking at code you have inherited?
And just saw:
Code:
// This "if" condition should be removed, but I just don't have time to wait for a complete rebuild
Re: What gives you that sinking feeling when looking at code you have inherited?
Years ago, I had worked with someone that came over from PASCAL. He used to do this:
Code:
#define { BEGIN
#define } END
at the top of his C files...
Viggy
Re: What gives you that sinking feeling when looking at code you have inherited?
Here's one from a Borland C 6 project i inherited.
Code:
void __fastcall TMasterRecipeForm::SpeedButton3Click(TObject *Sender)
{
// create a new recipe
// use the username form for input, instead of creating a totally new form
// - i'm lazy, i know (or is it good programming practice??, makes ya think)
// create new username form for modification
UsernameForm = new TUsernameForm(Application);
AnsiString NewRecipe;
if ( UsernameForm )
{
// do neccessary changes for input form
UsernameForm->Label2->Caption = "Recipe :";
UsernameForm->Caption = "Please specify new Recipe Name :";
// show *modified* username form
UsernameForm->ShowModal();
and a little later in the same project..
Code:
// use the username form for input, instead of creating a totally new form
// - i'm lazy, i know
// create new username form for modification
UsernameForm = new TUsernameForm(Application);
if ( UsernameForm )
{
// do neccessary changes for input form
UsernameForm->Label2->Caption = "Recipe :";
UsernameForm->Caption = "Please specify new Recipe Name :";
// show *modified* username form
UsernameForm->ShowModal();
and then further down...
Code:
// build sql query for new master recipe
AnsiString SQL = "insert into ********* values( ";
SQL += "'" + RecipeID + "', ";
SQL += "'" + Recipe + "', ";
// add field data to query *easier than doing each an every one manually*
// Lazy and bad method .....
for ( int c = 3; c < 66; c++ )
{
if ( c == 7 || c==8)
{
if ( db->DataQuery->Fields->FieldByNumber(c)->AsString.AnsiCompareIC( "true" ) == 0 )
SQL += "1, ";
else
SQL += "0, ";
continue;
}
SQL += "'" + db->DataQuery->Fields->FieldByNumber(c)->AsString + "', ";
}
// final piece
SQL += "'" + db->DataQuery->Fields->FieldByNumber(66)->AsString + "') ";
and i cringed when i saw this one (still in the same file)
Code:
/* ********* list of things to delete **********
SelectedFlourBunkers
Mix Design
Selected Remix Percentages
Master Recipe Record
Export Recipe List
************************************************/
// get master recipe id
// TODO : create seperate backup function for when changes are done
Re: What gives you that sinking feeling when looking at code you have inherited?
VB6 Upgrade Wizard. Hated those:
Quote:
******** Fix Stupid Net Framework Error in this line *************
Re: What gives you that sinking feeling when looking at code you have inherited?
Quote:
Originally Posted by
GremlinSA
Here's one from a Borland C 6 project i inherited.
Code:
void __fastcall TMasterRecipeForm::SpeedButton3Click(TObject *Sender)
{
// create a new recipe
// use the username form for input, instead of creating a totally new form
// - i'm lazy, i know (or is it good programming practice??, makes ya think)
// create new username form for modification
UsernameForm = new TUsernameForm(Application);
AnsiString NewRecipe;
if ( UsernameForm )
{
// do neccessary changes for input form
UsernameForm->Label2->Caption = "Recipe :";
UsernameForm->Caption = "Please specify new Recipe Name :";
// show *modified* username form
UsernameForm->ShowModal();
It does indeed make me think...
Re: What gives you that sinking feeling when looking at code you have inherited?
Recently, I saw something like this:
Code:
// Fix commented line below...
That was the only comment in the function. Nothing else was commented out!
Viggy
Re: What gives you that sinking feeling when looking at code you have inherited?
Quote:
Originally Posted by
MrViggy
Recently, I saw something like this:
Code:
// Fix commented line below...
That was the
only comment in the function. Nothing else was commented out!
ROFL ... thats a good one... So the Unknown problem must have been fixed..