|
-
January 16th, 2012, 07:03 AM
#1
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!
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
January 16th, 2012, 10:03 AM
#2
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
-
January 16th, 2012, 11:35 AM
#3
Re: What gives you that sinking feeling when looking at code you have inherited?
Just found another one... 
// this will need modifying
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
January 16th, 2012, 12:09 PM
#4
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
-
January 17th, 2012, 04:00 AM
#5
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;
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
January 17th, 2012, 06:12 AM
#6
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
-
January 17th, 2012, 06:22 AM
#7
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!
-
January 17th, 2012, 08:06 AM
#8
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...
-
January 17th, 2012, 08:08 AM
#9
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
-
January 17th, 2012, 12:16 PM
#10
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
-
February 15th, 2012, 02:33 PM
#11
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
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
February 20th, 2012, 05:42 PM
#12
Re: What gives you that sinking feeling when looking at code you have inherited?
VB6 Upgrade Wizard. Hated those:
******** Fix Stupid Net Framework Error in this line *************
-
May 15th, 2012, 07:57 AM
#13
Re: What gives you that sinking feeling when looking at code you have inherited?
 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...
-
May 15th, 2012, 04:13 PM
#14
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
-
May 16th, 2012, 04:47 AM
#15
Re: What gives you that sinking feeling when looking at code you have inherited?
 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..
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|