I don't hate VB... I hate VB programmers



  • Actually, I do hate VB.  The language itself has WTFs all over the place.  I'm not going to defend it.

    But what I really hate, is VB programmers.  Seems like most of the time, we see lots of very bad VB code, and we just shrug our shoulders and say, "well, it's VB, what do you expect?"  But in most cases, the WTFs we point are not VB-specific at all, and can easily be written in other languages.

    Just a few examples of what I'm coming across this morning, while trying to modify OPC (other people's code):

    • massive duplication of code (I love changing the same code 10 times)
    • oodles of global variables (where the fsck did that come from...)
    • non-sequiturs all over the place: if ( grassColor == green ) { DriveOtherCarToWork(); }

    You can do all of the above in any language.  Yet VB seems to attract it.  Why, $DEITY, why??????

    Okay that's enough ranting for now... 



  • Form.Line(X,Y)-step,Color,[B][F],BitMask

    VB6. You win the pretty price. 



  • Yesterday I had the please of attempting to fix some VB.NET code.... A couple thing that made me want to strangle the coder:

    1. Used the class name as the variable name. It compiled since the class wasn't in the immediate namespace.

    2. Had a processing function that returned a true or false fail/pass. The body of the function was wrapped in a try/catch, with the catch returning false.

    3. Was re-creating objects with a large overhead in a loop that could have been reusable throughout the loop (this slowed down the application by about 10 fold).

    4. Was using objects that had properties of the type of object he really wanted to use. Every reference was biggerobject.actualneededobject. He should just used the actual object.


    Frankly, I think that there is only one reason to start a project in VB.NET, and that reason isn't a very good one. The only excusable reason to use VB.NET is if NO ONE on the team knows ANY OTHER LANGUAGE besides VB, and the team HAS to have the project done YESTERDAY. If a person claiming to be a programmer knows only VB.NET, and refuses to learn any other language (or is incapable), then in my opinion that person shouldn't be used for any serious projects ever. I haven't seen a VB.NET project in at least the last year that a customer has sent in where I've gone "Wow, this is pretty clean and readable. This person can write really nice, clean, code."

     The thing I hate the most would have to be

    "If Not SomeObject Is Nothing Then"
     



  • @AssimilatedByBorg said:

    You can do all of the above in any language.  Yet VB seems to attract it.  Why, $DEITY, why??????

    Because VB, in all it's perceived simplicity, attracts newbies. 



  • Stupidity is not limited to VB coders by any means though. Let me describe this gem I just came across. I think it wins the race for how to write the slowest possible code ever. Now, I know optimization is the last thing that should really be worried about, but you should at least try to do things in what you think is the best way possible.

    We have an object returns an array of results. The function that does this can take seconds. This is not the problem, as it is an advanced analysis algorithm.

    Customer creates a class to simplify handling of the analysis results. He puts methods into it like GetWidth(int index), GetX(int index), etc...

    In these functions.... the customer... calls... the analysis function...

    What the person should have done was analyze elsewhere and then returned stored results. Because of the way it currently is, when he actually wants to do something like create a rect of the results, the analysis function is called 4 times. He also loops through the array returned. So, for example, if there were 10 results, and all he was going to do is create a rect for each result, analyze would be called 41 times instead of once (the extra time is to obtain the number of results in the array.).

    sigh...

     



  • @GoatCheez said:

    Stupidity is not limited to VB coders by any means though. Let me describe this gem I just came across. I think it wins the race for how to write the slowest possible code ever. Now, I know optimization is the last thing that should really be worried about, but you should at least try to do things in what you think is the best way possible.

    We have an object returns an array of results. The function that does this can take seconds. This is not the problem, as it is an advanced analysis algorithm.

    Customer creates a class to simplify handling of the analysis results. He puts methods into it like GetWidth(int index), GetX(int index), etc...

    In these functions.... the customer... calls... the analysis function...

    What the person should have done was analyze elsewhere and then returned stored results. Because of the way it currently is, when he actually wants to do something like create a rect of the results, the analysis function is called 4 times. He also loops through the array returned. So, for example, if there were 10 results, and all he was going to do is create a rect for each result, analyze would be called 41 times instead of once (the extra time is to obtain the number of results in the array.).

    sigh...

     

    I've wanted to strangle some programmers for doing this exact thing.  Caused by laziness and/or lack of knowledge.  <sarcasm>It's just a single method call. How long could it possibly take?  Plus it works, so that's good enough.<sarcasm> Now I'm left with wasting days trying to make our CGI return a page request in 5 seconds, instead of 5 minutes because of lazy coding like this.



  • @ammoQ said:

    Because VB, in all it's perceived simplicity, attracts newbies. 

    Aye, there's the rub, isn't it?  I've wondered how this is actually so -- the perception of simplicity, that is.  The language is so prone to errors that I don't understand how anyone who has tried anything other than "hello, world" can think it's simple.

    I used to think debugging C/C++ was "hard", relatively speaking.  At least the C compiler gives decent static analysis.
     



  • I think it all stems from the name... BASIC.  The name alone says that it's easy to use/learn.  And also, since most of us started out using Apple Basic, this was the [il]logical conclusion.

    Maybe if they taught us Fortran in jr high we wouldn't have this issue... then again it might be a whole other WTF.  Seriously though Pascal would have been a better language.



  • @skippy said:

    Seriously though Pascal would have been a better language.

    Seriously, you're right. I learned pascal as my first "real" language about 11 or 12 years ago. I'm sure though that if VB was around during that time though that I would have been totally tainted and rendered almost useless as a programmer. I think Pascal is a great first language even for people that have never programmed a line of code in their life.



  • @AssimilatedByBorg said:

    @ammoQ said:

    Because VB, in all it's perceived simplicity, attracts newbies. 

    Aye, there's the rub, isn't it?  I've wondered how this is actually so -- the perception of simplicity, that is.  The language is so prone to errors that I don't understand how anyone who has tried anything other than "hello, world" can think it's simple.

    I used to think debugging C/C++ was "hard", relatively speaking.  At least the C compiler gives decent static analysis.
     

    It's the same reason COBOL was popular outside traditional programming circles, the syntactic constructs are closely aligned with everyday language so its readable/understandable by people who don't have programming experience.  Consider the simple for loop

    VB:

    For count = 0 To 10 Step 1

        DoStuff()

    Next count 

    C Style:

    for (i = 0; i <= 10; i++)

    {

       DoStuff();

    }

    The syntax of VB is a hell of a lot easier to understand if you don't know code.  You don't need to worry about case sensitivity, those "pesky" semi-colons & braces, or unary operators.  Hell until VB.Net you couldn't even do += so every thing was "foo = foo + bar".  Coupled with the fact that it is the only scripting language for Office and it becomes a no brainer that it will be popular with newbies.

    Even now VB has its place although it is diminishing.  I finally got the company I work for to migrate to C# so I'm really ecstatic.  Now If MS would offer C# for Apps, I'd be in heaven.

     



  • @GoatCheez said:

    I think Pascal is a great first language even for people that have never programmed a line of code in their life.

    TurboPascal, baby, 1984.  I had futzed around with various dialects of Basic for 5-6 years before that, but nothing that I would call 'real' programming, and even poked and peeked my way at some assembly/machine code.. but Pascal was the first language that really got me programming systems that would _do_ something besides make my little heart flutter.

    -cw 



  • Hm. I'm weird, because I learned C++ as my first language. I produced some really interesting "constructs" (like a function returning the value of an enum constant by switching...), but I think it was worth the effort.



  • Hey, I'm a VB programmer and proud of it.  Well kinda. :)
    Yes, I agree that VB attracts beginners who tend to make more mistakes, but that is not a fault with the language.

    I personally find it a very easy language to use, but I have been using dialects of BASIC since the late 80's.

    I dont agree with the people that are saying that VB is easier to write crap code in.  Okay, I concede the VB 6 Line statement was crap.  But VB .NET has changed all that.  It is now (at long last) a proper grown up language, capable of anything that C# can do.  Probably the worst code I have seen recently was some VB .NET code written by someone who thought they were still using VB4.  No classes, option strict was off, functions that didn't return anything, long instead of integer (most of the time), etc... 

    I think what you find easy is what you use most, I use VB .NET almost exclusively and love it.  I can read C# and C++ but find the syntax makes the code harder to follow, but that is just lack of practice on my part.

    Down with VB(A), Long live VB .NET!



  • VB is "ready to go"

    I'll start by saying that I do not know VB, primarily because there are so many better options out there that I have never felt a need to learn it.  I have never programmed in it but I have read enough of it that I can get the jist of what's going on. 

    I think something that is a key contributor to its success as a "newbie" language is its "ready to go" quality.  With C,C++, even Java setting up a productive environment for the language takes time (sometimes A LOT of time).  Setting up a compiler/linker, debugger, external library paths, etc. in these languages can be quite intimidating for novices.  VB on the other hand allows you to start it up and hit the ground running, for better or worse.  



  • @variableName said:

    I'll start by saying that I do not know VB, primarily because there are so many better options out there that I have never felt a need to learn it.  I have never programmed in it but I have read enough of it that I can get the jist of what's going on. 

    I think something that is a key contributor to its success as a "newbie" language is its "ready to go" quality.  With C,C++, even Java setting up a productive environment for the language takes time (sometimes A LOT of time).  Setting up a compiler/linker, debugger, external library paths, etc. in these languages can be quite intimidating for novices.  VB on the other hand allows you to start it up and hit the ground running, for better or worse.  

    how hard is the system equivalent of "rpm -Uvh --get-dependencies gcc*.rpm"?

    I don't remember if it was redhat or another linux variant that had "rpmfind"

    man that was sexy. 



  • @GoatCheez said:

    Frankly, I think that there is only one reason to start a project in VB.NET, and that reason isn't a very good one. The only excusable reason to use VB.NET is if NO ONE on the team knows ANY OTHER LANGUAGE besides VB, and the team HAS to have the project done YESTERDAY. If a person claiming to be a programmer knows only VB.NET, and refuses to learn any other language (or is incapable), then in my opinion that person shouldn't be used for any serious projects ever. I haven't seen a VB.NET project in at least the last year that a customer has sent in where I've gone "Wow, this is pretty clean and readable. This person can write really nice, clean, code."

    The ONLY differnces between VB.NET and C# are syntax and a few obscure features.  VB.NET is fully object oriented, and C# has the forms designer that people always claimed was responsible for much of the spaghetti coding style in VB.  You can run fxCop on VB.NET assemblies to make sure they follow all of the standards, just like you can for C#.  The reason you see so much bad VB.NET code is due to the programmers, not the language.  If you read this site often, you know that bad code can be written in any language.

    I moved from Java to VB.NET, and I don't really miss anything from Java (other than checked exceptions, but that is a whole other can of worms).  If you're used to C/Java syntax you'll like C# better and if you're used to VB syntax you'll like VB.NET better.  If you've only coded in Ruby or Python it would probably be a toss-up.



  • @burnmp3s said:

    @GoatCheez said:

    Frankly, I think that there is only one reason to start a project in VB.NET, and that reason isn't a very good one. The only excusable reason to use VB.NET is if NO ONE on the team knows ANY OTHER LANGUAGE besides VB, and the team HAS to have the project done YESTERDAY. If a person claiming to be a programmer knows only VB.NET, and refuses to learn any other language (or is incapable), then in my opinion that person shouldn't be used for any serious projects ever. I haven't seen a VB.NET project in at least the last year that a customer has sent in where I've gone "Wow, this is pretty clean and readable. This person can write really nice, clean, code."

    The ONLY differnces between VB.NET and C# are syntax and a few obscure features.  VB.NET is fully object oriented, and C# has the forms designer that people always claimed was responsible for much of the spaghetti coding style in VB.  You can run fxCop on VB.NET assemblies to make sure they follow all of the standards, just like you can for C#.  The reason you see so much bad VB.NET code is due to the programmers, not the language.  If you read this site often, you know that bad code can be written in any language.

    I moved from Java to VB.NET, and I don't really miss anything from Java (other than checked exceptions, but that is a whole other can of worms).  If you're used to C/Java syntax you'll like C# better and if you're used to VB syntax you'll like VB.NET better.  If you've only coded in Ruby or Python it would probably be a toss-up.

    I quite literally translate back and forth to and from VB.NET and C# all the time. So, I never said nor would I ever say VB.NET was incapable in any respect when compared to C# (although you will probably find evidence otherwise if you search older posts of mine), I simply stated that I don't think it's a wise choice to start a project with VB.NET. My reasoning is kind of along these lines:

    Let's say we have an American... normal average American person. Obviously, this person speaks American english. Now, let's say this American approves loans. Three clients come in to get their loans approved. Let's say one of the clients is British, another is Australian, and the third is Spanish. Now, let's also say all of them brought in their loan approvals in their native language. The American should have little difficulty reading the British and Australian's proposals. He won't be able to read the Spanish guy's but since Spanish is so popular, he can probably find someone to translate for him... This comparison is flawed to a degree, yes, but it serves a point.

    If you take a look at the breakdown of programming language usage, the top three are C, C++, and Java. C# syntax is almost identical to these languages. It's simply a smarter choice to choose a language that shares a similar syntax to the most popular languages. More people will be able to read and understand the program code. I'm sick and tired of people claiming that VB is easier to read. I REALLY doubt that anyone with a background of C,C++, and/or Java would find VB code easier to read than C#. In my opinion, the only reason that VB.NET exists is so that all the people who learned VB as their first language have something familiar to work with. It's not smart to learn VB.NET as your first language these days. It'll simply make it harder to learn other languages.

    It just doesn't go past that. That's all there is to it. Both are capable languages.

     

    Various Sources: 

    http://www.tiobe.com/tpci.htm

    http://www.dedasys.com/articles/language_popularity.html

    http://radar.oreilly.com/archives/2006/08/programming_language_trends_1.html

    http://journal.boblycat.org/node/1149 

    http://www.complang.tuwien.ac.at/anton/comp.lang-statistics/



  • @GoatCheez said:

    If you take a look at the breakdown of programming language usage, the top three are C, C++, and Java. C# syntax is almost identical to these languages. It's simply a smarter choice to choose a language that shares a similar syntax to the most popular languages. More people will be able to read and understand the program code. I'm sick and tired of people claiming that VB is easier to read. I REALLY doubt that anyone with a background of C,C++, and/or Java would find VB code easier to read than C#. In my opinion, the only reason that VB.NET exists is so that all the people who learned VB as their first language have something familiar to work with. It's not smart to learn VB.NET as your first language these days. It'll simply make it harder to learn other languages.

    Personally I think syntax is one of the least important features of a language, so as I said I consider C# and VB.NET to be basically the same language.  I agree that C/C++/Java programmers will like the C# syntax better.  Neither syntax is state of the art, and most people like the changes that newer languages like SmallTalk, Python, and Ruby made to the standard C style.  Just think of what would have happened if every new language after COBOL (the Java of its day) used COBOL-style syntax.  It certainly would have been easier than having to learn that brand new C language's syntax.  I can't say that VB syntax is better than C#, but saying we have to use C syntax forever is silly.

    Also, saying that learning VB.NET first will make it harder to learn other languages is ridiculous.  How long does it take to learn C syntax?  It's not that complicated.  If anything I would say the best approach would be learn a few very different languages, to be better prepared for any new language advancements later on.  Learning a low level language (C, FORTH), a .NET language, a functional language (Ocaml, Scheme, Lisp), and a modern scripting language (Ruby, Python) would be a good start.  If you're expecting to learn C# now and never have to learn anything new for the next 10 years, then you are might be in trouble.



  • @burnmp3s said:

    Also, saying that learning VB.NET first will make it harder to learn other languages is ridiculous.

    Not exactly rediculous. Definitely not the strongest truth out there, but it is simple fact that when someone learns:

    int a = 1;

    vs

    Dim a as Integer = 1

    And then they try to move to C where they need to learn the syntax:

    int a = 1;

    I wonder who's going to pick up the syntax quicker.... Seriously... It's a valid point that's obviously true. I do agree on the multiple language approach though. I just advise against learning VB first.



  • @burnmp3s said:

    ...newer languages like SmallTalk...

    SmallTalk was developed in the 70s, while C was still young and Java was just a glint in Gosling's eye :)

    -cw



  • @GoatCheez said:

    If you take a look at the breakdown of programming language usage, the top three are C, C++, and Java. C# syntax is almost identical to these languages. It's simply a smarter choice to choose a language that shares a similar syntax to the most popular languages.

    See, this is where I feel the "reinventing the wheel" comes in.  C# is so close to Java 1.5 that it's hardly worth disambiguating.  (I'm claiming ignorance here, cause I haven't actually used C#).  I just fail to see the point to making yet another language that is so much like another one that already exists.  I understand that they want to take an idea and make it better, but I'm sure M$ tried to do that with J++.  Now where did that language go (well, besides being renamed to C#)? :P

    It's funny lately how programming languages are a popularity contest.  In the end it's all about marketing and the huge corporation of M$/IBM/whatever pushing new languages that are different enough from others that they aren't quite compatible.  Just more vendor lock-in for us to deal with.  Wait 10 years and see where your C# or VB.NET code support is... or Java for that matter.  I believe that C++ will still be alive and kicking though.

     



  • @skippy said:

    See, this is where I feel the "reinventing the wheel" comes in.  C# is so close to Java 1.5 that it's hardly worth disambiguating.  (I'm claiming ignorance here, cause I haven't actually used C#).  I just fail to see the point to making yet another language that is so much like another one that already exists.  I understand that they want to take an idea and make it better, but I'm sure M$ tried to do that with J++.  Now where did that language go (well, besides being renamed to C#)? :P

    It's funny lately how programming languages are a popularity contest.  In the end it's all about marketing and the huge corporation of M$/IBM/whatever pushing new languages that are different enough from others that they aren't quite compatible.  Just more vendor lock-in for us to deal with.  Wait 10 years and see where your C# or VB.NET code support is... or Java for that matter.  I believe that C++ will still be alive and kicking though.

    A language isn't all in it's syntax. Each one of those languages has a different set of libraries that are used to create the actual applications. They also differ in how they run. C++ and C are compiled into machine language, and can have direct access to whatever hardware they please. Java is touted as a cross platform tool, runs inside a virtual machine, and tries to limit direct access to anything... It's native libraries try to simplify anything you'd want to do so that you don't have to focus on hardware. DotNet kinda fills in some of the gaps between these two. It has a good API that is sorta cross-platform compatible to an extent... and can be used pretty damn well cross platform if you adhere to certain rules. There are other things too, mostly trying to be like Java, but different enough so that people can still see a difference. The main thing I hear M$ touting is the "managed" aspect of DotNet... The point is though that even though these languages share similar syntax, they are each used to solve different problems. For this reason I don't think Java or C++ will disappear. C# might, but hopefully not before VB ;-P... As for in 10 years, who really knows....


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.