This blog is targeted at beginning / novice programmers for the Visual Basic (VB) language.

Saturday, March 10, 2007

What is the difference between VB.Net and Visual C#.Net?

You will find that there is not all that much distinguishing differences from Visual C# and Visual Basic. These languages are known as Intermediate Languages (IL). This becomes an important factor in that this can have a limitation in what systems may run the applications that are designed with these languages. The limitation falls from the code being interpreted by the Common Language Runtime (CLR). VB.Net is also a language that uses a Just-In-Time (JIT) compiler. This means that an application that is ran for the first time may take a few extra CPU cycles to execute because it is loading for the first time; however, the benefit therein lies when the application runs the code again it will be faster in execution because the JIT compiler had already compiled the coding.

If this is all confusing then don’t worry; as you do more learning about the advantages and disadvantages of VB this will become clear. The main part to keep in the back of your mind is that using these languages will not always provide the most efficient CPU processing times; however, you will also want to keep in mind that most applications spend more time waiting on user input than on CPU cycles; so typically there is no huge advantage to using a language that uses a ‘true’ compiler.

The major difference is program language specifications and a few other minor features / options. A prime example is that Visual C# can handle pointers directly, where as VB must use an API reference to do this. This may confuse the crap out of you now while you are still learning these terms, don’t worry about not understanding. This all basically means that C# can do something better than VB; however, with every Yin is a Yang. Handling a pointer directly can cause application instability, therefore VB can be considered a safer programming language since it will not be as instable when it comes to a pointer. As mentioned before, this all comes down to a preference. You will find throughout your journey as a programmer that there will be many, many non-VB programmers who will think they are using a superior language to VB and you will find many, many VB programmers who will point out where VB handles things better than other languages.

If you talk to an experienced programmer who has used VB and C# on a regular basis for many years, then you are likely to hear that the programming languages are nearly identical, except for syntax usage. To further confirm this you will find software applications available that can readily convert coding from VB to C#, or vice-versa. Now these conversions may not be accurate; but you will find there is very little error in them. The other thing that will be apparent to you, is once you learn VB you will find that if you view coding from C# you will understand quite a great deal of it; you may not be able to convert line for line, but you will definitely be able to look at a block of coding and determine what it is attempting to do and the method in which it is doing it.

No comments: