how to learn visual basic?

Java and C# look syntactically similar, and pretty much anything you do in Java translates 1:1 into C#. (can't think of anything that doesn't involve API differences)

The opposite is far from true though, since VB and C# are a lot richer languages than Java (in terms of type system and language constructs, not API availability). Translating from C# into Java is tricky and often require a lot of re-engineering, like adding explicit declarations and expanding functional features into additional interfaces and classes, and working around all of the issues with Java generics.

Scala on the JVM is a lot closer to C# with the type inference, proper generics and functional features being much more comparable. It's a really nice language, worth looking into ;)
 
C# has a few extra benefits over VB.net.

One i can think of is in code-behind pages, web form items need to be explicitly declared in VB. They are implicitly declared without any extra coding in C#.
 
Correct me if I'm wrong, but isn't it down the framework version rather than version of Visual Studio you are using?

The .NET framework 4.0 brought the missing functionalities from both languages to each other.

i hazard as a guess but with VS10 which contained framework 4.0 which brought the missing the functionailities.


Anyway thanks for discussion, i conclude since VB & C# are very similar i'll just use online resources to learn the minor different syntex.

Thanks.

p.s. i got VS 2010 Ultimate Edition Free with my course... envy anyone? :P
 
At last a thread with most people being reasonable. I did a little Fortran and Cobol back in '88 then quite a bit of C and assembler. After a long break I have written several thousand lines of VB over the last year and when looking up examples of specific functions don't even notice half the time if they are written in C# or VB
 
Correct me if I'm wrong, but isn't it down the framework version rather than version of Visual Studio you are using?

The .NET framework 4.0 brought the missing functionalities from both languages to each other.

Optional and named parameters are a language feature rather than a framework feature, hence they're in VS2010/C# 4 rather than .NET 4.0
The CLR has always been able to support them (as is evident by the fact that they work in VB.NET) just that C# hasn't taken advantage of them until now.

I have to say, coming from a VB6 background to developing in VB.NET I thought that VB syntax was on a par with C style syntax.
Having done C# development for the last few years I don't think I could ever go back now though. VB just feels so clunky in comparison. As previously mentioned lambdas are nicer in C# and things like type parameters feel a little awkward in VB.NET
 
Here's my tuppence on the subject.

The difference between C# and VB.Net is largely due to the people writing it.

C# developers tend to have come from a more rigorous academic software background, and as such, I have found that C# code in general (although not always) is of a much higher standard than VB.Net, whose proponents tend to have come from a more end-user language such as vb4/5/6.

Having said all that the worst code I've ever seen and the worst coders have been C#, but I suspect that's a case of people making the chasmic leap from procedural to object languages, and I see the same thing with people shifting from object to functional too.

As an interesting aside, here's a tip to make your code better; if you have to use optional parameters, you really need two methods, not one.

I hate parameters for methods, they're ugly. One parameter is one too many.

Take a classic example IsPrime(int numberToCheck)

Instead of having that as a static method on a meaningless class, why not simply have IsPrime() as an extension method on an integer? Makes it much easier to read, much easier to test and use.

From Clean Code (Bob Martin):

"The ideal number of arguments for a function is zero (niladic). Next comes one (monadic), followed closely by two (dyadic). Three arguments (triadic) should be avoided where possible. More than three (polyadic) requires very special justification -- and then shouldn't be used anyway."

It's an interesting concept, have a go at trying to remove the parameters from your methods/functions. It's an interesting exercise - and usually I find that my code is much cleaner afterwards.
 
Thanks for that; I was about to write some code a few days ago where I thought an extension method would be ideal, but didn't realise C# supported them so did pretty much what you called a classic example. Just gone and fixed that now.
 
Back
Top Bottom