Hacker News new | comments | show | ask | jobs | submit login
Why Visual Basic is (supposedly) better than C# (simple-talk.com)
20 points by senic 1609 days ago | hide | past | web | 43 comments | favorite



For those who aren't sure if it's satire or not (90% of other comments as I write this), I'll give you a clue:

Andy ‘Wise Owl’ Brown decided to write a tongue-in-cheek rant whilst he could still remember the pain-points

(it's in the very first sentence)


It's not very good satire. Some of the points are potentially real; it's not clear why they wouldn't matter. When you label something "No offense intendend" and proceed to make offensive statements, your preface isn't helping. Prefacing something with small-font "this is toungue-in-cheek" and proceeding to mix potentially real issues with non-issues a novice isn't helpful. I don't see how spouting irrelevant nonsense is satirical in any case. Maybe it's funny? AndAlso vs. &&; haha? If so, I don't get it. Instead it comes across as someone who really was annoyed, knew it wasn't for rational reasons, and thought head off criticisms this way.

Whatever. Why is this on HN?


>It's not very good satire.

If it confused people then it IS very good satire.

>Some of the points are potentially real; it's not clear why they wouldn't matter.

That's the very essence of satire. It has to be somewhat connected to reality.

What you seem to ask for is "grotesque statements" or "surreal humor".


I expect satire to have a point. This doesn't. Is he trying to make fun of all those people hating these C# features? Never heard of anyone who seriously complained about these. Is he making fun of VB misfeatures? Doesn't seem to make sense either.

It doesn't make sense as satire. It does as shallow griping.


Behind the satire lurks a serious point though - a lot of C# programmers need to get over their snotty attitude to VB.NET, because once you get past the whole VB stigma thing they're basically isomorphic.

One point the guy didn't make was that VB.NET has XML literals, which are very nice if you like that sort of thing.


I find that most C# developers don't have strong feelings about VB.Net; if they comment on it negatively, they are probably trying to avoid the old stigma by association.

Although VB.Net's syntax is not really my cup of tea (it's a bit too wordy for me), I find that many of the keywords make a lot more sense than the equivalent C# ones. E.g. explaining the meaning of "shared" is a lot easier than explaining "static", because the concepts it brings to mind are closer to what's actually happening.


The reason I /like/ semi-colons is that I can automate code formatting to my pleasure. If I open someone else's code file and they are doing strange things (e.g. spaces instead of tabs, { on the same line, etc) then I can have the IDE re-format everything in a split second to my preferences, and they can do exactly the same.

Or if the project manager is requiring all code to be formatting a certain way then I can re-format the code before I submit it. Plus with a language you can so quickly and painlessly re-format, why even require code style standards that dictate whitespace?

While some of this MIGHT be possible with VB.net, it is a lot trickier since whitespace is "content" in that language.


Sadly this is how many VB guys think. I'm a C# guy and I honestly don't care, it all compiles to the same MSIL anyway and intellisense makes it easy to write either. Seriously if my keyboard was ever logged, all it'd reveal is txtI<tab> if(is<tab>) { refre<tab>;

One reason VB has such a stigma attached to it is because it's common to see it written by non-developers, particularly lurking in excel as some background macro. Anyone can butcher any language - it's just a matter of preference. Anyone who touts a language so strongly has clearly lost the purpose of having it and is not worth debating with.


I know of a company where the manager requires VB code, because he wants to be able to read it from time to time!


Oh what a piece of BS. Yet another shallow, mechanical comparison of tiny "features" and IDE peculiarities with no other purpose in life other than initiating a decade-old flamewar.

And comparing "&&" and "and"? Really?


I only realised the article was a joke when he was suggesting that & is a more obvious, friendly, string concatination operator than +.


wait, the article is not sarcasm? I thought the site is some kind of the Onion for programmers?


The main sarcasm is people missing the point, while it's there, in the first BLOODY line of the article.


It's in a box which has the effect of making it invisible.


Doesn't look like one.


"Andy ‘Wise Owl’ Brown decided to write a tongue-in-cheek rant".

First line in the article.


Sigh. I'll actually do the job of debunking these one by one.

1. Almost every mainstream language has case-sensitivity. This avoids ambiguity by having only one right way to express a given variable. Since Visual Studio has excellent autocomplete, you don't have to repeatedly use SHIFT, and you are unlikely to accidentally mistype the variable name.

Of course, when I see an argument like, "When you accidentally leave Caps lock on, it really matters," I have trouble taking the author seriously.

2. The reason switch is different from if-else is something you can learn from any language primer. The author makes the following argument: "It’s easy to forget to type in each of these Break statements!"

In fact, it's not easy. The "break" is required by C# in any non-fallthrough cases. Not typing it will generate a compiler error. Not something you can miss.

3. Here the author makes a red herring of an argument regarding how you can use Visual Studio to setup event delegates for UI components. Apparently some paradigms are supported for VB.NET, and others for C#. Of course, what your IDE supports has nothing to do with which language is "better".

The basic argument is that you need to return to the design view to create an event delegate rather than being able to do it from code view. Of course, most experience C# writers will stay in code view and just type the following themselves:

    _myButton.OnClick += ... (tab to autocomplete new delegate and handler)
4. The author then continues to say that the comparison symbols in C# are "stupid" compared to Basic's "And", "Or", etc. This argument almost doesn't deserve to be addressed, but I'd like to point out that C# has the advantage of not overloading the assignment operator (=) with equality comparison (==). Keeping these separate prevents a common class of error.

5. The author fails to trigger autocompletion for creating a new property in C#. This is largely because he doesn't know that the way you do this in Visual Studio for C# is to type "prop <property name>" and hit TAB. The behavior is then exactly the same.

Regardless, still a comparison of IDE features rather than languages.

6. The author complains that the "PMT" function, which "calculates the annual mortgage payment for a loan", is not a builtin in C#. I am not rightly able to apprehend the kind of confusion of ideas that would provoke such a statement.

7. The author argues against needing semicolons in C# for line endings. Alright, at least this is actually about the language itself. Personally I'm not a huge fan of needing semicolons either. A style thing, but I'll let it stand.

8. The author complains that the type for a variable declaration precedes the variable name in C#. Somehow this is a major problem. Obviously just scraping the bottom of the barrel here.

9. The author complains that C# does not automatically cast enums to ints or other types. I'll leave it to other sources that talk about the pros and cons of implicit casting a la Scala.

10. The author complains that is not possibly to reinitialize arrays to a new length in C#. He admits that he has been told that, "I should be using lists and not arrays anyway." But he retorts that, "The point is that - as so often - Visual Basic makes something easier to code than C# does."

I fail to see why using a List<string> is somehow harder than string[].

In conclusion, I really have to hope that this is a joke.


>Andy ‘Wise Owl’ Brown decided to write a tongue-in-cheek rant whilst he could still remember the pain-points

It's at the top of the freaking article.


Sorry. Early morning over here. I guess I suffered a reading comprehension failure.


The tone you've decided to take is rather unfortunate. In fact many of your counter-points seem to essentially be "well he is just a stupid-head!"

You spend more time attacking the author than actually addressing his points. Which is just a shame. In fact most of your list is just a different attack against the author.

I actually prefer C# (and was a long term VB 6.0 user). But even with that being as it is, I still don't feel your post comes at this in a constructive way.


You're right, I was a bit short in some cases. But really, it is aggravating to have to explain why PMT() should not be a builtin in the global namespace.


> The author then continues to say that the comparison symbols in C# are "stupid" compared to Basic's "And", "Or", etc. This argument almost doesn't deserve to be addressed

It does. I'm pretty sure VB's "And" and "Or" don't short-circuit…

> 8. The author complains that the type for a variable declaration precedes the variable name in C#. Somehow this is a major problem. Obviously just scraping the bottom of the barrel here.

The author also complains that out-parameters have to be annotated as out-parameters in C#, apparently does not realize parameters don't have to be out-parameters.

> But he retorts that, "The point is that - as so often - Visual Basic makes something easier to code than C# does."

Basically, he complains that C# makes it harder to do the wrong thing than Visual Basic. Which tells you a lot about the mindset.


> It does. I'm pretty sure VB's "And" and "Or" don't short-circuit…

Interesting, didn't know that. However, I got the feeling that he wasn't talking about how the operators work so much as what they are named.


You are correct; 'And' and 'Or' do not short circuit. You have to use 'AndAlso' and 'OrElse' if you want short circuiting.


AndAlso and OrElse are the short-circuiting equivalents.


10. The author complains that is not possibly to reinitialize arrays to a new length in C#. He admits that he has been told that, "I should be using lists and not arrays anyway." But he retorts that, "The point is that - as so often - Visual Basic makes something easier to code than C# does."

I feel like this case in particular captures the essence of a cultural difference between C# and Visual Basic. However much it's grown over the past 20-odd years, VB's roots as a RAD kit - a platform designed to let people slap together code without having to worry themselves overmuch about engineering concerns - are still with it.

It leads to things simply being seen differently. To the author, the point is that it's easier to do X, as simple as that. To the kinds of programmers who tend to gravitate toward C#, on the other hand, Redim Preserve is a code smell that indicates it's time to rethink your choice of data structures. The idea of having a language-level feature whose only purpose is to make it easier for people two write bad code is anathema.

I don't want to hate on VB.NET too much, because overall it's a very good language. I personally prefer VB's switch statement, for example. Deciding between a jump table and a sequence of conditionals should be the compiler's job, not the programmer's. However, I do have one huge complaint about it in there are some features that it never should have inherited from VB6 in the first place. Phrases like 'Redim Preserve' and 'On Error Goto Next' always make me shudder. And when I'm called in to help figure out performance and stability issues in our VB projects, they play a part in my findings with alarming regularity.


10 is weird anyway even if it's satire. System.Array.Resize(ref array, newSize)


I used VB for many years and didn't understand why the C# people mocked it... then, about 3-4 years ago I switched and have not looked back.

In my honest opinion, whilst VB is obviously fully supported, C# just "feels" more professional... When you get your head around the syntax, you can seamlessly move between C#/Javascript and many other languages that all follow similar syntax without even thinking.

In addition, there are so many more articles/examples/open source projects and just help out there for it.


Learning C# to make switching to Javascript easy seems somewhat backwards.

Plus it's not as if it's hard to leap between C-syntax and VB's syntax anyway. They're both imperative languages with much of the same core blocks (albeit often called differently). Switching between such languages shouldn't take more than a quick glance through a "beginners guide" and then some cross-referencing as you go alone (like using an English/French dictionary). It's not like they're different paradigms like functional languages (Lisp et al)


I didn't learn C# to make Javascript easier - I switched to C# due to the majority of work in my specialty requiring it more and the fact it paid a lot more.

The side effect.... I always found that programming VB was easy but switching to Javascript AND other languages took a few minutes to get my head around (or I would mix some syntax up)...

Now I find that I can flawlessly switch between Javascript, C# and a few other languages without losing speed at all, and generally, I find that I am a much better programmer for switching.


I use both VB.NET and C# and I'm actually bothered by the missing case-sensitivity of VB.NET because it makes hard to impose naming conventions. For example if I have a class named as MyClass then it would make sense to name an instance of it as myClass. Unfortunately it confuses intellisense and it suggest me later always the class not the instance. Thereby I'm forced to name my instance as MyClass1 or something else that doesn't feel so natural.


Not sure if the article is a joke or sarcasm or something but the author makes some good points. I use VB.NET in my daily job and Python for my side projects. I like both (but Python is definitely my favorite language) and I like it because it is really simple to read and to write. I know some C like languages too and use it a lot (Javascript) but that curly-braces and semi-columns thing feels just annoying to me.


From the author's blog

http://www.wiseowl.co.uk/blog/s243/vb-c-sharp.htm

WHY VB TRUMPS C#, AND HOW TROLLS DON'T AGREE! I recently wrote a blog on why (I believe) VB is a better programming language than C# - I wasn't prepared for the flames this would unleash. ...


You said `&&` is a stupid symbol and `and` is a better one, right? Sorry I think you're wrong because it's a symbol that used in almost all programming languages include c, c++, JavaScript and...


`&&` and `and` have utterly different semantics: `and` does not short-circuit. `andalso` does.


> ['&&' is used] in almost all programming languages [including] c, c++, JavaScript and...

You mean all C-syntax languages. ;)

There's a hell of a lot of Turing complete languages that don't follow C's syntax (Python, Pascal, Lisp, Haskall, Scala, Erlang, Scheme, PL/SQL, JCL, COBOL, Logo, ALGOL, Fortran, Ada...and countless others which I've I've forgotten about or have never even heard of.

But sadly it seems many developers aren't even aware of the popular paradigms outside of imperative programming, let alone the numerous other imperative languages that were popular before C's syntax became the de facto standard template.


C and C++ also have 'and' :)

Check iso646.h


And `PHP` has it, also! But I didn't see any big application/repository that uses `and` instead of `&&`, honestly.


Since I prefer the Pascal family of languages I do actually like "and", but I will use whatever is the default in a given language.

This VB piece seems like a bit of VB programmer crap I usually hear from VB users that only dabble in programming without any proper developer education.


BTW, I think using `and` just make things more human readable, closer to what Martin Fowler says about "Good programmers".


I once left the caps lock on, but I dodn't notice for a few minutes because the editor kept correcting my typing to the right case. It was only when I came to a string literal that I noticed.


Keywords..... keywords everywhere....


Don't the point of such "Why eating feces is good" articles. I thought there are some converters from vb.net to C#, if there are none - then rewrite those damn tutorials, you'll end up saving much more health than if you do manual convertion.

Let's just bury that whole idea of 'programming for non-programmers' along with ugly shit that arose from it (cobol, vb, etc).




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: