Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET vs. C#

Status
Not open for further replies.

DevonTaig

Programmer
May 2, 2001
73
0
0
US
I work at a shop where most everyone uses VB 6.0, and is quite comfortable with the language. We are considering migrating soon to either C# or VB.NET. It seems obvious to me that the correct choice would be VB.NET, however, a fair percentage of people feel that C# is the way to go. The primary reason they cite is that old habits (bad non-object-oriented habits) die hard. And while VB.NET does offer a wealth of new OO functionality (comparable to C#), it is all to easy for an experienced VB 6 programmer to essentially ignore this and continue to code in a manner that they are accustomed to. If programmers are forced to use C#, they will be forced to learn superior techniques. Of course, my thought is that productivity could be sacrificed while people learn a new language, that for all intents and purposes, is equivilant to a language they already know ("It [VB.NET] has almost exactly the same capabilities as C#" - Professional VB.NET 2nd Edition Wrox press). I am very interested in your opinions. If you take time to respond, please add a sentence about your programming background. Thanks.
 
Wel I have been programming in VB for many years and finally decided to step into the c# world.
If you had a bit of experience with java or javascript, then you will surely find yourself around the code.

Considerations are many:

* VB.NET does not force you to write return statement in Function and if you forget, it just return default value for the return type

* In VB.NET when you call a function like myVariable = MyFunction()
If you write it like this
myVariable = MyFunction
code may compile(not consistent behavior) and the function may be called, but it's not correct...

* Old VB6 coders who move to VB.NET don't take the full potential of CLR and BCL.

*C# has great XML code comment syntax (and Visual Studio and some other tools, too, build great web pages using those comments)

and generally alot of other little bits that make your launguage decision very important.
Int the internet community there are many threads on this discussion and overall C# turns out to be the main preference.

I also read an artile on news.cnet.com talking about it and explaining that probably VB has finally found it's time to die.

hth
 
First I better point out that I dont know how much is involved in moving to VB.Net from VB6 becuase although having used VB6 for years I have stepped straight to C# and missed out VB.Net entirely.

Why?

1. IMHO If any programmer has got half a brain then the difficult part of picking up either C# or VB.Net after VB6 is learning the .Net libaries and not the languages syntax. So your going to be taking a large productivity hit which ever language you go for.

2. Ahh you say but the OO nature of C# is also a productivity hit. Well it is if thats how you wish to program and its new to you. If you havent really gotten your head around OO (and it can take a while) then I'm sure you can program in C# without using OO techniques. I dont advise it but it can be done. The beauty of any language that embraces OO is that as soon as your non OO developers start to use it for real projects then they'll soon see the light. C# really does help you to see OO and why its useful in a way that languages with OO bolted on as an after thought dont. (You just have to be carefull that once you've seen the light that you dont go back and spend 3 months re-writing all your old non-OO code :)

Anyway just my 2 cents worth.

Darrell

Developer for 6 or so years in areas such as Access/SQL Server/MTS/COM+/VB6/ASP/XML(Schemas/XSLT)/C#/n-Tier/VBA/Javascript/IIS.

Main area of interest/experience: nTier internet development with VB6/MTS/IIS/SQL Server
 
Don't forget that in C# you can write custom attributes.

One of our guys has used this to encapsulate database access for a data-access layer (object-relational interface, actually). So you never need to write a SQL statement - you just instantiate a new class, passing the key of the record you want along to the constructor.

Chip H.
 
Moreover consider that C# compiler is free,
as C# is not owned by Microsoft while
VB.Net is owend by Microsoft so you will never
find a VB.Net free complier.
Bye
Alessandro
 
I believe C# is owned by Microsoft, since it was Microsoft that created the language. It was created based on the .NET Framework as a well designed language. At has the simplicity as VB but the power of c++

What is true is that C# and the CLR are deposited to the Standar Organizations, giving the Third parties the opportunity to create their own .NET language and/or implement c# in their frameworks.

 
it looks like, but there are quite some differences underneath it. C# compiles to IL (Itermediate Language) wich is very efficent. while the compiled pre-run java code is not really efficent as it sounds.

The difference is that while IL can be JIT compiled (Just In Time), java cannot. Or better, Java is compiled only if requested, but compiles the entire class, while the JIT compilation compiles the singles events and procedures when needed. An enourmous advantage in speed.
 
kieren, xutopia -

Another advantage of C# over VB7 is that in C# you can overload operators.

If you had an Invoice object, you could override the += operator to make it easier to add InvoiceLineItem objects to it. In VB7, you'd have to write a "AddInvoiceLineItem" method.

Chip H.
 
Am I crazy, or is this true...The intellisense in C# is MUCH MUCH faster than the intellisense in VB.NET. I was really getting fustrated with VB.NET after typing the period at the end of an object...It might take two or three seconds for the intellisense to come up in VB.NET (which when multiplied by a thousand tends to slow you down). In C# (at least on my machine), it comes up immediately. Wierd.
 
Hadn't noticed. But possibly true (another vote for using C#???)

Chip H.
 
Correction!
VB.net also Supports Custom Attributes, not just C#.

I think MS was forced to continue with VB since most of the MS programmers are VB based.

It is more like a transition for the VB programmers, sooner or later the 2 languages will support the same functionality. I don't think there is any thing that C# can do and VB.net Can't do apart from Operator overload. But This was taken out from Java for a reason.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top