TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why Visual Basic is (supposedly) better than C#

20 点作者 senic大约 12 年前

14 条评论

rohansingh大约 12 年前
Sigh. I'll actually do the job of debunking these one by one.<p>1. Almost every mainstream language has case-sensitivity. This avoids ambiguity by having only <i>one</i> 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.<p>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.<p>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!"<p>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.<p>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".<p>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:<p><pre><code> _myButton.OnClick += ... (tab to autocomplete new delegate and handler) </code></pre> 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.<p>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 &#60;property name&#62;" and hit TAB. The behavior is then exactly the same.<p>Regardless, still a comparison of IDE features rather than languages.<p>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.<p>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.<p>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.<p>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.<p>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."<p>I fail to see why using a List&#60;string&#62; is somehow harder than string[].<p>In conclusion, I really have to hope that this is a joke.
评论 #5278304 未加载
评论 #5278414 未加载
评论 #5278380 未加载
评论 #5281526 未加载
评论 #5278392 未加载
jeremysmyth大约 12 年前
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:<p><i>Andy ‘Wise Owl’ Brown decided to write a tongue-in-cheek rant whilst he could still remember the pain-points</i><p>(it's in the <i>very first sentence</i>)
评论 #5278501 未加载
tragomaskhalos大约 12 年前
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.<p>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.
评论 #5278960 未加载
UnoriginalGuy大约 12 年前
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.<p>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?<p>While some of this MIGHT be possible with VB.net, it is a lot trickier since whitespace is "content" in that language.
redact207大约 12 年前
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&#60;tab&#62; if(is&#60;tab&#62;) { refre&#60;tab&#62;;<p>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.
评论 #5278206 未加载
anton_gogolev大约 12 年前
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.<p>And comparing "&#38;&#38;" and "and"? Really?
评论 #5278198 未加载
评论 #5278757 未加载
评论 #5278134 未加载
wilhil大约 12 年前
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.<p>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.<p>In addition, there are so many more articles/examples/open source projects and just help out there for it.
评论 #5278521 未加载
mzf大约 12 年前
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.
felipebueno大约 12 年前
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.
a_a_a大约 12 年前
From the author's blog<p><a href="http://www.wiseowl.co.uk/blog/s243/vb-c-sharp.htm" rel="nofollow">http://www.wiseowl.co.uk/blog/s243/vb-c-sharp.htm</a><p>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. ...
afshinmeh大约 12 年前
You said `&#38;&#38;` 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...
评论 #5278252 未加载
评论 #5278571 未加载
评论 #5278525 未加载
评论 #5278200 未加载
billpg大约 12 年前
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.
tehwalrus大约 12 年前
Keywords..... keywords everywhere....
Nordvind大约 12 年前
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.<p>Let's just <i>bury</i> that whole idea of 'programming for non-programmers' along with ugly shit that arose from it (cobol, vb, etc).