Click here to Skip to main content
15,908,111 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralVBA GoTo Hell Pin
GuyThiebaut24-Dec-07 3:32
professionalGuyThiebaut24-Dec-07 3:32 
GeneralWhat If (Re: VBA GoTo Hell) Pin
Xiangyang Liu 刘向阳24-Dec-07 5:12
Xiangyang Liu 刘向阳24-Dec-07 5:12 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
GuyThiebaut24-Dec-07 5:52
professionalGuyThiebaut24-Dec-07 5:52 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
Vasudevan Deepak Kumar3-Jan-08 22:01
Vasudevan Deepak Kumar3-Jan-08 22:01 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
CPallini24-Dec-07 6:22
mveCPallini24-Dec-07 6:22 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
PIEBALDconsult24-Dec-07 6:42
mvePIEBALDconsult24-Dec-07 6:42 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
GuyThiebaut24-Dec-07 13:09
professionalGuyThiebaut24-Dec-07 13:09 
GeneralRe: What If (Re: VBA GoTo Hell) PinPopular
anony28-Dec-07 6:01
anony28-Dec-07 6:01 
Actually his usage of a private variable was correct, because otherwords he would have to keep drilling down the object model to get the value in each conditional, and it's better to incur the performance overhead of allocating a new variable once than to keep traversing the object model more than once in a loop like that. "Real" VB (which is NOT the same as VBA) gives you the With statement which prevents the need for this additional variable. What he did actually makes the code more readable as well.

Keep in mind that VBA is meant for simple macros, so there is really no horror in what he did, even with macros. Gotos are considered bad because they lead to spaghetti code smells in applications that have grown beyond a particular size, but used in a small macro situation they can greatly enhance readability if used properly.

I'm not trying to wave the VB banner, I actually bailed on it quite some time ago only using it when I have to, simply because most good developers chose to focus on C#, thus it's easier to go with the flow and I like C-like syntaxes.

But most VB-bigots are not as smart as they think they are and would feel quite stupid for making blanket statements about VB if they knew all the facts. I've seen really amazing, robust, well-performing apps written in both VB6 and VB.Net, and VB itself incorporates many elements of Pascal which is an excellent language.

I do agree that the relative simplicity of getting started with VB led to an influx of bad programmers (many of which got flushed out in the dot com bust), or people who were uneducated in formal CS concepts or simply were not technical or motivated enough to make a career committment to good programming, but at the same time I've worked with some real idiots whose background was in Java or C++. I always thought Microsft screwed up by keeping the whole "BASIC" moniker... when they came out with .Net they should have just named it B++ or B# or something that made more sense, because despite a few syntax differences it is much closer to C# than it is to the original BASIC.
GeneralRe: What If (Re: VBA GoTo Hell) Pin
GuyThiebaut31-Dec-07 9:09
professionalGuyThiebaut31-Dec-07 9:09 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
peterchen25-Dec-07 8:57
peterchen25-Dec-07 8:57 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
Scott Barbour27-Dec-07 13:16
Scott Barbour27-Dec-07 13:16 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
Matt Sollars1-Jan-08 5:46
Matt Sollars1-Jan-08 5:46 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
GuyThiebaut3-Jan-08 3:29
professionalGuyThiebaut3-Jan-08 3:29 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
Matt Sollars3-Jan-08 6:28
Matt Sollars3-Jan-08 6:28 
GeneralRe: VBA GoTo Hell Pin
Paul Conrad31-Dec-07 7:41
professionalPaul Conrad31-Dec-07 7:41 
GeneralRe: VBA GoTo Hell Pin
jgrogan3-Jan-08 3:25
jgrogan3-Jan-08 3:25 
GeneralRe: VBA GoTo Hell Pin
GuyThiebaut3-Jan-08 3:28
professionalGuyThiebaut3-Jan-08 3:28 
GeneralWorderful object names PinPopular
minsik072520-Dec-07 17:13
minsik072520-Dec-07 17:13 
GeneralRe: Worderful object names Pin
PIEBALDconsult20-Dec-07 17:39
mvePIEBALDconsult20-Dec-07 17:39 
GeneralRe: Worderful object names Pin
Yitzchok Dev20-Dec-07 18:25
Yitzchok Dev20-Dec-07 18:25 
JokeRe: Worderful object names PinPopular
Steve Echols20-Dec-07 20:22
Steve Echols20-Dec-07 20:22 
GeneralRe: Worderful object names Pin
Paul Conrad22-Dec-07 12:18
professionalPaul Conrad22-Dec-07 12:18 
GeneralRe: Worderful object names Pin
darkelv20-Dec-07 22:07
darkelv20-Dec-07 22:07 
GeneralRe: Worderful object names Pin
Xpnctoc22-Dec-07 19:02
Xpnctoc22-Dec-07 19:02 
JokeRe: Worderful object names Pin
Paddy Boyd20-Dec-07 22:43
Paddy Boyd20-Dec-07 22:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.