VB.NET vs C#, round two

hmmmmmm damn so many comments and people are still stuck on syntactic differences and case sensitivity…
There are not that many differences in C# and VB.NET

But I still prefer C# because I find VB syntax very ugly and unlike all other languages. It is easier to move between C#/Java/C++ than to goto VB

Admittedly, I’m only a “hobbiest” coder, but I find the 2 very similar to write, look at and debug. After a few months of using both, it was Microsoft’s XNA Game Studio that swayed me into using C# predominately, because making XNA Games is good fun :smiley:

OK… C# and VB.NET are the same. They do the same thing. The only difference is syntax. VB.NET uses more words, C# uses more symbols. For every VB.NET expression there is a C# equivilent. My advice is to lern C# first, then migrate to VB.NET, and stay with VB.NET. VB.NET is much easier to read and structure. (My Opinion) C# was created for C++ developers. Microsoft wanted to attract those C++ deveolpers to write .NET programs. C# is a politcally motivated tactic by Microsoft to lure C++ programers on to the .NET platform.

I’ve been programming in VB for over 10 years, with the past 3 or so in VB.NET. I am seriously thinking to learn C#. Even though VB.NET is a first class language and both C# and VB.NET are basically equivalent, it boils down to this.

Dice.com, Monster, and other boards: Approximately 6 times more C# jobs nationally than VB.NET

Same search locally to me: You guessed it, about 6 times more C# jobs than VB.NET

Being unemployed is not cool and is hurting my career. And if it’s true, C# developers making more, than that is just more reason.

By the way, to the guy who put down the VB developers, I have worked with plenty of VB.NET developers (even VB6) that understand OOD. And VB6 developers understood Interfaces and worked with them for a long time. It’s not rocket science dude.

I have not programed since the early days (Sinclair QL basic).Remember that !!!

Anyway as far as i can see, looking from an outsiders point of view.The .net framework will program efficiently in both c sharp or VB, and as the speed of current processors from AMD and Intel are both fast and efficient,I would think the programmers main problem coming up is more about Parallel processing programs to take advantage of the quad Core Processors.

As far as i can see this will probably need a new language to get the most out of the processors !!

So…time to junk C,C++,C Sharp,Pascal,VB.net Etc and move on up to the next great language, whatever that will be.

Bjorn Sigurd Johansen

  1. Please add optional parameters and parameter default values to C#!

Lets talk about this a bit, this has got to be the dumbest thing I have read on this thread. Optional paramters are a freaking nightmare. I am a C#/VB.Net/Java/C++ and yes Delphi developer with 30+ years of experience.

If any VB.Net developer here thinks that optional paramters are a good thing then get out of IT, because you are lazy and should be working at taco bell and having your mommy tuck you in bed at night.
Because you obviously have never written an assembly used by anyone else on your team.

Try this write a dll and put the following in it

public function method1(ByVal a as string) as integer
return method1(a, “I am stupid”)
end sub

public function method1(ByVal a as string, optional b as string =“stupid”) as integer
return 1
end sub

now compile that assembly
and reference it from another and see what comes out.

just in case you are to freaking lazy here are the results

Runtime error:

why because the MSIL was written for you guessed it C# and the method signatures end up being the same. the optional is removed because, uh its optional.

also for all the ByRef people out there, everything is a freaking object so why in the hell do you need to put ByRef?

try this

Module Module1

Sub Main()
    Dim s As S = New S()
    method1(s)
    Console.WriteLine(s.value)
    Console.ReadLine()
End Sub

Public Sub method1(ByVal s As S)
    s.value = "Apple"
End Sub

End Module

Class S
Public value As String
End Class

wow look at that - s.value was set to Apple
even though we have byval???

C# programmers know that S is a class and s is a pointer to an object so it would be set. I do not know how may times I have had to explain that to VB.Net ex-vb6 programmers. Who have been programming for 10 years.

IMO People who exclusivly program in VB or VB.net are idiots, VB.Net was supposed to go by the way side before VS2003 came out, it was a stepping stone. Hmmm anyone remember J#? What language does Microsoft develop in? C# what langauge are games starting to be written in C#, why because it is a better langauge.

and if code beautification is all any VBer can bring to the table, like, wahhhh “I want my End If to be displayed when I hit enter” then get a life or maybe an add in like Code Rush from dev express and create you own macros, if you cannot figure out how to use the IDE.

And code readablity

why does

If Not a = 5 Then
do something
End If

make more sense then

if (a != 5 )
{
do something
}

is on crack or a vber

and what is up with AndAlso and OrElse -
C# is default for short circuit. why continue processing the conditional if it has already been validated.

Dim ds as DataSet = nothing
If ds isnot nothing AndAlso ds.Tables.Count 0 Then

End if

vs C#

if (!ds ds.Tables.Count 0)
{

}

yeah I know there is some setting somewhere for short ciruiting
but then you have some person come in that only know VB and is wonder why you set it.

I have never used And ins VB it is always AndAlso

last thing about IDE

VBs famous auto compile or auto syntax checker.
Microsoft know there is a bug in it, it causes a machine to lock up and shutdown VS2003 and VS2005.

So Auto Syntax checker/compiler IMO is a waste of my time.

I wonder why C# does not have that feature - maybe trying to annoy anyone from using VB.Net???

Intellisense. C# is so much better

try this in C#

DataSet ds = new

and poof System.Data.DataSet appears

Why can’t Vb.net do this? Oh yeah wait lets use Imports and with statements right??? well sometimes, sometimes in development there are products that may have lets see

Company.ProductName.V1.ClassA

and

Company.ProductName.V2.ClassA

and you need to use both of these in your project or solution of projects (I know VBers, this is new idea multiple projects in one solution, but there it is) and you have to have the whole namespace and class name in the code and the imports will not help you out.

with statements were a bad idea from the begining and are a nightmare in debugging, but oh wait in VB you never have to run a trace or debug, beacause it is a perfect little (I do mean little language) ( BTW that is sacarsm)

and for one last point, for everyone complaining about case sensitive syntax, For the love of God, SHUT UP!!!

There are Standards in coding, and VB just goes along and follows their own little standard. just look at any other real language that has been around for a while and you will see how easy it is to code using casing.

I am so freaking tired of reading someone vb code and seeing

objPerson or oPerson

and when you ask then why use obj or o and they answer because its and object, then you see

Dim I as Integer

and ask why not objI or oI, and they say because that is a value.

I just cringe

So
int i = new int();

must not be possible

Hello, just came to this site by searching vb.net vs c#.net. lol. I have experienced java, c#.net, c++ during university and c#.net and vb.net (this was later) in the ‘commercial world’. Before i learnt vb.net, i looked at vb.net i said ‘man, thats ugly code’, because there are no brackets. But you know what its easier to code when creating websites in asp.net, it really is.

Obviously if you were to create systems, applications or even simple console applications then other languages are far more superior. As for migrating, well in my case of asp.net, there isnt a need to migrate to c#. Same functionality but with c# you code more, it all depends on what you want to do really.

There are problems like case sensitive, but why would you want it in the first place? Surely if you name your variables properly then you wouldnt have that problem, also its not very thought out if your thinking a 1000 line code with variable i and I and many others are in the code. just split everything up and you wouldnt have that problem(it all depends).

But then again i only just starting working in the ‘commercial world’, so i guess my opinion is completly and utter useless.

What amazes me is that his post was posted November 2004 and the last comment was May 27, 2008.

A discussion going for almost 4 years! :slight_smile:

Just because you can program badly in VB.Net does not mean that you automatically have to! I have been programming in various versions of Basic for nearly 30 years and I am currently looking at C#. Apart from some minor differences in syntax there really is no difference between the two these days.

I think it is about time C# programmers stopped being so superior, and if our IT department is anything to go by, I can produce VB.NET code projects 5 x faster than the C#.NET programmers.

To be more productive, the code must be easy to read and understand. with this, you can have more time thinking better programming techniques, organize your classes methods, handling errors, better codes to efficiently accomplish your goal. C# VB.Net can accomplish the same thing. The superiority lies not on the language but on the programmer itself.

The language of choice depends on the individual. For me, I’m using VB.Net because I am already adapted to the coding styles. I feel more productive using this language.

Enjoyed the article thanks for publishing it. This is an old argument. When you ask which is better c# or vb, there is one and only one correct answer: For what? VB is hands down the best way to sling together business rules for business applications. The notion that c# is the best way to do this makes me laugh.

I use both VB.NET C# for more than 4 years. I feel more productive coding in C# because the syntax is cleaner less words to type. It makes me easier to visualize the object-oriented pattern.
Besides, performance in C# is better when I worked for big business applications which have hundreds of classes.

I started out programming in VB and i used to look at c# code and go crazy. the code seemed to go everywhere and the brackets would really throw me off. but i started programming in c# a few months back and now i look at vb code and i find it hard to read, i now love the brackets they dont confuse me anymore and i love how the code looks, i find it elegant. i dont think i’ll go back to vb

I’ve read most of the comments and seems most of the C# programmers are arrogant, I do not know why they imagine themselves the esteemed ones in .Net platform when there is no advantage over one the only difference in between is syntax and in no doubt VB having a lot of advantage in that if utilize, please DO NOT think coding in C# needs little bit more intelligence and admits it is little bit hard since IDE is more supportive to VB.

Yeah yeah,
Most of the C# programmers are arrogant…
Most of the VB.NET programmers are incompetence…

Java Programmmers Rules The Day.

I read a couple of posts, not all :slight_smile:
It seems that most or all responses are pro VN.Net.
I come from the same background as most of you guys. ASP en VB6.
Still when .Net arrived I made the effort of changing to c#. And I haven’t regret it for a minute. From time to time I have to write VB6 code and I get irritated by the end if etc statements.

This post is just to prove that not all VB background persons dislike c#. The readability of the code in c# is maybe less for people who use VB, but more clear for c# persons. I think it is much better then VB.Net :slight_smile:

Greetings.

How can we explain that most C#/C++/java programmers understand VB code when they read it but VB programmers aren’t able to understand C# code. By experience, I find that C# programmers have a better understanding of what they are doing (i.e. use better programming pratices, have better knowledge of the .NetFx, produce better quality code…)

As a LONG time computer programmer (over 31 years now), I have seen a lot of good and bad programming practices.

I have worked on PC’s and mainframes, as well as many other computers that no longer exist over my 31+ years in this field. Have used many different computer languages too.


One of the most underused and simply overlooked item in all Computer Languages: Good Documentation!

Source Code and External Software Documentation is a MUST to get the job done right!

Variable Names that tell what the variable is used for also simplifies documentation.

For Example:

x = y * z * a

The code just doesn’t tell someone what is being done or why the calculation is needed.

However:

CalculatedInterest = PrincipalAmount * NumberOfDaysOfInterest * DailyInterestRate

Is pretty much self-documenting and much easier to follow.


Assembly Language is one that is too rarely used anymore.

It is a language that isn’t all that hard to do if one knows what they are doing.

Yes, it takes a lot more understanding of how to do things and requires more personal responsibility by the programmer but is very powerful computer language.

For example, to say Hello on a MS-DOS / Command Prompt screen without clearing the screen can be done in 15 BYTES of executable code with 6 of that for the message when using Assembly Language on an IBM PC with calls to standard MS-DOS functions.

To do the SAME thing in C/C++/C# used to take over 50,000 (Over 50 KILOBYTES) of code.

Assembly language is well suited to speeding up timing dependent code for things such as Games that are written in mostly C/C++.


VB.Net is pretty easy to write and pretty easy to follow for most people.


C/C++/C# code tends to be spaghetti coded.

What do I mean by that?

Source Code is very hard to follow, Poorly Documented, and way way too many modules to try to follow when looking for variables and trying to follow what the original coder(s) were doing.

A good case in point on this would be the VLC Media Player… It is an Open Source Project… Well done project but very poorly documented with a TON of C++ Modules that are very hard to follow for even many seasoned programmers!


All computer languages do basically the same thing but the methods used differ.

Visual Basic’s Left$, Mid$, Right$ are not the same in C/C++/C#.

Each Computer Language has a learning curve to get to where it is easy for an individual to write code using that Language.

It would be like someone that is fluent only in English learning to speak fluent Spanish or French. It takes a lot of time and effort but it is doable!


Which programming language is best depends on the what the application needs to do, what is the target audience, which computers and operating systems that the application will be used on, and many other factors. (Including the Computer Programmer and / or programming team that is working on the said project.)

Poor coding practices occur no matter which computer languages are used. It takes time and effort to overcome bad programming practices.

Developing excellent programs takes a lot of effort… You may not get the code done perfect the first time through.

A great example of this comes from Tim Sweeney of Epic Megagames fame. I read a story in a book where Tim told of writing the Original Code for Unreal. It took him 7 times to write and totally rewrite the code before he came up with the final version of the code. From seeing the final results of that effort shows that it was worth the time and effort Tim put into getting the code done right.

Being a lazy programmer is NOT a valid excuse NOT to document your code as well is not a valid reason to turn out poor software!


:slight_smile:

Bill, I agree with you that documentation is crucial.

I am amazed that this topic has been going on for near 3 years pretty steadily. I’m also amazed at the general hatred of VB programmers by C programmers. It amazes me for real. Not just a statement. I cannot imagine why there would literally be so much angst against each other based on the language they choose to program in.

Yes, it’s pretty much BS that a C# programmer gets paid more than a VB.Net programmer. And I’m sorry, but just because people code in C# doesn’t make them any more diligent or more intelligent. And programming in VB does not innately make you a lazy person. I have written programs with series of modules, controls, and the like in VB that would make many C,C++,C# programmers’ heads spin. I used to be a C-based programmer. I tried VB at v4 and wasn’t a huge fan. I then switched over almost all together at v6 because I was told You can do that in VB. Well, guess what? I could. The C programmers in the class just didn’t want to take the time to learn another language, and they were content programming a project 3-4x longer than I was. They said it wasn’t feasible, I had to prove them wrong. At that point, I took over coding for a former coworker of mine. I SAW how lazy he was (he really didn’t know what he was doing. He was the epitome of a lazy coder). I have used VB.Net since literally beta. I have also used C#.

For everyday projects that I need to get done in a manner than is timely as well as easy to understand for the layperson, I choose VB. For projects that require C#, I choose C#.

We really should stop focusing on who’s language is better and bond together and encourage people to join the development industry as a whole regardless of which language they embrace. Programmers are falling out of touch with what’s going on right NOW because they are afraid to push out of the bubble they create for themselves in their respective cozy language.

I encourage anyone reading this to take the time and actually code several projects in the opposite language in addition to your native. YES, it’s going to take you longer… YES, you are duplicating efforts. But YES, you are going to learn that C#/VB.Net are the same thing on the inside. The Framework and the logic behind your code are what is important.

Here’s something that I tell people who try to argue the language fight around me: Language isn’t sh*t. Logic is everything. If your logic sucks, your code sucks.

After reading just about every single post (Its taken me a good hour), I’m sticking to VB. I wrote C/C++ in college and while I love C++, VB is still a killer pick-up language.

I do miss pointers and hacking in to memory to create noise. (Just kidding).

Oh and by the WAY to all you people who think that C# is going to make you more money, its all about how well you market yourself with your resume. Your resume is a marketing portfolio and how well you market yourself will get you the job, the money, and the rest of the goodies that come in the bag of toys.