What the elephant did I just step in?
-
Picture this. VB.NET code written by a newb that needs to be updated with some support for a new file format. I'm looking at a single method that's 17 pages(!) long and doesn't return anything. It contains NINETY EIGHT
If
statements. Some are chained together withElseIf
, some are nested down to five levels deep. There is lots of this:If _condition-expression_ Then ' Do nothing ElseIf _condition-expression_ Then If _condition-expression_ Then ' Empty block Else ' Holy elephant, do something here! EndIf ElseIf _condition-expression_ Then ' Holy elephant, do something here! ElseIf _condition-expression_ Then ' Yeah, another empty block here too! Else ' Oh! And this block is empty too.
End If
Shoot me. Please. I beg of you.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Picture this. VB.NET code written by a newb that needs to be updated with some support for a new file format. I'm looking at a single method that's 17 pages(!) long and doesn't return anything. It contains NINETY EIGHT
If
statements. Some are chained together withElseIf
, some are nested down to five levels deep. There is lots of this:If _condition-expression_ Then ' Do nothing ElseIf _condition-expression_ Then If _condition-expression_ Then ' Empty block Else ' Holy elephant, do something here! EndIf ElseIf _condition-expression_ Then ' Holy elephant, do something here! ElseIf _condition-expression_ Then ' Yeah, another empty block here too! Else ' Oh! And this block is empty too.
End If
Shoot me. Please. I beg of you.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakSo do you guys really have no process for vetting noobcode?
-
Picture this. VB.NET code written by a newb that needs to be updated with some support for a new file format. I'm looking at a single method that's 17 pages(!) long and doesn't return anything. It contains NINETY EIGHT
If
statements. Some are chained together withElseIf
, some are nested down to five levels deep. There is lots of this:If _condition-expression_ Then ' Do nothing ElseIf _condition-expression_ Then If _condition-expression_ Then ' Empty block Else ' Holy elephant, do something here! EndIf ElseIf _condition-expression_ Then ' Holy elephant, do something here! ElseIf _condition-expression_ Then ' Yeah, another empty block here too! Else ' Oh! And this block is empty too.
End If
Shoot me. Please. I beg of you.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakWait! I think I know that guy who wrote that method. I mean, there couldn't be two people in the world that would do that could there? :~ I thought he was drummed out of development years ago though. EDIT Oh, wait, our guy didn't use methods. He wrote all of his code copy/past style and it was something like 20 pages long too. It was the same for loop copy pasted over and over. And, it was in prod and it finally failed in the for loop. So Instead of fixing it in one place... X| Yes, I'm serious. EDIT 2 And I should mention -- and I'm not kidding -- he was a MCSD. Fantastic test taker, I'm sure. :|
-
So do you guys really have no process for vetting noobcode?
This isn't a production app. It's a tool that's used by a couple of teams, and no, there was no cuh thing a vetting.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Wait! I think I know that guy who wrote that method. I mean, there couldn't be two people in the world that would do that could there? :~ I thought he was drummed out of development years ago though. EDIT Oh, wait, our guy didn't use methods. He wrote all of his code copy/past style and it was something like 20 pages long too. It was the same for loop copy pasted over and over. And, it was in prod and it finally failed in the for loop. So Instead of fixing it in one place... X| Yes, I'm serious. EDIT 2 And I should mention -- and I'm not kidding -- he was a MCSD. Fantastic test taker, I'm sure. :|
Quote:
he was a MCSD. Fantastic test taker, I'm sure.
I is all book smarts and stuff now. :laugh:
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Picture this. VB.NET code written by a newb that needs to be updated with some support for a new file format. I'm looking at a single method that's 17 pages(!) long and doesn't return anything. It contains NINETY EIGHT
If
statements. Some are chained together withElseIf
, some are nested down to five levels deep. There is lots of this:If _condition-expression_ Then ' Do nothing ElseIf _condition-expression_ Then If _condition-expression_ Then ' Empty block Else ' Holy elephant, do something here! EndIf ElseIf _condition-expression_ Then ' Holy elephant, do something here! ElseIf _condition-expression_ Then ' Yeah, another empty block here too! Else ' Oh! And this block is empty too.
End If
Shoot me. Please. I beg of you.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakYou owe it to yourself and those that follow to refactor that thing. Otherwise, the next If Then you add might cause the compiler to wave the white flag with a "Nesting too deep" error. Seen it, done it. At least the doesn't have goto's does it? Mine had that too.
-
You owe it to yourself and those that follow to refactor that thing. Otherwise, the next If Then you add might cause the compiler to wave the white flag with a "Nesting too deep" error. Seen it, done it. At least the doesn't have goto's does it? Mine had that too.
MarkTJohnson wrote:
goto
You mean something like:
If condition-expression Then
' Do nothing
ElseIf condition-expression Then
If condition-expression Then
' Empty block
Else
' Holy elephant, do something here!
...
Goto Step123
EndIf
ElseIf condition-expression Then
' Holy elephant, do something here!
...
:Step123
...
Goto Step234
ElseIf condition-expression Then
' Yeah, another empty block here too!
Else
' Oh! And this block is empty too.
End If
...
:Step234
...
Goto Step123Oh yeah, that's much more interesting!
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
-
Picture this. VB.NET code written by a newb that needs to be updated with some support for a new file format. I'm looking at a single method that's 17 pages(!) long and doesn't return anything. It contains NINETY EIGHT
If
statements. Some are chained together withElseIf
, some are nested down to five levels deep. There is lots of this:If _condition-expression_ Then ' Do nothing ElseIf _condition-expression_ Then If _condition-expression_ Then ' Empty block Else ' Holy elephant, do something here! EndIf ElseIf _condition-expression_ Then ' Holy elephant, do something here! ElseIf _condition-expression_ Then ' Yeah, another empty block here too! Else ' Oh! And this block is empty too.
End If
Shoot me. Please. I beg of you.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakI know the feeling. And in SQL too.
Best, Sander arrgh.js - Bringing LINQ to JavaScript SQL Server for C# Developers Succinctly Object-Oriented Programming in C# Succinctly
-
Picture this. VB.NET code written by a newb that needs to be updated with some support for a new file format. I'm looking at a single method that's 17 pages(!) long and doesn't return anything. It contains NINETY EIGHT
If
statements. Some are chained together withElseIf
, some are nested down to five levels deep. There is lots of this:If _condition-expression_ Then ' Do nothing ElseIf _condition-expression_ Then If _condition-expression_ Then ' Empty block Else ' Holy elephant, do something here! EndIf ElseIf _condition-expression_ Then ' Holy elephant, do something here! ElseIf _condition-expression_ Then ' Yeah, another empty block here too! Else ' Oh! And this block is empty too.
End If
Shoot me. Please. I beg of you.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakI could swap your VB with some MATLAB I've got hanging around here.
veni bibi saltavi
-
Picture this. VB.NET code written by a newb that needs to be updated with some support for a new file format. I'm looking at a single method that's 17 pages(!) long and doesn't return anything. It contains NINETY EIGHT
If
statements. Some are chained together withElseIf
, some are nested down to five levels deep. There is lots of this:If _condition-expression_ Then ' Do nothing ElseIf _condition-expression_ Then If _condition-expression_ Then ' Empty block Else ' Holy elephant, do something here! EndIf ElseIf _condition-expression_ Then ' Holy elephant, do something here! ElseIf _condition-expression_ Then ' Yeah, another empty block here too! Else ' Oh! And this block is empty too.
End If
Shoot me. Please. I beg of you.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakI'm having the same issue here, just the code is in JS.
Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source
-
Picture this. VB.NET code written by a newb that needs to be updated with some support for a new file format. I'm looking at a single method that's 17 pages(!) long and doesn't return anything. It contains NINETY EIGHT
If
statements. Some are chained together withElseIf
, some are nested down to five levels deep. There is lots of this:If _condition-expression_ Then ' Do nothing ElseIf _condition-expression_ Then If _condition-expression_ Then ' Empty block Else ' Holy elephant, do something here! EndIf ElseIf _condition-expression_ Then ' Holy elephant, do something here! ElseIf _condition-expression_ Then ' Yeah, another empty block here too! Else ' Oh! And this block is empty too.
End If
Shoot me. Please. I beg of you.
System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakPaid by the line?
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
-
Wait! I think I know that guy who wrote that method. I mean, there couldn't be two people in the world that would do that could there? :~ I thought he was drummed out of development years ago though. EDIT Oh, wait, our guy didn't use methods. He wrote all of his code copy/past style and it was something like 20 pages long too. It was the same for loop copy pasted over and over. And, it was in prod and it finally failed in the for loop. So Instead of fixing it in one place... X| Yes, I'm serious. EDIT 2 And I should mention -- and I'm not kidding -- he was a MCSD. Fantastic test taker, I'm sure. :|
I've been a professional programmer for over 30 years, and can assure you that there are many, many folk who produce that kind of cruft.
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.