In an attempt to weigh in one of the greatest programmer death battles since Big Endian V. Little Endian, I am going to make my case for C# over VB.Net. We all know that, for the most part, you can do everything in VB.Net that you can in C# and vice versa. There are some things in VB.Net, like optional parameters and parameterized properties that I particularly like, but they don’t outweigh some of VB.Net’s drawbacks.
The human eye is trained to love things that are symmetric. Supposedly, the more symmetric a person of the opposite sex is, the more attractive we tend to find them. I think that for me, this holds true with programming languages. If you are someone with taste, then, surprisingly, you might love those curly brackets that people just love to hate. Why? Because it’s symmetric.
This is a nice way of saying that all those If .. End If and For..Next blocks just look pretty bad because of lack of symmetry. Those funky curly brackets make things look clean, readable, and symmetric. It’s a thing of beauty. I challenge anyone to show me an MSDN code example where the VB code looks better than C#. Anyone? Anyone? Bueller? Bueller?
Taste is important. I mean who wants to look at something ugly all day. VB.Net is just as powerful as C#, but it is pretty damned ugly, even on a good day. This sort of makes it hard to learn, even though BASIC was probably one of most people’s first languages, if they started as a teen like I did.
This is why I never learned Perl. Perl is butt ugly. If Perl was a baby, even its Mama would even think that it was ugly. To this day, I really don’t know much about Perl, and I am almost proud of that. Who the hell chooses to use Perl now? If you are one of these people, then I think that it’s too late for you. You drank the Kool-Aid and pray to Larry every day. You will need some re-education to come back into the real world where languages don’t look like puke. But in all fairness, Perl has one thing going for it. It’s where we get Regular Expressions from, which look pretty funky as well, but hot damn are they powerful. They are like the Mac Truck of string manipulation, while you’re sitting there driving your little pinto with your one off string functions, but I digress.
Paul Graham always says that when you choose a language, you are not choosing a language as much as a community. This is so true. That’s why proponents of VB say that there are more developers who know VB than C#. This may be true, but what they really should be asking is how many good developers would choose VB over C#? My experience, anecdotal at best, tells me that with a few exceptions, that answer is zero. Why is that?
Well, if I’m looking for a Developer on one of my projects, I want one that has a certain amount of working knowledge of both Object Oriented Programming and Systems Programming. Why Systems Programming? Well, we live in a world where the law of leaky abstractions is in full effect. If people don’t know what abstractions that they are using, then the day that those abstractions fail, they will be caught with their pants down with only a hammer to use as a belt. That isn’t a pretty site.
So ask yourself a few questions. What languages do most people do Systems Programming in? Well, you guessed it, our lovable friend, the scripting language of the Von Neumann machine, C, and later C++. What languages have most people used for OOP in the past? Mainly C++ and Java. What language would people who are very familiar with C, C++, and Java choose? Ten points goes to the guy who said C#.
Now, I’m not a language bigot like most in the C# camp. I actually use VB at my job, because, well, everyone has to pay the mortgage. And there are a lot of VB guys out there that are hardcore. But we must remember why VB gets its reputation as a wimpy language. It’s because VB set the barriers to create desktop software way lower then they were with C++. I never did desktop programming in C++, but from what I understand, it was about as pleasurable as root canal.
So VB was sort of the best and worst thing that happened to programming. We now had this rich new abstraction for creating desktop applications that almost anyone could learn which had syntax that we loved when we were kids. Cause, after all, we were all young once.
But then something happened. The barriers were set so low that people who had no business being coders started to code little VB apps here and there, and they actually started to gain credibility, even though we all know that these guys were not ready for prime time.
If we kept good coders using VB, then they could have harnessed that new found power where they could in intelligent ways. We would have a tool that wasn’t a silver bullet, but raised productivity tremendously. But instead, we hired cheap programmers, because most companies don’t know a damned thing about the whole concept of a price to quality ratio. And thus, VB took us by storm.
Now there is one circumstance in which I would choose VB.Net over C#, and that’s when you have a lot of tried and tested legacy code in VB6 that you wanted to port over to .Net. This is dangerous too, because those conversion tools, like most things, almost never work the way that you want them too, even if you did code your app cleanly and in the right way. But let’s be honest. We all know you didn’t. But an even more dangerous situation is the one where people will start to code in VB.Net like they did in VB6 and VBScript. The language got even more ugly because it had to do new things and still have a semblance of backwards compatibility.
It’s like how all the C programmers who used C++ as a glorified C compiler. You could do some Jedi mini tricks on the compiler, and it would happily comply. That’s what made C++ so hot, and also what made it pretty damned ugly too. Java was prettier but had so much hype attached to it that it scared me. It also arbitrarily took away some of the cool features of C++ like preprocessor directives, Templates, and operator overloading. When I found C#, it first looked like Microsoft Java, so it turned me off. But once I really got into, it was like having a Paul on the Road to Damascus moment. Walk the path, and it will change your life forever.
So get over those squiggly lines, get yourself a C# book, and go to town. It may be painful now, but trust me, you will love yourself more in the morning.
Monday, February 12, 2007
Subscribe to:
Post Comments (Atom)
1 comment:
Good post.
I have two comments:
1) Some of the concepts that you have expressed appear to be things that you have copied from more illustrious bloggers. Nothing wrong with that, of course, but the use of one's own words tends to promote the feel of authenticity, which is so very critical in a blog.
2) Why do you believe that regular expressions come from Perl? Is it lack of knowledge of CS history, or is it merely laziness?
Post a Comment