CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Karl Seguin

developer @ Fuel Industries ottawa, ontario

Language Proficiency - C# or VB.NET?

In a somewhat unrelated comment to Sahil's really-should-remember-but-gonna-forget-and-get-bit-in-the-ass post, Scriptor pointed out how little VB is used here at CodeBetter. While I'm too new at CodeBetter to really comment to that specific charge, I've always have something to say about the VB.NET vs. C# thing.

When it comes to writing .NET material, it obviously depends where your material is going to end up. Although blogs have become leading sources of technical information, it's unreasonable to ask bloggers to use more than one language (I know that's not what you were getting at Scriptor). When you are writing an online publication however, any downloadable samples should be available in both languages (unless the example is extremely trivial). If you only make it available in one language, someone will ask for it in the other (sooner rather than later). What about code samples within the article? Well, every time I wrote an article for MSDN, I was gently encouraged to make sure the samples were available in BOTH languages.  Personally I find this makes articles too cluttered and is really unnecessary (though I did do it at first). I strongly believe that the best approach for article samples is to use C# and VB.NET interchangeably. I haven't written a book, but I'd think that's the best solution there also (unless you want to sell a C# and VB.NET version, which I consider lame in most cases).

Now, this really leads to my main point. Every VB.NET developer should be able to easily read C#. Every C# developer should be able to easily read VB.NET. First, it's bound to come in handy more than once. Second, it's nice to have on your resume or in interview tests. Third, neither language is the dark side - stop being such a nerd. Forth, it should take a very small amount of time to get up to speed with the new syntax. Fifth, if everyone writes their articles/books the way I think they should (see above), you won't have a choice. Spend 2 hours every Friday with Snippet Compiler and play around in the other language.

Although you should be able to easily read both languages, what should you write real code in? Whichever you feel more comfortable in. If people are telling you that one's better than the other, or that VB.NET sucks, then there's a good chance they aren't very good programmers (ignorance isn't a good quality to have in this business). VB.NET isn't more productive, and C# isn't more powerful. A good programmer will write good code in either language. A bad programmer will write bad code in either language. Part of me wants to say VB.NET makes it easily to be sloppy, for example one could turn off option strict or use on error resume next, but a bad programmer in C# could just as easily only use System.Object and swallow exceptions. I do wish VB.NET had a 3rd "option really really strict" option that disabled a handful of more "features", but in the end it really is the person and not the language.


Comments

Sahil Malik said:

Tell ya sump'n funny. At a recent MVP get together, folks raised this issue of "Why am I a C# MVP, when I do ASP.NET/VB.NET/...".

So the MSFT guys said - Don't get too religous about your language.

My answer was - We're not religous, we're spiritual.

So yes, it is the framework, and lets not get too hung up on the language.
# March 31, 2006 12:39 PM

Jason Bock said:

Why people still talk about "VB vs. C#" is a mystery to me. Use what's best for the problem at hand. Knowing the framework is a bigger key than "picking a language." I use both, although most of my clients have used C# in the past year or so. I'll use F# or IronPython if they want me to. Languages are fun - let's make the conversation, "VB and C#".
# March 31, 2006 12:57 PM

Pete Koutoulas said:

Bravo Karl! That could be the best single piece ever written on the C# vs VB holy wars. Can we now declare it a draw? (Not likely...)

*STANDING OVATION*
# March 31, 2006 1:57 PM

Raymond Lewallen said:

I try to mix it up in my posts, but do more VB than C# because over time, people have commented on how they appreciate the fact I did my posts, code and examples using VB.  Nobody has ever said "thank you for doing this code in C#".  This is because the primary language you find is C# and people appreciate the VB stuff when they happen to come across it.
# March 31, 2006 2:13 PM

Sam Gentile said:

The language wars are stupid and make CB look crappy as we have been doing this a million times since 1999. Its disapointing that we are stooping this low again. There are no languages per se in .NET anyway as 98% of the code in *any* .NET program is either the CLR or a .NET Framework Library call. The quicker people realize that and that "Its The Runtime Stupid" (http://codebetter.com/blogs/sam.gentile/articles/141815.aspx), the better they will be as .NET programmers. Any C# program is virtually interchangable with any VB.NET program and vise versa. Its all the framework calls.
# March 31, 2006 2:34 PM

karl said:

Jason:
Despite my title, i think it's clear that the intention of my post was indeed "c# AND vb.net", so I couldn't agree with you more. Languages are fun, and useful to know (even if it is easy), thus everyone should be able to understand both.

Sam:
I'm not sure you understood what I was trying to say, or I don't understand what you're trying to say. My point was three fold: authors should target both languages as best as possible, everyone should know both language because it's easy and useful and the language wars ARE stupid.

I can't say I agree wth your statement about there not being a language in .NET. I'm not sure how realistic it is. I think it might be somewhat out of touch with the challenges some developers continue to face. Sure it'd be great if every programmer was a master architect, but they aren't, and calling them stupid isn't the way to solve the problem. Like it or not, people DO have a hard time with languages. HR DOES want to know if it ought to hire VB.NET or C# developers. And I DO have to maintain someone else's code in C# or VB.NET - not IL.

General programming concepts are far more significant and fairly language agnostic - agreed. But no one's stooping low by saying people should understand both C# and VB.NET, because not everyone can. And suggesting that people make sure samples are available in both C# and VB.NET is a good one, because mixing languages for a given project has some obvious drawbacks.
# March 31, 2006 3:17 PM

Sam Gentile said:

I misinterpreted your post thinking it was another "stupid" language war. I stand corrected as I agree with your three conclusions. I am not calling anyone stupid. "Its the Runtime Stupid" is an expression of something thats obvious (see Google search for Its the XXX Stupid http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGIC,GGIC:2006-02,GGIC:en&q=Its+the+Stupid ). No one interpreted it as calling anyone stupid when it was published in 2002 and there were more than 50 collected agreeing posts. Sorry for the misinterpretation.
# March 31, 2006 4:23 PM

karl said:

No harm no foul..sorry if I got slightly defensive :)
# March 31, 2006 4:41 PM

Sam Gentile said:

No problem and welcome to CodeBetter BTW, glad to have you.
# March 31, 2006 4:43 PM

Sahil Malik said:

Okay now Microsoft will create so many differences between VB.NET 3.0 and C# 3.0 that this post will be invalid huh?
# March 31, 2006 4:52 PM

Jason Haley said:

# April 1, 2006 6:34 AM

Derek said:

Personally, I prefer VB.NET.  The intellisense was a lot better IMHO in VS2003.  But now with VS2005, it's a moot point.  I still prefer VB.NET over C#.  But I do agree that any ".NET programmer" should be able to read (and code) in both languages.  And maybe an obscure RPG.NET or other rare example as well.  Excellent post.
# April 3, 2006 4:45 AM

Jordan said:

Yeah, any upcoming changes which would branch vb.net and c# further apart are about worrisome, no?
# April 3, 2006 11:55 AM

Jay said:

Hmmmm.. Excellent! One question: I heard a rumor that Microsoft is gonna make VB.Net obselete??? Is that true??? I'm 99% sure its not gonna be. What do you guys say?
# April 28, 2006 1:55 PM

karl said:

There are certainly no sign of it slowing down any time soon. From past conversations with some of the VB.NET team, Microsoft is standing firmly behind VB.NET.
# April 28, 2006 3:54 PM

muhannad said:

dddddd

# August 28, 2007 5:16 PM

phx said:

"..and C# isn't more powerful.."

Anonymous methods.

A non-broken ternery operator.

"Unsafe" blocks.

Theyre the valid reasons. Then my pet peeves about VB:

Hard to read nullable types (and generics)

Verbose syntax - and redundancies like "readonly" on properties

Functions not returning values only a warning?

# September 9, 2007 10:55 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!