Rant - Option Strict Off
Today someone posted an innocent enough question in the VB.NET Newsgroup. He was new to VB.NET and had turned on Option Strict - he immediately got over 500 errors. He asked specifically why he should Option Strict. I don't think any readers here don't already know the answer to this so I won't belabor the point.
The interesting thing was that after reading the responses, the guy immediately made the decision to use Option Strict. This in light of the fact that a few people downplayed its significance. The poster made the point that he'd prefer to fix the problems up front.
When the poster asked the question, he was 'ignorant' in an innocent sense of the word. He was new to VB.NET and just didn't know. But he was curious enough to ask and upon finding out why, he immediately saw the light and changed his way of doing things. This, despite the fact that it was going to cause him to do quite a bit of work in the short run. He had the foresight to see that it was going to save him work in the long run.
What I don't understand though - is people that have read the reasons and still opt to not use it (the extremely rare cases where Late binding is necessary notwithstanding- because even in those cases you can use it for everything else).
Somebody - please somebody - some VB6 know it all that refuses to change his/her ways- please explain to me what value Option Strict Off has FROM THE CUSTOMER'S point of view? I've heard the “I can write code faster without it” but I don't buy that for one second. I can write code really really fast too if it doesn't have to work correctly. So what? I've never gotten paid to write stuff that doesn't work. People will tolerate mistakes and consequently know that some bugs will exist, but no one has ever said “Bill, I need this ASAP, I don't care how many bugs it has and I don't care if it doesn't meet my needs” Well, that's the implicit assumption of turning off Option Strict to speed up development. Why? Because you are almost guaranteed to make some mistakes that would be caught otherwise. And even if you think you're such a bad a33 that you won't, you'll at least have to manually check over everything thoroughly to ensure that you didn't. That takes TIME. Time that would have been saved if the compiler caught it on the front end.
But most importantly, Design time mistakes are practically FREE when compared with mistakes found after the application is in the customer's hands. Let's say that on average, I make 40 mistakes a day that the compiler catches - from forgetting a return type, or not having all paths return a value to whatever else including typos. My boss wouldn't care one bit. People make small mistakes all the time. But if 1 bug a day on average was found in code that I wrote that was deployed- I wouldn't have a job anywhere but Smith Data Processing or the government (just kidding). That's because <gasp> Design time mistakes are easy and quick to fix - deployment ones aren't.
So if we arbitrarily cutoff the time frame to include just today - then yes, I guess you could code slightly faster. But the time frame doesn't end until the customer stops using that version of your product. So if you do it quicker today but have to fix it later, you didn't save time or money - you actually ended up costing time and money.
VB.NET is a VAST Improvement over VB6 - and although you can write good code in VB6 - it's easy to write bad code. No one in their right mind (or that has the first clue what they are talking about will debate this). But can you write good code in VB6 with say Option Explicit Off? Have fun - b/c unless you never make typos chances are you are going to get some whacky results. Why fight the improvements? What possible benefit does it provide if you Know the 'right' way to do things but ignore it? It sure as hell doesn't benefit the customer.
------------
Someone actually posted that Option Strict On doesn't help performance. You have to be ******** kidding me. And this comment came from someone who has been in many such debates and has supposedly read why Off is a bad thing. Look, I don't care what the Option is, if I turn it on and every goddamned program I wrote won't compile with it - something is wrong. But unless the Option is totally throwing false alarms, why not flip the thing on and at least verify that it's not blowing smoke?
This is the second type of ignorance, and it's inexcusable. Look, old boy in the newsgroups was new to VB.NET. There's a learning curve. You are necessarily going to be ignorant when you first learn something. And like a real professional, he inquired about it and took corrective action on it. But people that have been using something for a while, and have done the inquiry and chosen to ignore it - presumably because they know better than everyone else in the gd world, that's so pathetic it's hard to really describe. We all have a bad habit or two that we refuse to give up - but as professionals those should certainly be few and far between - and we should correct them to the extent that we are the only ones hurt by them. But this BS attitude of “I've been a programmer for x years and I know better.” Really? What in the hell does being a VB5,6 programmer for 5 years really mean when you are in .NET and haven't learned it yet? Not much. What in the hell does that mean when you refuse to accomodate the new changes? Does programming VB6 for even 100 years cause your bugs to not be bugs in .NET or whatever other new environment you are working in? I'm the first to admit that experience matters a whole lot - but that's ONLY IF YOU LEARN from that experience. If you make mistakes and are too proud or egotisitical to acknowledge that you made a mistake - and therefore refuse to take corrective action - what good is that experience? If you still make the same rookie mistakes over and over after working with something for a few years, all that means is you're either pigheaded or stupid - probably some of both.
It's just too bad that we can't take all of the Option Strict Off, Non-Paramaterized Dynamic SQL Writing, Refusing to use a Stringbuilder, On Error Resume next advocates and stick them in one company so it could go out of business and they could move on to Amway sales or whatever.
----
And the most ironic part of the whole thing is that the dude that was saying it doesn't impact performance is a newsgroup regular. And on three occassions he's started complaining whenever other people got the MVP award and he didn't. Spare me the conspiracy theories old boy because with viewpoints like this - you're your own worst enemy.