VB .NET vs. C #
Choose that will be better?
By Craig UTLEY
BY MONTAQUE (of course, I just made a slight annotation)
Occasionally, this article, I think it is still a good article. The author analyzes the more suitable for us, especially for those who are hesitant between C # and VB.NET.
With the release of .NET, Microsoft is creating two new languages, Visual Basic .NET and C #. Many developers are wondering which language they should choose, and current Visual Basic developers often say they're thinking about moving to C #. Does it really Matter if you build your applications with vb .NET or C #? How do you choose Between The Two Languages?
Why do the est?
Why can't both cost?
..............
I often have the chance to ask people why Visual Basic exists. Microsoft's co-founder and chairman Bill Gates has a long history with the BASIC language. In fact, his first product was a BASIC interpreter for the Altair computer, written on punch tape. Microsoft's History With Basic Includes Several Versic, But Visual Basic, But Visual Basic Was Microsoft's First Real Attempt to Open Windows Programming To The masses.
I have to admit that I scoffed when I first saw Visual Basic 1.0. I knew that real Windows programs were written in C , not Visual Basic. Fortunately, however, I had not been too brainwashed by the C crowd, and, as I Learned Visual Basic, I Began To See A Simple Elegance In It, Version 1.0 Didn't Exactly Let You Write Mission-Critical Applications, But it is Very Easy to Create A Quick Windows Application.
The real programmers use C , but VB has attracted me with its simple easy development program.
As Visual Basic evolved, it became much more powerful. Today, it is the most common way to build business applications on the Windows platform quickly. VB applications can be distributed, scalable, fast, and even mission-critical. Meanwhile, the C developers Continue To Regard VB As a Toy Language. After All, You Can't Really Program WITHOUT POINTERS (AND POINTERS TO POINTERS), CAN you? Today, VB can easily develop business, and even ask harsh programs.
While VB has gained a huge, worldwide following, the language (pre .NET) does have some missing elements. I rarely hear VB developers asking for pointers like those in C , but they do ask for implementation inheritance, multithreading, and the ability to create Windows services and console applications natively. VB .NET answers all these requests and fixes many of the annoying little issues with VB. For example, you can instantiate variables at run time now, and parameter passing defaults to ByVal.
Is the pointer important? What we need is inheritance and multi-thread. . .
VB .NET is the modernization of VB, having added implementation inheritance and multithreading, but VB .NET has done so not so much through language changes as by supporting the features built into the .NET Framework. The Framework's Common Language Runtime, or CLR, provides inheritance and multithreading along with support for a variety of projects. VB .NET is one of the first-class languages on the .NET platform, meaning it fully supports the CLR and can not be considered a second-class citizen to C #.
Under .Net this platform, VB.NET is absolutely not backward C #
Why do you have C #?
C # exists for a very different reason. While VB .NET added support for such things as multithreading and inheritance, C has had those capabilities for years. However, C often is used for plumbing. You do not typically write device drivers in VB. Instead, you use C . If you take the concept of building a house, the C developers are the ones pouring the foundation, running the wiring, and installing the plumbing. VB developers then step in, put up the drywall, add carpeting, paint and furniture, and make the rooms functional. It's not that C can not do those things, it's just that it generally takes longer to do those things in C . in business, time is money, and time is a luxury many businesses do not Have or acknowledgment, C is the foundation, VB development application layer. Business, time is money; the same development efficiency is money.
Microsoft claims C # is the modernization of C , just as VB .NET is the modernization of VB. While C # does try to eliminate some of the inconsistencies of the C language, it is really more about welcoming C developers into the world of building business applications Quickly. in Other Words, C # Allows C / C Developers to Finish Those Rooms And Make Them Functional As Fast As VB Developers Have Been Able To for Years.
C # For C users, it is a fast-developed tool.
C # eliminates many of the areas that make C a minefield for developers. Because C # is built on the .NET Framework, it takes advantage of .NET's automatic memory management. This should eliminate many of the memory leaks often associated with incorrect use of memory in C . C # also takes advantage of the CLR's type safety, preventing you from reading memory outside your object's memory range. And C # eliminates explicit pointers, which were the source of a tremendous number of bugs, especially for novice developers.Some C developers see C # as the "dumbing down" of C . Instead, it is an attempt to build a type-safe, reliable .NET language with syntax familiar to C developers. Similarly, VB .NET is an attempt to build a type-safe, reliable. NET language with syntax familiar to VB developers. The fact that VB .NET seems to gain a host of features is due more to its support of the CLR than to enhancements of the language. Because C already supported many of these features, some deve Lopers say The move to c # seem like a step backward.
C users use C #? Is it a reverse?
VB .NET or C #: Does it matter?
Is it important to choose VB .NET or C #, is it important?
ASP classic developers have been debating VBScript vs. JScript on the server for about four years. The syntax of the two was obviously quite different, but, beyond that, the differences were minor. VBScript added a few nice objects, such as the Dictionary, The FileSystemObject, And The TextStream Objects. But, Overall, The Languages Let You Accomplish The Same Thing.
The difference between the functionality of VB .NET and C # is even smaller. If you create a new project in Visual Studio .NET, you see the exact same project types listed for each language. So, if the project types are the same, and the functionality differences between the languages are small, does it matter which you choose? If the answer was no, this would be a short article. The fact is that the language you choose probably will not hinge on the functionality in the language itself. INSTEAD, YOUR CHOICE WILL HINGE ON SOME OTHER CRITERIA, Which We'll Examine In A Moment.
Look at the details!
What affright speted?
What about speed?
Unfortunately, it's too early to tell about speed. According to Microsoft, the speed between the two languages will be the same. Much of your code actually will be calling classes in the CLR, so that will be the same regardless of the language used to In the compiler.
Microsoft Officials Say VB .NET and C # Will Compile To The Same Il, So The Result Will Be The Same Speed. I Must Admit I'm Skeptical, But There Is No Way To Test this at this time. With .net still in beta (.NET WAS NOT YET FINAL WHEN) ARTICLE WENT TO PRESS. - Ed.), Any Speed Tests MOST LIKELY Would Bear Little Restlation To The Final Product. For Now, Assume The Speed Will Be Very Close, and Don't Worry About IT Until .NET IS A Finished Product.
It seems that the speed is still almost, and the sowing is between.
What affright language Differences?
The differences in the languages are small, but they do exist. For example, C # allows you to have unsigned integers of various sizes, and VB .NET does not. It is important to note, however, that unsigned integers are not part of the Common Language Specification (CLS), a part of the .NET Framework that defines what language elements can be used to allow inheritance between languages. If cross-language inheritance is something you want to ensure, you need to stick to only CLS-compliant types For any expected parameters and return values. Small details: C # has unsigned integers, VB.NET is not. However, the number of unsigned numbers does not meet the CLS specification, which is not conducive to cross-language inheritance. Still recommend not to use unsigned numbers.
VB .NET Adds Some of THE C / C Shortcuts, Such as =, - =, AND Others. Now, In VB .NET, X = 5 Is The Same AS x = x 5. However, VB .NEN not support the or -.. operators, which C / C programmers frequently use C # supports all of these, of course C # also supports the concept of operator overloading, in which a developer can overload operators such as , -, and True. Operator Overloading IS Admittedly Not Something Most VB .NET Developers Will Miss, But it is one of the differences Between The Two Languages.
VB.NET adds some C features, such as =, - =. But C # fully retains the original C 's surname, such as , -, these are not very important. VB.NET does not have an operator overload, which is a small difference in two languages.
I will not go into the differences in the actual syntax here, except for two items that are only relevant to VB developers thinking of making the switch to C #: case sensitivity and the equality operator (See Eric Smith's article There and Back Again for. more on syntactical differences and how to move code from one language to another.) Do not forget that VB and VB .NET are not case sensitive, while C # is. Also, the assignment operator in C # is the equal sign (=) but THE Equality Operator is the double equal sign (==). THESE TO DIFFERENCES Are A Major Headache for VB Developers Trying to make the switch to c # .vb and vb.net are unliked, C # is different. Also, is the two are equal, and C # is still two equal numbers.
To See Some of The General Language Differences, Check Out The Sample VB .Net Code in Figure 1.
Two specific examples:
Module Module1
Sub
Main
()
DIM X as integer = 5
Console.writeline ("The Secret Number IS:" & x)
End Sub
End module
Figure 1: Sample VB .NET Code.
As you can see, VB .NET now allows you to initialize variable values at declaration. The next line uses the WriteLine method of the Console class. There is some simple string concatenation, and the string is printed to the console (or the DOS window OR command window).
FIGURE 2 shows the same application written in C #. The variable declaration is cleaner, but the Console.WriteLine is almost identical. Notice the curly braces and semicolons in the C # program, which are familiar to C / C and Java developers.
Using system;
Namespace ConsoleApplication3
{
Class class1
{
Static void
Main
(String [] ARGS)
{
INT x = 5;
Console.writeline ("The Secret Number IS:" X);
}
}
}
FIGURE 2: The same application as in FIGURE 1, but written in C # instead of VB .NET.One of the differences when working with both languages in Visual Studio .NET is important to point out When writing VB .NET, you can type. "console" and when you press the period, the list of properties and methods appears. If you are typing in C # and you type "console" and press the period, nothing appears. This is because C # is case sensitive, and you'll have to type "Console" for the IntelliSense to work. VB .NET developers may find this tedious. Whether you consider it lazy or convenient, VB .NET developers typically type everything in lowercase and let the environment case it properly. C # developers have to Case It Properly As The Type. This Means C # Forces A Stricter Set of Code-Writing Standards, While VB .Net Developers Save Wear and Tear on The Shift Key.
Vb.net saves a lot of press Shift opportunities, don't you do :)
So, how do you choose If the functionality in the two languages is nearly the same, how do you go about choosing which language you want to use I'll break this discussion into three categories:?? Familiarity, resources and support, and personal EDIFICATION.
Familiarity
The main reason to choose VB .NET or C # is familiarity, which is interesting because both languages are new. I've had some people on the Microsoft project team tell me they do not want the move from VB to VB .NET to sound Like a big move. Well, IT IS A BIG MOVE. The Learning Curve IS Steep. The Learning Curve from VB to C # IS Steep. The Learning Curve from C To C # is STEEP.
You're learning a new language, but much of it is learning the .NET Framework and all the classes the CLR supplies. If you want to create a new thread, it's in the run time. If you want to access data using ADO. Net, IT's in the Run Time. If you want to read in Some XML, It's in the weight: Much of what you will be doing is learning the run time.as you learn the run time, however, you'll be using some language to play with it. While VB .NET is a new language, and there are differences from VB that will cause you to lose your hair, I think it's safe to say that the learning curve going from VB to VB .NET IS LESS Steep Than IT IS from VB to C #. C Developers Will Feel More At Home with C # Than with VB. If you are a hard-core java or jscript development, you also Will Feel Much More At Home With C #.
That more familiar? One words, C users to C # and VB to VB.NET are a good choice.
VB developers will be much more at ease with VB .NET's loops, conditional constructs, variable declaration syntax, and more. Why fight case sensitivity and that double-equals sign when you do not have to? You'll find yourself searching for a .
C , Java, and JScript developers are used to case sensitivity, the double-equals, and all those curly braces. Moving to the more wordy VB .NET syntax would probably just be frustrating at a time when the developer should be focused on learning the CLR classes and not havning to worry about an unfamiliar syntax.
Recommendation No. 1: Go with what's closest to you. If you are a new development of code in Your Life, You'll Have to find your answer in the next two sections. Summary, choose the most Careful language. If it is a newbie, or look at the analysis :)
Resources and support
Reference resource profit
If you are learning a new language, what's the first thing you do? For most people, the first step is to create a Hello World program from a book or a help file. Some people actually read the language reference then. (Really, I 'Ve Seen People Do It!) Most People Go Through Online Tutorials, Maybe Buy A Book or Two, And The Look At The Language Reference Only When They isy.
There Will Be No Shortage Of Books, Web Sites, And Articles On Either VB .NET OR C #. SO You Should Have Plenty Opportunities To Read About Either Language and Have A Number of Examples from Each Language.
However, there are other factors to consider. Do you know anyone with experience in either one? Someone you can bounce ideas off of when you are having problems? What about industry support? Microsoft created both languages, but how many VB .NET developers will There BE, COMPARED with C # degion? Will Microsoft Favor ONE OVER ANET AND C #?
Most resources should be widely available in each language, but, if VB is any guide, there will be more VB .NET developers than there will be C # developers. While I expect the gap between the number of VB .NET and C # developers to be Smaller THAN THE GAP BETWEEN VB AND C Developers, There Will Likey Be More VB .Net Developers Because So Many VB Developers Will Use VB .NET WHEN THEY MAKE The Leap To .net.
Said so much, it seems to say .Net developers, of course, the masters can be asked. Personal Edification
Individual understanding
Perhaps you've always wanted to program in C but found it too obscure, difficult, or overwhelming. Now, you see that C # exists but removes some of the more intensive tasks, such as managing memory and handling pointers. If it's been a lifelong Dream of Yours To Program In C or C , Feel Free To Take C # for a spin. You'll Find IT Quite Forgiving and Very Powerful for Creating Business Applications.
If you're thinking, "AHA! Now I can Learn C # and pull down the big bucks!" THEN I Need to Warn You About Something. You See, It's True in Most Cases Today That C Developers Earn More Than DO VB Developers. One reason is that there are a lot fewer C developers. Another reason, though, is the kind of work that C developers are doing. They are typically doing things you can not do (at least not reasonably) in VB. They're Writing Device Drivers, Socket Interfaces, or Any Manner of Low-Level Applications. VB Developers, on The Other Hand, Are Busy Solving Business Problems.
C # is not going to be used for the same purposes as C . Instead, C # will be used for business applications. Therefore, C # and VB .NET will be used to create exactly the same kinds of applications. The advantage of one over the other will be miniscule when creating business applications. The only way you might earn more as a C # developer is that there likely will be fewer of them, so you may get lucky that way. It's unlikely, however, that you'll be building low- Level Applications. SO, Unless The Manager Is A Dolt, You Won't be Worth More Than A VB .NET Developer.
Finally, pick the language you like. A friend tells me he has always thought C / C looked more elegant and logical to him than VB, but he's been using VB for a few years. He plans on making the jump to C # because "it Looks better. "That's not a bad reason, but he'll be learning the clr and c # at the Same Time. as a vb development, He'd probably has an easier time learning the clr and vb .Net at The Same Time and Then Making The Move To C #. Sarrely, there is a thousand autumn.
Conclusion
From a purely technical standpoint, which language you choose is probably irrelevant. Yes, there are some differences in the functionality between VB .NET and C #, but they're small. The main issue to consider is your comfort level with the languages on which THESE New Languages Are Based: If You Are Familiar with VB, You'll Have An Easier (Though Not Necessarily Easy) Transition to VB .NET. IF you are A C, C , Java, or Jscript Developer, You Likey Will Find C # More Comfortable.
Despite the two languages being different, they almost always will be used to produce the same sort of applications. Therefore, any salary difference between VB .NET and C # developers would be based on the sheer numbers of developers, and not on any specialized requirements of C # developers That VB .NET Developers CAN't Handle.
Most of you will use what your company tells you to use. If the choice is yours, feel free to choose either one. There's nothing wrong with learning both, but you should probably move to the one closest to your current language first, so you CAN Learn The Run Time without having to one, any. NET LANGUAGE WILL JUST Require You to Learn Some New Syntax.
This author is recommended to have a lot of VB contact, transfer to VB.NET; if you are a C / C , Java, JScript master, it is recommended to use C #. Montaque == Hou Yongfeng == DIGITALBOY