VB.NET vs C#, round two

November 10, 2004

I saw on Dan Appleman's blog that a new version of his Visual Basic.NET or C#…Which to Choose? is available, reflecting the latest changes in VS.NET 2005. I immediately bought a copy from Lockergnome, apparently the only vendor that allows instant eBook downloads after purchase.*

There are no dramatic reversals of fortune here. As usual, it's all about the runtime. However, I was disappointed that Dan didn't cover the way his prediction in the original eBook has come true-- as nonsensical as it may seem, C# developers are paid more than VB.Net developers to write the very same .NET framework code. This isn't conjecture. It's a fact. Well, at least we can console ourselves with the many dramatic improvements in VB.NET; the language is legitimately a first class citizen in VS.NET 2005. Microsoft finally rectified all those annoying, boneheaded oversights-- compiler warnings, Using, and XML comments anyone?

I'm also wondering if, despite protests to the contrary..

The focus on languages over the past couple of years has truly astonished me. For example: at technical conferences you still often see separate VB .NET and C# tracks. Publishers would publish one book on a general .NET topic in C#, then a "port" of the book to VB .NET (or vice versa). Bookstores still classify books by language.

Don't get me wrong – it's not that the conference organizers and publishers were wrong to do this. They just deliver what they believe the market demands. Or, to put it bluntly, the existence of separate VB .NET and C# content is largely an indication that publishers, bookstores and conference organizers believe their customers are too stupid to realize the fundamental truth – that it's all about the framework. The language does not matter.

If you look at the total knowledge space of developing .NET applications in VB.NET or C#, about 95-99% of the information is identical between the two languages. This is a radical shift from the Visual Studio 6, where C++ programmers had MFC and ATL available -- two massive frameworks that VB6 programmers did not need to learn. At this point, the truth is that I could take the easy way out and simply say that the two languages are so similar that you should just choose whichever one you feel like -- it won't matter. But, this would be a cop-out -- like the kind of contests some schools do for kids where every participant wins a prize in order to build their self-esteem.

.. perhaps the choice of language is more significant than Dan realizes, due to his unusual dual C++ / VB background.

I, on the other hand, grew up with Basic. I don't enjoy parsing through C# code, and any C# code I plan to incorporate into my own projects, I always convert to VB.Net. I don't convert code because I feel morally obligated to; I do it because I feel like I don't really understand the code unless I've touched every line of it. I'm sure many C# developers who grew up with C or Java probably do the same thing. It's not that we can't use both languages interchangably, or understand each other, but the mental overhead of putting on different language hats sure as hell isn't helping us get work done.

In other ways, though, the choice of language really is a red herring. I'm starting to think the effectiveness of your IDE is more important than any language choice you can make. Here are the four items Dan lists as "significant issues" in choice of language:

  1. Background Compilation vs. Parser
  2. Migrating Existing Code
  3. Edit and Contine
  4. Refactoring

What do any of these things have to do with the languge? They smell like hardcore, low-level IDE features to me. The real money play is to invest in the IDE, not the languages. A kick-ass IDE will have a huge impact on your productivity compared to the utterly meaningless choice between editing VB.NET or C# in notepad.

* What is up with that? If I wanted to wait, I wouldn't be buying eBooks. Give me instant gratification, or give me death!

Posted by Jeff Atwood
144 Comments

In fact, the IDE has always been the strength of VB. Starting with VB1. That's why it is not surprising that most advances come in the form of IDE effectiveness. I'll pick QuickBasic (with no classes, OOP or what have you with a great IDE than C# or Java with Notepad.

rizzo on November 12, 2004 5:01 AM

My biggest reason for not using C# (I personally like the C language family) and instead work with VB - VB is not case-sensitive.

Why o why does anyone need case-sensitive programming languages today? There is not a single compelling reason for it that I can think of. Especially with an advanced IDE like Visual Studio that can convert the case of identifiers for you.


Wen Lai on November 14, 2004 2:23 AM

Amen. Case sensitivity is just plain wrong, as far as I'm concerned.

I was recently editing code where the C# developer used lowercase versions (dostuff) of the methods to indicate private, and uppercase versions (DoStuff) to indicate public..

ugh.

Jeff Atwood on November 14, 2004 5:06 AM

I like C# actually. I've used VB, Fox, SQL, Powerscript, Delphi, java, xml, html and more if you consider application scripting.

The primary reason I can see to keep case sensitivity though is for conversions from C++ to C#. I agree that insensitive coding is easier to read, and would not be surprised if down the road we would see a case insensitive version of this product. Perhaps they'll call it "C-Basic."

phonix on February 11, 2005 2:00 AM

Another reason other than the reason Jeff stated so gracefully is that having things case sensetive makes things easier to read. i don't use those visual editors. just give me a unix box with vi on it an i am all set.

AnimeGuru on March 23, 2005 12:21 PM

I've been vb.net for 3 years. I decided to use c# for my current project so that I could stick it on my CV (seeing as c# programmers get paid more!)

Yep - I can't stand case insensitivity. I too was wondering what the hell it was all about. Phonix comments about the primary reason for it's existance being for c++ conversions makes sense.

The thing that kills me though is those damn curly braces! {}

At the bottom of a complex page I've often got a dozen of the things trailing off...
}
}
}
}
}
}


I can never figure out what's ending what.

The other day, a Java guy at work said "yeah, alot of people put comments after the end elipse"

} // End foreach
} // End for j
} // End Method
} // End Class


Um - does this look like BASIC to anyone else?? ;-)

I think that, after this project, I'm going back to VB.

Oh - there's one other reason I can think of to use C# - it appears that the international community is adopting it more. Most of the opensource projects are in c# (well - for obvious reasons the Java ports are anyway... )


Damien on April 17, 2005 8:35 AM

I do not care .. i will do whatever my customer wants VB or C#

but rather be Called a Sharp developer than a Basic one

clement on May 6, 2005 7:05 AM

Well, I think it is a matter of history and IT culture. Why is COBOL so bad labeled, I had opportunity to work with it and I found it a great language for business applications. Actually add to it OO and you get perfect business language. But no, academics (professors) want their students to be scientists, science is math, and math is assembly and C language. Computer scientist is scientist so he respects C language and despise easier COBOL for business, along the way came C++ and VB, so scientist naturally choose C++ for really hard math formula programs, complex code gets popular with scientific institutions and the language gets the emperor of the programming languages title. With the hype comes marketing and business people look forward to have C++ top notch programmers as superior race of programmers. On the productivity level, VB amazes the managers, instead of being late, now they have VB coders who produce fancy GUI and fast applications (80% of the world is MS based). However, the hype holds for C++ and even if you can do it in VB in 1 month, give it 3 or 4 months and you have it in C++, bravo (now you got it complex and scientific). Along the way, IT students divide themselves in two camps. Top markers go for C++ with full steam and patiently accept the pointers induced crashes (assembly/C legacy of low level programming), another group of students, ones who got life (and lower marks for time lost on life) adopt easier yet more practical approach, VB is easy to learn, gets the projects done sooner, and GUI is cool. Yet they are lazy labeled, hence not professional, and really complex code still is done in C++. So the natural progression of VB as a language is stuck, what does MS have to solve if VB is used for small to middle range projects and its good for it. Why add to it anything nobody will use anyway. Along came Java and C++ scientific community cheered, no pointers = no crashes (less anyway), no viruses, reduced complexity, more productivity (even academics forgot why they insisted on pointers at first place and now teach Java). C to C++ to Java progression inherited Java scientific hype of C++, MS had to respond and they labeled their Java C# and finally added what they should have long time ago to VB.Net. The syntax of VB and C# is different but funcionality very similar. Yet true scientist is C syntax oriented and everybody respects those good students and not lazy ones so the hype holds, and is properly payed for. I'm currently Java programmer who only casualy worked with VB so for me its C# to adopt (I was C++ student) and Java is great language. Is it slow? not really. Case: Empty loop of 10 000 billion iterations.

Create a simple test class which times a loop. The Java definition is

public class Loop
{
public static void main(String[] args)
{
//10 000 billion iterations
long time = System.currentTimeMillis();
int REPEAT1 = 1000 * 1000;
int REPEAT2 = 1000 * 1000 * 10;
for (int i = 0; i REPEAT1; i++)
{
for (int j = 0; j REPEAT2; j++)
{
//do nothing
}
}
time = (System.currentTimeMillis() - time)/1000;
System.out.println("Time taken: (in seconds) " + time);
}
}

The C# definition is

using System;
class Loop
{
static void Main()
{
DateTime start = DateTime.Now;
int REPEAT1 = 1000 * 1000;
int REPEAT2 = 1000 * 1000 * 10;
for (int i = 0; i REPEAT1; i++)
{
for (int j = 0; j REPEAT2; j++)
{
//do nothing
}
}
TimeSpan time = DateTime.Now - start;
Console.WriteLine("Time taken: (in seconds) {0}", time.TotalMilliseconds/1000);
}
}

Result: Time taken to run -


C/C++ == approx. 1 month
C# == approx. 1 month
VB. == approx. 1 month
Java == Under one second

So does all this mean that Java is really faster than other languages? Hundreds of times faster?
No, of course I was joking. If you read the code, you probably assume that the benchmark measures the time taken for any language to iterate a loop counter. In fact the benchmark measures the ability of a language to optimize an application by eliminating inefficient instructions. The Java server mode JIT compiler eliminates the empty loops completely from the JIT-compiled code. So Java really does not execute these loops at all and thats a catch. Can other languages be optimized to do that too? Yes of course, its a matter of compilers.

Advice: Don't make syntax and compiler ruin your chances of getting bread. If you are good programmer, the code you make is complex to the degree it needs to be. VB code can be very complex according to the requirements, but languages themselves are very similar. So if you are ridiculed cause you are using easy to learn language (as it happened to me when I programmed COBOL) move on and give it some extra time to learn new syntax and let them pay you properly for the hype they created. As for the casing issue C/C++/Java/C# have been a case sensitive language from the very start of it, and how much are you ready to pay me if I take your lower case code and convert it properly for you (if its your only reason not to adopt more paying language then you are probably paying some pretty greenies anually for it anyway).

"Anis" (never study IT my son).

Anis on May 24, 2005 7:05 AM

I used to be a VB programmer, VB.NET and later Java and now finally C#. Clear and simple, C# code is easier to read and easier to find and visualize the logic pattern. If you write it in vb.net code, i just feel that the code is sucks, my eyes keep rolling of too much typing. C# is a very natually to code in OO but unlike VB.net, it seem too confusing. Last but not least, I like Java but Java is too slow and not much productivity to code in Java. If i have to choose between java and vb.net, i rather choose vb.net. Luckly, Ms knows that i love C coding standard, then Ms understand and specially design super C for me which is C++++ = C#.

Carso on September 23, 2005 2:41 AM

my eyes keep rolling of too much typing

Well, if you dislike the verbosity of VB, you must really hate typing English sentences..

Code will be read many more times than it is written (see pages 841-843 of Code Complete for citations on this) -- and verbosity is about producing code that's easy to read. So erring on the side of { } instead of "End If" isn't always a reasonable tradeoff.

The compiler may not care if your code is readable, but human beings do.

Jeff Atwood on September 23, 2005 4:10 AM

I personally like the braces and hate the words "End If". It's much easier to trace through the code and quickly figure out where the scope begins and ends because of the sharp visual difference that occurs when you have a single { on a line as opposed to a jumble of text.

People who write Visual Basic code also tend to be sloppy with their spacing, line breaks, indenting and case. Call me anal but it bugs me the same way seeing someone misspell the word "you're" as "your" does. The laziness complaint is a very serious thing when it comes to the business of programming. In my experience, VB.NET developers tend to care primarily about getting the program done whichever way possible instead of worrying about efficiency. C++ and C# programmers are more likely to care about getting it done well.

Kim on September 26, 2005 10:23 AM

When I write same code snippet using VB.NET and C#.NET, I found that exe created by VB.NET is less than C#.NET and C# Created exe under \bin\debug folder.

Jayant Kumar on November 14, 2005 6:51 AM

I guess I am in the minority when it comes to casing. I don't really like to have to declare variables like this: m_ProductID. I rather type productID or productId.

Car car = new Car();

looks cleaner than

Dim m_car As New Car

in my opinion.

TonyP on November 22, 2005 2:55 AM

How about..

Item 1tem = new Item();

No? I wouldn't consider this for the same reason I won't consider

Item item = new Item();

If your variables are that unimportant-- they're scoped really tightly and used for relatively simple stuff-- then just go with

Item i = new Item();

And avoid the brain damage altogether.

Jeff Atwood on November 22, 2005 5:00 AM

A "Car car" sounds like something my cat would cough up....

As said above, its not the language.....

steveW on November 22, 2005 7:37 AM

I'm not too sure what you are all going off about, I used to be a VB, Java, C++ developer up until VB 6. When .NET came out I thought i'd give this new fangled C# thing a go.. personally I liked it and found it quicker and easier to do things than in VB. (this was a personal choice).

I think what pushed me over the edge was this...
I had to write a serial port interface for an windows service I was writing.. try accessing DeviceIoControl in Kernel32.dll from VB.NET.. or any of the standard buffers..

I stand to be corrected, and I am not sure if it is available now in 2005 but I know this. I could do this in a single pure C# application instead of having to use someone elses crappy dll..

Something that bothers me also guys... if C# developers get paid more, what are you waiting for, become a C# developer today and GET PAID MORE rather than whining about it (duh!). (it is all the .NET framework as you say and the conversion really is not difficult at all)

It is reasonable to say this much though, from my experience and utilising such tools as BizTalk etc.. there is a fairly large amount of support for C#.. I believe this much..
- do what the customer wants
- do what makes you the most amount of cash
- do what keeps you more employable than the next guy.

Regards

Ryan

Ryan on November 27, 2005 9:07 AM

Simple answer, since its very first release.

Delphi has the best IDE of all the RADS out there.

Delphi 2006 takes it two notches up. The bar is set, and in those 4 points that the author gave, it has a A+ in all of them.

Esteban Pacheco on November 28, 2005 9:15 AM

I suspect the main reason that publishers release two different books is simply practical - lugging a 1200 page book when it could be 800 pages makes a difference.

foobar on November 30, 2005 4:59 AM

Here is another example:

VB.Net

Dim m_car As Car = DirectCast(mapper.GetObject(GetType(Car), Car)
m_car.Model = "Nissan"

C#

Car car = (Car)mapper.GetObject(typeof(Car));
car.Model = "Nissan";

TonyP on December 5, 2005 3:46 AM

I used to be a VB programmer since VB2 .. I've used VB for too much to be able to learn C++ (whenever I tried to learn the WIN32 APIs or the MFC/ATL I found that VB can do what I need in quarter the time and tenth of the effort, so I abandoned learning C++), but when I had the chance to do things in C#, I did (first I learned .Net on the VB.Net syntax .. then I found that C# is too similar to be a _true_ other language .. whatever I learn in VB.Net adds to my knowledge in C# and vice versa .. so why not add another language in my arsenal and have more oppertunities in work).

Now I'm paid more to do the same work (with the same effort), have much more respect for the same knowledge I have, and I'm treated better in the community (just out of not advocating VB anymore).

I'm not saying that I don't like VB, but if the hype says that you need to slightly adjust to become more professional-looking, I think I'll go with the hype.

Doctor xp on December 7, 2005 5:59 AM

Well, that too is a red herring, because you can write FORTRAN in any language:

http://www.codinghorror.com/blog/archives/000272.html

Jeff Atwood on December 27, 2005 6:33 AM

The argument that the modern IDE makes it easier to work with case-insensitivity can also be completely turned on it's head. It's very easy, if you have incorrectly typed a variable, to change it.
Maybe it is because I've grown so used to case sensitivity, and the importance of case to define meaning given a vague context (i.e. the ability to see the scope of a variable in any location) but I find case insensivity rather clumsy.
For a start, I often see code written that changes case at will because the programmer can't decide on a style. Should it be fooBar, FooBar or foobar? It changes all over the place, making the code very hard to follow. With case sensitivity, you are forced to make a consistent decision. Again, with the modern IDE, if you decide to change it, it is very quick and painless to do so. Though this argument could be countered, the refactoring tools used to quickly standardise the casing I find when it is imposed, it is followed more strictly.
Then there is the issue of differing public and local variables, made even more prominent with the advent of properties. I personally find Hungarian Notation and such likes to be far too pointlessly verbose. You can often tell from the context what a variable is. firstName will be a string for example. Add to that the context of assignment and it's even easier to tell. Hungarian notation then just complicates and clutters the code (as does endifs etc. imho, though I can understand the argument for clarity) With casing though, you can use a separate casing for differing scopes. I believe the standard .NET casing is lower-camel for parameters (and my personal preference for local variables) e.g. firstName and Delphi casing (all separate parts begriming with a capital) for public variables e.g. FirstName. This does make for clean and nice looking code imo.
And on side note, no-one should ever, ever, under any foreseeable circumstance, use all lowercase for compound variable names. It makes it almost impossible for people to read, especially if they don't know what the words are, and makes it very hard to glance over code.
As for the comment that implied the closer to the vernacular the better, this is not really the case. It's often cited that high level languages are closer to the vernacular than low level languages. While this is often true, this is not really the purpose. The idea of higher level languages is to shift from byte-pushing to being able to solve problems in a manner that is more familiar to the way a person would think about a problem. That is why there are so many different languages; each one is designed to solve a different problem, so exposes the functionality in a way that is closest to the way that particular problem would be considered.
The other problem is that the closer to the vernacular it is, the further it is from any other language. I can't begin to imagine what it is like for someone who doesn't speak English to learn English API's, let alone when most of the language they are programming in is alien to them.
Braces and other intuitive symbols make far more sense for not only globalisation, but also for quickly glancing over code. Endifs and such likes are a double edges sword. Yes, they make it easy to follow complex branching and iterating code, I will agree. But they also make glancing over the flow of code difficult, and I find that I am more often glancing over code than exploring the depths of a eight branched, multi-itterational algorithm. Modern IDE's have features to help this, such as highlighting matching braces (though Visual Studio could do much better in this, by implementing such features as allowing for the ability to temporarily highlight multiple braces at a time in differing colours to see the flow of code - a similar technique would also help when studying complex expressions, and to tooltip with the begriming of a branch or iteration when hovering over the closing brace)
Ken Granderson's comment about in-line assignments I would agree with. I personally rarely use them and have only recently completely figured out the logic of them. In some cases too, his ++i example could confused some programmers. However, anyone who has properly learnt the language would be able to work out such code.
Personally, I find I prefer the C syntax as it tends to create cleaner code, and is actually allot easier for me personally to read. At the end of the day, it's what you feel comfortable with. Verbose or consice. I prefer consice.

Andrew January on February 12, 2006 6:17 AM

Two blogs..
Not directly related to languages but encapsulates the topic:
[a href="http://realworldsa.dotnetdevelopersjournal.com/dna_soa_software_architecture_vbnet_cmmi_agile_development__.htm]"http://realworldsa.dotnetdevelopersjournal.com/dna_soa_software_architecture_vbnet_cmmi_agile_development__.htm]/a

A blog about tookkit languages
[a href="http://realworldsa.dotnetdevelopersjournal.com/mstools.htm]"http://realworldsa.dotnetdevelopersjournal.com/mstools.htm]/a

Tad Anderson on March 14, 2006 10:37 AM

The links didn't need the brackets. So I reposted

Two blogs..
Not directly related to languages but encapsulates the topic:
a href="http://realworldsa.dotnetdevelopersjournal.com/dna_soa_software_architecture_vbnet_cmmi_agile_development__.htm"http://realworldsa.dotnetdevelopersjournal.com/dna_soa_software_architecture_vbnet_cmmi_agile_development__.htm/a

A blog about tookkit languages
a href="http://realworldsa.dotnetdevelopersjournal.com/mstools.htm"http://realworldsa.dotnetdevelopersjournal.com/mstools.htm/a

Tad Anderson on March 14, 2006 10:39 AM

I grew up with C++. Anyone's first reaction to something different is that it is not as good.

Well, as a C++ guy, i can say I originally disliked the "feel" and look of VB.NET syntax. But after coding with it for almost 2 years, I know prefer it, and it feels like a chore to program in C++ wiht it's case sensitivity. I love VB for getting things done.

And many applicatoins don't really matter if you get 100% speed. JIT compiled VB.NET will run around 97% of compiled C++ speed and that is plenty fast. And JIT compiled java code can also match C++. We must remember that after a code is compiled it is all the same langague: machine. Whether your wrote it in C++, java, or VB, it is all machine after compile. JIT compile gives a slow down in the beginning but after that you have the potential to go just as fast as code written in C++.

java was orinigally slow becuase it was interpreted. But now it is commonly JIT compiled and is much faster than it used to be.

LaGrange on April 20, 2006 7:22 AM

I grew up with C++. Anyone's first reaction to something different is that it is not as good.

Well, as a C++ guy, i can say I originally disliked the "feel" and look of VB.NET syntax. But after coding with it for almost 2 years, I know prefer it, and it feels like a chore to program in C++ wiht it's case sensitivity. I love VB for getting things done.

And many applicatoins don't really matter if you get 100% speed. JIT compiled VB.NET will run around 97% of compiled C++ speed and that is plenty fast. And JIT compiled java code can also match C++. We must remember that after a code is compiled it is all the same langague: machine. Whether your wrote it in C++, java, or VB, it is all machine after compile. JIT compile gives a slow down in the beginning but after that you have the potential to go just as fast as code written in C++.

java was orinigally slow becuase it was interpreted. But now it is commonly JIT compiled and is much faster than it used to be.

LaGrange on April 20, 2006 7:23 AM

JIT compiled VB.NET will run around 97% of compiled C++ speed

Hmm, no, it's more like 85%.

a href="http://www.codinghorror.com/blog/archives/000234.html"http://www.codinghorror.com/blog/archives/000234.html/a

But that's still pretty good IMO.

Jeff Atwood on April 20, 2006 11:34 AM

I've been working in C# and VB.Net.

VB.Net IDE is great and background compiler rocks, but IMO C# is a better designed lenguage, and VB focuses on ease at the expense of simplicity.
All the lacks I've found in VB are a first-day-candy second-day-snare: features allowing people to start coding faster but generating some confusion about OO desings and, at the end, what your code do. IMO VB is a always-compile-never-works lenguage.

Some examples:

- Assignment and equality are different things. Using the same symbol is hazy
bool a = 2 == 3; // simple
Dim a as Boolean = 2 = 3 // not so much

- Allowing static methods be called as if they where instance methods it's a great idea if you want to confuse people. A VB programmer usually tries to override a static method. C# syntax teaches C# programmers that this is a senseless.

- Overrides, MustOverride, Overrideable and NotOverrideable keywords are scientific but more confusing and hard to write than the c# equivalents:
override, abstract, virtual an sealed. Just as 1, 2 an 5 cents Euro coins.

- Overloads. The only utility of this keyword its to increase the confusing with the override keyword family :D.

- Implicit casting everywhere it's a bad idea, but Option Strict it's very severe and having thousand of casting functions (DirectCast, CType, CInt, CBool...) so nobody uses it. The result is that visual basic code usually converts to string and go back. No body knows what the type of a individual sub expression.
Furthermore, the 'implicit casting everywhere idea' make generics a bit harder to understand to VB programmers.
By the way, it's funny to see CInt to cast to Integer, and CBool to cast to Boolean, Why not using Int and Bool data types instead?

- Everything can be Nothing. In VB you can assign Nothing to an integer, a char, a DataTime and they get it's default value. This is an asymmetric behaviour with some problems:
- VB programmers understand worst value-types.
- VB programmers think on String class as a value-type just because VB return true when comparing Nothing and "", another surprising behaviour.
- Everything can be Nothing idea makes Nullable types difficult to understand.

- Writing ByVal everywhere makes ByRef hard to find.

- Not writing ByRef on calling it's a mistake. Writing it is clearer to understand.

- Allowing passing a Property ByRef it's a great idea if you want to never understand what a Property is, and what ByRef really means.

- Even more, allowing passing a literal as a ByRef parameter its a daring to the logic. Passing Nothing ByRef it's the climax of the stupidity.
What's supposed to do this code?

Function IncAndReturn(ByRef a As Integer) As Integer
a += 1
Return a
End Function

IncAndReturn(Nothing)

- Visual Basic events / delegates syntax make Visual Basic programmer to forget delegates. Delegates are first class types in .Net, but not for visual basic programmers.

- Object default return type. If I forgot to write the return type, please compiler, remind to me, probably it's not just an 'object'

- Some code path without return. If I've forget to return something, please remind to me, don't return nothing.

- Not Initialized local variables should be marked. Write '= null' when you are coding cost 1 second. Take notice of a lost initialization at runtime cost 2 minutes.

- References in VB.Net 2005 are hidden. The average VB programmer builds a one project solution?

- Visual Basic allow not writing parenthesis on methods without parameters, writing parameters on properties and arrays are acceded with parenthesis, this is a more confusing approach than the C# one:

What People is?
Visual Basic
- People() - A Method or a Property
- People(2) - A Method, a Property, a Array, a Collection with a default parameterized property or a Named property.
- People - A Method, a Property or a field

C#
- People() - A Method
- People(2) - A Method
- People[2] - A Array (or a collection with an indexer)
- People - A Property or a Field


With these examples, I want to show the problems of the Visual Basic "first-day-candy second-day-snare" philosophy, not a deep C# - Visual Basic comparison.
I've not mentioned for example missing features of VB 2003 like using statement, unsigned data types, unsafe code... and VB 2005 missing features like anonymous methods, Iterators and NullableT special synthax.


Sorry for my bad English.

Make everything as simple as possible, but not simpler.
Albert Einsteing

Olmo on May 22, 2006 6:45 AM

I keep seeing the reasoning behind choosing Visual Basic (.NET, version 6, whatever) being code readability. I say rubbish.

When you learned to program, I hope you were taught proper design and program development methodology. If you start your code on paper (or whiteboard or visual design tool) and not in the editor, you won't need an overly verbose language to make your code readable. Implement a proper design, document your programs, comment correctly, and write clean code.

And putting

} // END OF METHOD

after the closing brace is a small price to pay for using a cleaner language and being paid more.

But this takes effort. Wonder if this is where the 'lazy' reputation came from?

Eric on June 1, 2006 7:19 AM

A quote from Francesco Balena "Programming Visual Basic 2005: The Language" page xxii:

"I find it quite ironic that most developers can argue for hours about which language can be more efficient or productive, yet they fail to leverage Visual Studio to its full potential, for example, by learning how to write macros, templates, and code snippets, or how to customize the IDE to fit their needs or programming style".

My sentiments exactly....................

John G on June 19, 2006 9:53 AM

I just starting to swtich from VB.NET to C#. (7 Sweat Years with VB). The main reason is that I've seen tons of excellent programmers contribute a lot of ADVANCE coding from C++ to C#.

I understand that I can use a conversion tool to translate back and forth. And I also undestand I might not feel comfortable Case Sensitive.

But I want to be native, and directly talk to C++ guys without the need of "middle man".

Prince W. on July 11, 2006 10:19 AM

After reading every word in this blog, I've come to the conclusion that everyone is right and nobody is wrong. Bottom line is-- do what YOU want and what YOU think matters the most. If you want more money and unfortunately (more respect), than the choice is obvious, if you're in a position where RAD is essential, than I'm sure we're all clear on that choice as well. The languages themselves are just tools-- and like a well seasoned mechanic-- he doesn't work on Ferrari's with a hammer alone (at least not mine). It's funny how people are always trying to improve their cicumstances, yet never willing to improve themselves. The differences between the two languages are minimal for the most part- and if you really enjoyed what you do- than you would enjoy the challenges that each language poses. Isn't that what programming is about anyway- the challenges, overcoming the obstacles, creating the unthinkable, doing the impossible? I say let's focus on what intrigued us about coding in the first place and quit splitting hairs. For God's sake man-- can't we all just get along?! :)

TDawg on July 24, 2006 10:33 AM

TDawg is the man, well said....

John G on August 17, 2006 11:50 AM

yeah, TDawg has a point, but I don't think he has a Ferrari

gno on August 18, 2006 1:08 PM

Ruby reduces the need for boilerplate code 10 fold with vims code folding i can see the structure of the code and also rails has some verry powerful dwim to help reduce complexity also you got attr_reader and frends to help write boilerplate by the languige .

lets say i want a simple utilaty that prints how many times you repeat a word


x = Hash.new(0)
ARGF.each do |line|
words = line.split
words.each {|word| x[word] += 1}
}
x.keys.each{|word| puts "#{word} repeated #{x[word]} times"

George on August 26, 2006 3:48 AM

not valed ruby a few bugs that have to do with end of block

George on August 26, 2006 3:49 AM

Well, the Chinese were only using a simple polyphoneticly grouped twenty square digit key, transposed from booster verdonic form, with multiple nulls.

I broke it with VB 2005.
:-)

John G on August 27, 2006 2:25 AM

They put those things in kids' cereal boxes!

Eric on August 29, 2006 10:15 AM

Yea, I found this in a box of Lucky Charms

(Austin Milbarge, "Spies Like Us")

John G on September 15, 2006 8:03 AM

Coming from a Java, PL/SQL and C background to .NET I have consistently been amazed by the way that VB developers blindly defend what is probably the most horrific syntax ever invented.

The fact that the majority of VB developers have absolutely no idea of what else is out there does not deter them in any way from sharply stating "VB is better!"

Often they reason that VB is more like English so it must be better. This would of course be true if computers spoke English, which in fact they do not, they speak machine code. Now C was originally designed as a sort of cross platform assembly language and through this has become very popular with people who actually have a clue about what they are doing, and so C# has inherited much (but not all) of this design.

SCG on September 17, 2006 5:32 AM

SCG starts off with his bias "Coming from a Java, PL/SQL and C background to .NET" and then dumps on VB.

"Often they reason that VB is more like English so it must be better. This would of course be true if computers spoke English"

I work in C# for a living but love VB.NET. Because computers underneath it all only has zero's and ones your argument holds no water.

Coming from no background which looks easier from the following?

if (str == str1) || (str == str2)
or
if (str is str1) or (str is str2)

It is factual that VB is easier to understand, whoever would argue against that is just plain ridiculous. It is common for C# programmers to boast that their language is harder therefore they must be "smarter". This is so common, you must have missed the million blogs and chatrooms.

But SCG shows his true colors and agrees with me in his next breath that C# has "become very popular with people who actually have a clue"

Ahh there's the rub, those million + VB guys just don't have a clue.

Give me a break dude......

John G on September 20, 2006 10:13 AM

John G, are you really a C# programmer. The first indication that you are not is the supposed C# code "if (str == str1) || (str == str2)" which would NOT compile.

Next we have this crazy comment: "Because computers underneath it all only has zero's and ones your argument holds no water."
This holds absolutely no relevance in a language discussion and has nothing to do with my comment. What I said was that C was very close to machine code, which is what these ones and zeros represent by the way. Obviously on .NET the machine code is generally virtual machine code which can be JIT compiled. I really hate to use this silly analogy but processors speak binary as much as English speakers speak in single letters.

Then we get the comment "Ahh there's the rub, those million + VB guys just don't have a clue."
Yeah, although a generalisation, I think this is pretty much accurate, for the majority of cases. I'm sure there are some good VB.NET programmers out there but I have yet to meet one. I have also yet to meet one who will not blindly defend VB no matter what even when they really have no knowledge of anything else. Few of them even have a decent knowledge of VB.NET let alone anything else. I have yet to meet a VB.NET programmer who understands what an interface is for, what an astract class is, what a factory method is (or why you would use it), what constructor chaining is, why you encapsulate and basically most of the object oriented design ideology.

Why are C# programmers paid more? Because, in general, they are far better programmers.

SCG on September 23, 2006 7:33 AM


SCG,
I recommend an e-Book for you SCG by Daniel Appleman titled "Visual Basic.Net or C#...Which to choose". Most of my views expressed are in agreement with that e-book. And he goes into detail why C# programmers are paid more. Some details are out of date because he wrote this when VS2003 was current. Things have changed with 2005 with VB.

I am a C# programmer. We create applications that help mechanics in the military troubleshoot by creating an application called "p2Trace" which allows users to trace circuits, be it Power, Ground or Signal and the ability to zoom in to components quickly an easily, interface it with a relational database and make it interactive for the user.

The above code was just showing syntax difference bro, not meant to actually display a lengthy if statement. So relax...

I just think you are speaking in ignorance when you make that generalization you have concluded. Do I think that C (type) programmers are generally better than the VB ones. Well yes I do, but my point is I am not referring to VB6, I am talking about .NET.

There is nothing I can do in C# that I cannot do in VB.Net. Both are 97% the same with few exceptions. It boils down to preference more than anything.

I do think that VB.NET programmers should learn C# so they can demand more cash...Since they stigma is out there.

Sorry if I sounded dogmatic, opinions are you know are like a....holes.

John G

John G on September 23, 2006 8:40 AM

Just one more side note.

"I have yet to meet a VB.NET programmer who understands what an interface is for, what an astract class is, what a factory method is (or why you would use it), what constructor chaining is, why you encapsulate and basically most of the object oriented design ideology"

If I open any current book of VB 2005 they should and usually cover these things. For example, I am just speaking off the top of my head. "VB 2005 the .NET 2.0 platform" covers the topics you mentioned that I have on my desk in great detail.

So programmers who are learning Object-Oriented skills in VB.NET are just as current as C#.

so whether you prefer
if ((str == str1) || (str == str2))

over

if (str is str1) or (str is str2)

Just remember it is preference. One thing I should say.

John G on September 23, 2006 8:55 AM

I see here two major points out of this whole thread:

1- C# programmers get paid more. There's a reason for that. Historically, C type programmers have been the hard-core "real" software engineers. While, VB programmers were not real and came from other discipline and just picked up programming on the side. This was especially true during the .com bust.

In the .com bust, anyone off the street from any other unrelated field thought they could program (no design or discipline) and they easiest way in to the fancy world of programming was VB. Therefore, two camps were created: The REAL authentic C type programmers and the wanna-be programmers of VB and its likes. This explains the well justified premium pay for C# programmers.

2- Looking at the syntax from a pure objective/engineering perspective, definitley C# or C type languages are SIMPLER and more efficient hands down. Any engineer from one look will tell you that.

So C, C++ then C# is the track of REAL programmers and BASIC, VB, VB.net is the track for wanna be programmers (don't have a clue about well designed and architected software and object oriented discipline and design patterns. In ohter words, mostly pure code monkeys who just quickly put a program together that ends up costing multiple times to maintain and extend later).

I hope I didn't offend the VB folks as I was purely realistic and objective.

CluePot on October 27, 2006 10:14 AM

The situation has changed, now VB.NET not that that VB6!
Personally I write a commercial software only on VB.NET.
One of these days one developer C# has imposed to me the dispute, also has lost for it ...
He tried to prove superiority C#, but could not, because I could deny his each statement. he has admitted a result, that simply does not know syntactic opportunities VB.NET ...

Dmitriy on November 2, 2006 5:20 AM

I started writing code in C, then C++, then Visual C++, then VB, then C#, and Finally, VB.Net.

Although I do like and code in C and it's many flavors, I still prefer VB.Net2005.

I think that one should use the right tool for the job and not get suckered into doing something just to 'feel good' about being a 'C' programmer. Big deal, truely C programmers are more pompous than anything. Besides, who programs in only one language? Baby wanna-be programmers like 'CluePot' would be my guess. Don't mean to offend you CluelessPot but you are truely ignorant of the craft of software development; no matter what position you have conned your way into. Cheers! :)

Felix on November 21, 2006 11:48 AM

Back in the days when my mom still whipping my nose the programmers of those era are either c or cobol and others i no longer remember.
There was a time when keyboarding/dos/unix is the norm until they were rescued by the ease of windows and mouse.
There was a time when internet is only reserved for government and institutions for underground communication until they were exposed by .com boom.
I programmed in vb6 for 3 years until we got the shock its no longer supported and quietly made the switch to .net and now comes the big hit Visual Studio.I am now a certified web developer by choice.
Things are evolving everyday especially in IT sectors and getting the job done faster is currently the norm regardless of your language preference.Plain and simple!
Warning! every standalone application is expected to marry the web since internet is now more affordable and companies can easily reach millions of consumers worldwide.
I will give .net/asp a Thumb Up in this race.Mark my word cause they are already in high demand and am one of them and well paid too!
To some c++ that goes all the way to label all vb .net lazy? Watch out! because your coding era i believe is already obsolete and i can hardly recall the last time C++ course were listed in college brochure nor c# and all java crue will soon follow suite.
You just wait and watch Microsoft shine while you all lost in your world of old syntax jargons.
and about the vb.net compatibility issues? never mind cause .net has already dominate the internet and Mac is backing down and so will the others soon.

daliwol on December 10, 2006 8:37 AM

Delphi soon will dead. Borland has move Delphi to Codegear and the Delphi Magazine has closed. Borland will sell Delphi and focus on ALM business.

VBNet is more human language than C#. VB Net easy to understand and for make money.

Even C# Programmer is more paid but only 1 of 1000 companies need C# programmer. Most companies need VBNet programmer and VBNet application more price than C# because VNBet App has beauty interface!

C# App very diffucult to maintenance because diffcult and hard to find C# programmer. That's why the FACT that most companies need VBNet Programmers.

john on December 15, 2006 7:22 AM

hi
This article points to the "Differences Between Microsoft Visual Basic .NET and Microsoft Visual C# .NET" white paper.

http://support.microsoft.com/kb/308470

best regard
http://www.w3village.com

anton on January 12, 2007 10:43 AM

Dont forget C# offers unsafe code allowing programmers to use pointers! I've used this alot whilst performing image manipulation algorithms!

Rohan on January 15, 2007 3:05 AM

I am not really a programmer, more an asp.net web developer. Anyway i prefer vb.net because, the more understandable syntax. As others have mentioned there is actually no performance or any other difference in the end compiled product, so it is only a matter of preference.

tom on February 2, 2007 7:11 AM

Qoute:"Even C# Programmer is more paid but only 1 of 1000 companies need C# programmer. Most companies need VBNet programmer and VBNet application more price than C# because VNBet App has beauty interface!"

The situation is the other way around here in South Africa. Also a VB.NET coder can easily lose a VB.NET job opportunity to a C#.NET programmer.

They are two kinds of programmers, those who code in VB and those who program in any language. A C#.NET programmer is more likey to understand VB.NET more than the VB.NET programmer.

TheBigT on February 6, 2007 4:46 AM

After reading all the comments on this page, and as a programmer for 25 years, I must add mine.

(1) Under the .NET platform, C# and VB applications execute at basically the same speed. If execution speed is noticeably different between an identical program written in C# or VB (barring hardware and network constraints, of course) then the programmer needs to review his/her code.

(2) Which spoken language is better? English, German, Japanese? They are all a form of communication between people, all effective.

(3) I program in C# and VB. I like them both for their individual strengths, and both are powerful development platforms. My educational background in college was primarily C based, but I do admire much of the simplicity of VB.

NET is more about NET, not the chosen language.

(4) When speaking to upper management types and end-users about a specific programming language and programming in general, and after their eyes glaze over with boredom, they only have one question. Will it do what I need it to do, will it do it quickly and correctly, and when will i get it?

Of all the professional people I know in different disciplines, programmers seem to be the most infantile and unprofessional in their attacks on each other for the tools they use to accomplish the same thing. I have never heard a carpenter debate with another over the type of tools he or she uses. I have only heard them remark on the finished product...the bottom line.

pja on February 18, 2007 11:44 AM

Vb is easy to use and gives too much liberty to programmers. While C# do not but still to program in a better manner and funny manner i like Strict city like JAVA.
No doubt abt that JAVA is the best.

pankaj on April 21, 2007 7:33 AM

pja wrote:
"I have never heard a carpenter debate with another over the type of tools he or she uses."

Then you never talked to a carpenter at all.
Of course are the tools they use discussed, as in every profession, in nearly the same manner as here.
Such discussion is helpful to some degree, of course it often misleads, but i love the discussions - it opens your mind, when you see arguments of all sides.

PS: I'm using primarly C#, but i can understand anybody who prefers VB.NET or Java instead - choose the right tool for the right thing, in consideration of all actual circumstances.

toettoe on April 21, 2007 8:55 AM

For all those guys saying that they saw a lot of these at the end of the page }}}}}}
Just press CTRL+] and there....you now know which is which.

Newbies....

Cata on May 7, 2007 12:32 PM

Minor Differences between the two. I'd recommend learning both. You never know what language you're going to have to maintain or encounter.

Caveats:

When working with Optional Arguments in C# where you can't just overload like you can if you build it from scratch and you have to use COM from legacy apps or apps with a COM interface you might want to use VB.Net instead of C#:
(see http://support.microsoft.com/kb/305814)

object m = Type.Missing;
object url = "http://www.microsoft.com";
InternetExplorer ie = new InternetExplorer();
ie.Navigate2(ref url,ref m,ref m,ref m,ref m);
ie.Visible = true;

Not Too Bad but what if you wanted to use an Excel Function that has 29 optional arguments? This is an extreme case but optional arguments are common in the COM world. (just to illustrate a point forgive any syntax errors):

object m = Type.Missing;
object xl = new Excel.Application;
object rng = xl.Range("A1:A10");
double result;

result = xl.WorksheetFunction.Sum(ref rng, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m, ref m);


VB.Net

result = xl.worksheetFunction.Sum(ref rng)


SQL 2005 SSIS

SSIS script components and script tasks use VSA which uses VB.NET and Not C#. They provide the API if you prefer to build your own C# code to handle data transformations and/or database load tasks. You could also build your own assembly in C# and refer to it with a VB.NET wrapper.

Maybe this will change with the next version of SQL Server. By that time there will may alot of Script components/task with VSA (VB.Net) code out there to maintain or convert.

My meager 2 cents.

Charles on June 5, 2007 1:52 PM

I started programming assembly in 4th grade. I am always amused by the argument that C is closer to machine language so therefore it is better.

If that is the case than all of you posers need to learn to program assembly.

In the end the syntax (i.e. language) you use does not matter as long as your code is clean and optimal. All code gets translated by a compiler so none are that close to machine.

I do agree with the "use what will get you the most respect and money" but there are a lot of VB developers that already deserve the respect/pay without having to learn another syntax.

Russ on June 14, 2007 12:21 PM

I like to program in C#(personally, technically).
But as a s/w servicing company has many departments running projects in C, C++, Java, VB...So If a Programmer(C,C++,Java) is to be taken as C# developer position, hen it is easy to pick it up...but where as VB programmer can only go with his line...

M.P.Saami on July 7, 2007 2:30 AM

C#, Javascript, Java, C++, is almost all you need to program in a large variety of environments from .NET, ASP.NET, Websphere to Mainframe. A programmer who can use one of these can more easily learn the others, and a C# programmer should be able to easily pick up VB.NET whenever necessary. I go back and forth between VB.NET and C# frequently. I prefer C# syntax. I think that some of the OO mechanisms for VB.NET are overly verbose and awkward, not even aiding readability. However, the case insensitive is nice in VB.NET, especially as studio will automatically clean up case typos. The 'Exit' in VB.NET is better than the 'break' in C#, but C# has 'continue'. C# should implement 'break'/'continue' as used in Java, which is better than either (supporting labels).

People forget that the so-called multiline comment in C# /* */ is also a middle of the line comment: Value /* comment */, value.. etc. Whereas the ' comment in VB is clearly inferior and cannot even be used at the end of _ split line. Perhaps some sales rep came up with the excuse that people use the other comments inappropriately, but I believe the real reason for the inferior comments is inferior parsing in VB, which would explain the inferior OO constructs as well.

However, when it comes to just C# vs VB.NET, you can get the exact same functionality from both with some understanding of them. I have converted code between them frequently, and very easily.

I think the main reasons to use C# syntax are: many of microsoft's examples are now more naturally in C#, Javascript has similar syntax which aids coders working in ASP.NET, Java and C++ are crossplatform and C# is more easy to move to them whenever necessary, and the industry standard appears to be moving towards C++/C#/Java syntax meaning more and more updated libraries use C#.

Moe on July 12, 2007 9:39 AM

I don't understand the people who complain about the braces in C#. Like Cata said, use the Ctrl + ] combination. Even VS will highlite the pairs for you. If your code is weirdly formatted select your code and press ctrl+k , ctrl+f
That will properly indent your code.

I've programmed in VB, VB.NET and C# for quite a while now, but I definately prefer C#. If not only for the terrible code snippets in VB.NET.
if I want to create a property e.g. in a c# class, I would go:
ctrl+k, ctrl+x, p , enter
there I go.. How many keys I have to hit in VB?

I also don't like the syntax for generics in VB.NET.
class MyClassT where T:OtherClass
{
}

compared to
class MyClass(Of T as OtherClass)

end class

To come to conclusion, programming in C# is much faster, for me at least...

Pocky on July 16, 2007 4:18 AM

I personally program in C#, and I prefer the look of the code over VB.NET. I like to make fun of VB programmers because I think the code sucks, but I know deep down that it's preference. I like C# more simply because I grew up with C++, and the two languages are syntactically similar.

I like c# for the same reason I like pizza, and I dislike VB for the same reason I don't like es cargo.

Mark H. on July 20, 2007 4:34 AM

This has all been really amusing...reading a 3 year old post and all of its comments.

THREE YEARS worth of arguments, and still no winner :-)

I'm a self taught developer, and I tackle things with a 'nothing's difficult' attitude. With regards to .NET, I naturally grabbed hold of VB.NET as I ported alot of Classic ASP web-apps and VB programs over.
I soon got wind of the preference for C# in the development community, and to be honest I still don't know why this is the case. Most of the C# developers I've seen aren't rocket scientists, they just type different syntax into their IDE to do the same things I'm doing...go figure. Nonetheless I took it on, taught myself C# top to bottom, used it for a while then went back to VB.Net

Brilliant stuff C# was, compared to VB.NET (at the time still on VS2003), but I always felt I couldn't get myself into RAD mode with it. Now I'm not talking about the abovementioned 'lazy' programming, it's just a matter of getting on with the task at hand, not worrying about case sensitivity, endless braces, unnecessarily cryptic constructs and tripping over Car vs car vs CAR...

Today I still prefer VB.NET, and I work with both languages, and god help anybody who comes to me saying I can't do what they're doing in C# (yes, one or two exceptions, don't be anal) You get the idea...

at the end of the day guys you need to realise that there is no battle to be won here, this like is a dick measuring contest between girls... POINTLESS. write that down.

Dominique on July 26, 2007 3:57 AM

Some of you people need to get a life and off your elitist kick. I've programmed endless business applications in C, Perl, Php, Java, C#, VB3-6, Vb.Net most focused around data driven business processes. I've never run into a task in the work place yet that I haven't been able to finish no matter the language I'm using.

This page is full of generalizations, stereotypes and bias. I'm currently implementing both C# and Vb ASP.Net applications and I have to be honest that either are fairly easy to use. The syntax issue is mostly preference and we all have unique preferences on lots of different aspects of life.

The insults on intelligence and broad generalizations show the character of those slinging them. Instead of sticking to facts they pawn their preferences off as fact and down play anyone who doesn't agree.

John on August 3, 2007 4:59 AM

The only people I ever see whining about case sensitivity are those muppets that dont know the difference between a Type and an instance

VB.NET doesnt help matters any, by making a default instance of some objects that is named identically to the type. Form1.Show() anyone? Is that a static method call? Who knows..

Do a lot of dataset work and you'll grow to hate the moronic convention VB adopts for naming instance variables on a form..


If programmers could have a bit of case sensitivity sensitivity, and actually stick to:

Static.MethodCall()
Static.member
Static.Property

instance.MethodCall()
instance.member
instance.Property

That's what makes code readable, not the "ooh, but End If is so much more readable than } " bollocks.

Matt on August 3, 2007 11:59 AM

"making a default instance of some objects that is named identically to the type. Form1.Show() anyone?"

This is incorrect. Default instancing was only added in VB 2005, and then only with the "My" keyword to speed things up.

DX on August 7, 2007 6:46 AM

No offense, sitting here to figure out what I should learn c# versus vb for .net have already had on project 3 years ago with vb.net.

But here I think is the kicker don't they ALL use the same compiler/runtime module? Isn't that what the hype is about with being able to program a project in different languages but one compiler executes it?

If so then how can somethings be done in c# and not vb.net and vice versa.

Aside from that I programmed in c++ to start and moved to qbasic and then to visual basic.

The thing I hated most about c++ was memory leaks. People forgetting to declare a variable (such as a char type) with enough memory so it wouldn't overflow into something else. I don't know if c# is that way. But I find the string in vb much easier to handle string type variables then always worrying about declaring enough memory.

Case sensitivity sucks, there is no need for it.

And frankly c++ got to the point sometimes where it wasn't humanly readable for all the little things someone used to program with it.

I am still debating about c#. I really have had so many bad expereinces with memory leaks from not only software I maintained written by other people but also software purchased for thousands of dollars that was written in c++ to have stupid memory leaks.

Aside from that I think vb descruction of objects is bad and it could use a boost in how c++ declares objects with constructors and destructors manually by the programmer.

And I like the return value feature in c++.

But back to my point isn't all this arguing just about symanetics? I mean they use the same compiler to execute the code so it is all the same no?

angela on August 8, 2007 3:56 AM

Does C# include syntax that is corresponding to what VB(.Net) does by
With ObjectVariable
......
End With

Thanks.

LT on August 8, 2007 11:29 AM

*sigh*
pardon my english, it is not my native language.

i prefer
{
than
begin

i prefer
}
than
endif

i prefer
int x;
than
Dim intX as Integer

i am a genius programmer who got very unlucky and lost 8 fingers, only 2 fingers left, 1 on each hand. so when programming, the lesser keystrokes, the better. so i prefer c# than vb;

i want case-sensitivity.
i want to name a variable 'bro' for little brother, 'Bro' for bigger brother and 'BRO' for the eldest brother.
in vb typing 'littleBro', 'biggerBro' and 'eldestBro' is very tiring.

codes that are easy to read are only for programmers who can't analyze well. if it (the program) is hard to write, it should be hard to read. if you can't read it, don't read it. my eyes are my first debuggers. so the lesser characters to read, parsing of program in my head is faster. by the way, i lost my one eye, so i got only one.

cheers,

abduljakul
from tudukmamot

p.s. i think i lost my 8 fingers because of programming in visual basic before. they got very tired typing lots of characters. now i use my 2 thumbs to type codes in c#. i think i lost my one eye, because of reading too many characters too in a vb program.

sigh on August 9, 2007 9:57 AM

} // End foreach
} // End for j
} // End Method
} // End Class

I started out as a vb/asp programmer, moved on to vb.net but currently working on php, and with tons of coding in javascript and some php I'm quite happy with the brackets, you just need to learn to indent you code (comments are optional but they make sense on hough blocks):
}
}
} // End Method
} // End Class

So I will probably move on to c#, just need to make the step.. (and convert my code...)

AtR on August 10, 2007 5:51 AM

"But back to my point isn't all this arguing just about symanetics? I mean they use the same compiler to execute the code so it is all the same no?"

It worries me that someone actually allowed you to program in C++! You are the first programmer that I have ever heard of who does not understand what a compiler it!

SCG on August 14, 2007 2:47 AM

You don't have to argue about VB.Net vs C#. You can automatically convert between them. Check out www.vbconversions.net

Dave on August 14, 2007 8:35 AM

Where the eff is "tudukmamot"? Or was that whole response in jest? I sure I hope I am just horrible at Geography and that was not some silly attempt at levity. I worked with a programmer for nearly 2 years who was missing fingers. He typed faster than me.

ian on August 15, 2007 12:36 PM

This was a fun read, my observations...

A lot of the points are .Net 1.1-centric, most of the "missing" features were added for vb in 2.0

If you set the vb.net visual studio preferences (strict on, explicit on), whats the difference at that point from C# (as far as typing and allowing "lazy coding") Why WOULDN'T you setup VS this way?

Why do these examples prefix a variable name with "m_" for vb code like the compiler requires it or something? And who is using "variable" and "Variable" as names to represent two different objects? And how is typing case-sensitive variables faster than case-insensitive? Most of the "verbosity" of vb code is generated by the IDE (at least in VS).

The visual studio IDE is just hands down better, which doesn't make any sense to me, they should function the same between all supported languages. ex, adding event handlers to a control in c# has that funky "press tab twice" interface, in vb.net you select the item and event from the drop down lists and use the "Handles" delegate, or just use "AddHandler control.event, AddressOf methodname". Auto indentation, auto-creation of try/catch blocks if/then blocks, all these things just seem so obvious to be included in the c# ide

I think this whole comparison is irrelevant, though, as of .Net 2.0 at least. If you're a vb dev that wants c# money, write it in vb and use SharpDevelop to convert it to c# :)

whatever on September 8, 2007 8:53 AM

even microsoft thiks c# is superior. watch what microsoft does instead of listening to what microsoft says. i.e why did they use C# in building the .net framework and not vb.net? ask yourself that question and you will see the truth.

sailesh on September 9, 2007 6:31 AM

Well i will start off saying i preffer .net anything to c or c++, which have programed many things in, but hated every waking moment of the debug prosses. C is like reading a text file in notepad that notepad doesn't suport. That may not be true in all cases (some people that spend time on there c apps and know how to organize them and can be read easily), but for the time i have spent looking at c code IT SUCKS to have to read. I personaly started on vb but i started to here that vb is a bad lang. and "You can do anything in vb" so i learned C and C++ and I find that I can do alot in vb. I think that C programers are fine and that they can do somethings a .Net programer can't but I think they DON"T understand the languge to know if you can or can't do something, and if you are like me as a .Net programer (C# and VB) you go back throught and organize your code further. You make sure there are no inconsistances in you case like Dim a as...... and then using A = ...... (not a real problem for me because I use lower case to be consistant, but i still check to make sure.) I also make sure thing like the if then statments are space right.

If ........ Then
a+b = c
Else
If ...........Then
Me.Resource.Stuff = 9
else
If ......... Then
End
Else
End If
End If
End If
Then I add in notes and it makes nice easy to read code that make it easier to see bugs. Also you can use the debug function Step Into so you can watch as your program goes throught the code (Very nice). But in the end I find .Net better than the older c or c++ and also I haven't see many c classes around so if that is not a hint that .Net is better than c and c++ than I don't know what is.

Will W on September 9, 2007 9:58 AM

C#...pretty good at most things...best at none, i.e.

- gui: VB.Net
- else: C++/CLI

Enjoy...

lol on September 21, 2007 10:23 AM

I prefer C#. It combines the easy to use of VB and the power and OOP of JAVA with better performance and a better IDE (VS 2005 vs. Eclipse vs. NetBeans).

All C++ code is just unreadable and unmaintanable.

As a book of Software Engineering and COCOMO model says, when you need to write 32 lines of code to perform some task in VB or C# you will need 92 lines of code to perfom the same task in C++.

And if we assumes that a good programmer has 5 errors each 1000 lines of code, the C++ program will have more bugs than the ones writen in C# or VB.

So, I respect those who program in C++ but I really dont understand why they prefer to code more lines of code to have a worst program.

Matias on October 24, 2007 3:00 AM

Hello together,

in my opinion is the language secundary. I developed with C/C++/C# for years, but I am a Softwaredeveloper and I had to read much many other code in other languages (for interoperatibility for example).

Now I develop with VB.NET and it doesn't matter to me...

It's much much more important to develop with a good coding style, and I prefere a good software architecture. With .NET both C# and VB.NET will be translated almostly into same IL-Code so no advantage or disadvantage will be with using different programming languages.

Please spend more time with Software Architecture, Future plans (scalability and maintainability), code DOCUMENTATION, and new technologies (MDD, SOA, platform independencies...)

So on,
Norman-Timo

Norman-Timo on October 24, 2007 3:44 AM

I have programmed in VB5, VB6, PHP and now .Net; both VB and C#. In a lot of ways I like C#, but there are several things I miss from VB. Which are:

1. I miss the IDE once a variable is declared, the ide corrects my case. ( I'm not a lazy programmer, just a lazy typst)

2. The IDE and lanuage should realize that when I type in a command, I really meant to hit the shift on that first letter.

Visual Basic does both of those for you. I currently maintain 3 web projects, 2 in VB and 1 C#. So I use both in VS 2005.

My boss would rather I did all future work in C# for some reason, me, sometimes I think ok, and other times, I think would rather do it VB.

It does seem easier to find help in C#, examples, articles; than in VB.

Thats my 2 cents worth.

RichB

RichB on November 1, 2007 10:50 AM

THERE'S NO DIFFERENCE, when will poeple learn this.

http://blogs.msdn.com/csharpfaq/archive/2004/03/11/87816.aspx

Zach on November 19, 2007 8:14 AM

Zach,

You link to a page with a bunch of differences? Not just that, the page pretty much sums up everything that people have been arguing about for the last 3 years, and thats that there's good and bad points for each. There's definitely a difference though, seeing nothing is like shooting blanks, you lose either way.

Shannon on December 4, 2007 8:08 AM

This page pretty much encapsulates is the reason I'm getting out of IT.... the vast majority of my peers are arrogant and infantile to the point that they turn on each other.

Thanks for all the fish.

Tigger on December 4, 2007 10:55 AM

html
/html

Dylan on January 3, 2008 4:28 AM

I am a C# developer, mostly due to my years of experience in C++. However, I now have a manager who is coercing me to VB.Net just because most of the enigneers that might support my code know VB 6. No one knows VB.Net. So I am trolling the net looking for arguments to support my choice of programming language.

I'm angling for productivity. I spend too much time writing syntax errors into my VB.Net code by preceding variable declarations with the type, adding semi-colons, continuing lines without underscores, and digging through the help looking for type conversion functions. I'm furious every time I discover something else that the VB IDE has "helpfully" hidden from me, and am increasingly frustrated that Intellisense works very differently than it does in C#. I suppose that a developer with a VB 6 background would be just as annoyed by case-sensitivity and curly braces, things that are second-nature to me now.

Stephanie Giovannini on January 7, 2008 1:20 AM

Dear All,

The following suprises me a lot:

It has been mentioned that C# has an advantage in large projects since there is no continuous background compile.

But continuous background compile is a HUGE advantage for VB.Net, at least in the projects I have participated in: Syntax errors are immediatively highlighted. This results in much more "RAD-feeling", and simply faster development: When I press the run-button (F5), there are seldom any debug-errors I need to find look into, since I don't write any (or at least very few), since VB immediatively tells me if I do.

In my .Net projects (up to some 10.000 lines of code on 4 year old PC), time consumption for the continous background compile has not been a problem at all.


ONE MORE COMMENT: It has been mentioned that VB produces a lot of "garbage" code: "End If", "Next" etc. Perhaps true that C# has a cleaner syntax with { }, BUT NO ONE HAS MENTIONED that VB puts in the "End If"'s automatically, whereas you must put in the "}" manually in C#. I personally like very much the auto-insert of "End if", "Next" etc...

Best regards,
Bjorn Sigurd

Bjorn Sigurd Johansen on January 11, 2008 2:43 AM

Dear All,

Jus found one thing i did NOT like in VB.Net: If a String is added to a Char-array, the compiler gives no warning or error. (Even with "Strict ON").

But at Run-time, the char-array is simply ignored! Perhaps this is better in C#?

Best regards,

MICROSOFT:
1) Please improve the above (and any similar) non-strict VB-errors!
2) Please add optional parameters and parameter default values to C#!
3) Please add continuous syntax check to C#, this is major RAD functionality!
4) Include auto-inclusion of "}" in C#.

Bjorn Sigurd Johansen on January 12, 2008 2:29 AM

Ups - sorry! Please ignore previous mail. The char array included a special character resulting in the lack of output. My fault....

Best regards,

Bjorn Sigurd Johansen on January 12, 2008 2:35 AM

abduljakul wrote he lost 8 fingers with VB
Take care that you don't loose your brain with C#,
because you told that you parse in your mind.

don't you know ctrl + j helps you to save your finger in VB ?
VB.NET is no way inferior than C#.NET

bro, Bro, BRO
he.. he..
What about if you have more than 3 brothers...
Not a valid point to discuss

gaamaa

gaamaa on February 24, 2008 7:53 AM

You know, in almost every arguement I've read on here saying C# is easier to read, they're comparing it to VB6 or an early version of VB.NET. Why are you Dim-ing m_car as car? I have several pieces of code that work just fine with the following line :

Dim car as new car

The compiler is smart enough to know the difference between the object and the type. At first glance, it might seem as though it'd be a nightmare to keep up with which is which, but then you realize that *you're* smart enough to realize the difference as well.

As for the guy who was talking about serial IO in VB.NET being a pain, .NET has it's own namespace for things like that. Check out My.Computer.Ports.

Tell you what. Get yourself a copy of VB.NET 2008 Express, give it a shot. You'll see that there have been many, many changes since VB6 and .NET 1.1. If you still don't like it, eh, what have you lost but a little time?

Davidla on February 27, 2008 8:15 AM

Oh, byt the way, all of you VB.NET coders out there, please STOP breaking lines with _'s. It makes it 10 times more difficult to read than if I had to scroll over.

Davidla on February 27, 2008 8:17 AM

Programming logic the main thing what you need to have in your arsenel. If you are logically correct no matter which language you are using!!

Beevi on February 27, 2008 8:33 AM

I've no doubt that C# is syntactically a better language that VB.Net. I think there's a bit of conflict between the overall architecture of using an intermediate approach and having a standardized language. After all, if you've got a standardized language that's easy enough to understand - which C# is - why bother with anything else? Why have vb.net at all?

This is the point, though. .Net, from Microsoft's perspective, is about making profit. It would be commercial suicide to not have Basic feature somewhere in there because of its history and popularity. Basic has been successful and has been around for decades. It has gone through changes and updates but ultimately, it has endured.

I believe one of the main reasons for this has been the keep it simple approach. VB has always been easier to use and develop with that many other languages. In the real world, this translates into two key points. First, it is an enabler; it makes is simpler just to get things done, which is usually more important to businesses and users than code efficiency (you can see this in around the globe and is evidenced further by VBA). Second, for businesses and companies, anything that simplifies something in any type project helps to reduce risk and improve predictability.

It can be hard getting GOOD freelance and contract C# developers of a high standard that have solid experience in software development. But that's what needed very often if you have a C# project. Conversely, it is arguable that you perhaps don't have to put the bar so high if you are using VB.Net. In addition, generally there does seem to be more choice of vb.net developers available.

For all commercial .Net projects now, I use VB.Net. I personally prefer C# by a long way. But getting good C# developers is hard and we have had more risks and problems with C# developments than with vb.net. Overall, this risks to a project are lower with vb.net and it works better in the real world, and for businesses.

DB on February 29, 2008 4:42 AM

Hey guys!

How to convert this in C#?

If IsDbNull(berkx) Then
MessageBox("berkx)
EndIF

.Net is BROTHERHOOD.
BERKX

berkx on March 3, 2008 8:04 AM


if( berkx == DBNull.value )
{
MessageBox.Show("berkx)
}
?????

Matis on March 5, 2008 8:26 AM

C# is just a better language

Jussi Jumppanen on March 10, 2008 8:32 AM

DB said in regards to VB:
"it makes is simpler just to get things done, which is usually more important to businesses and users than code efficiency"

Bad coding practices have nothing to do with the language being used. I'm not sure if your making a slight at VB developers in general here, or what exactly your angle was, so if I'm misinterpreting that I apologize.

Regardless of that, I don't see why this thread has persisted for so long. C#. VB. It doesn't matter. They both compile to the SAME THING.

Ash on March 11, 2008 2:07 AM

I want to be recognised as a serious developer.
The only way I can do this is to code in c#.
I'm a contractor, the only way I can procure a contract is to code in c#, people simply laugh you off if you tell them that you'll write their software in vb. I don't care which language I use but I think it's time to retire vb.net, it's time, let's get over it and move on.

Kevin on March 12, 2008 4:42 AM

I've programmed in both (last job C# current one VB) and I personally would take C# any day of the week.

Yeah it is all personal preference, and personally, when I need to skim over 400 lines of a file I didn't write to try to pick apart what's happening where I prefer to have the syntax of non english characters such as the {} because visually that stands out to me more than words amoungst words...and before anyone says it, yes I know the equivalent VB to the {} will be an "end if" or something ergo coloured blue, but then you end up with so much blue everywhere it doesn't stand out enough.

Also, goto lines are evil and should be shot - to support such a structure is a clear sign of a language that is catering for those you can't follow a logical path - more readable to say "oh i then goto line blah" but not more technically evolved.

However - it's just a language, I prefer German but I'm english, I don't speak German in a room of English....so you just use the language that you have to at the time. As for programming, the dictation of that language will often depend upon who started programming the system or site in the first place, and company precedence etc.

Seanus on March 18, 2008 5:07 AM

More comments»

The comments to this entry are closed.