Should I abandon VB.Net?
blogs.lessthandot.com
blogs.lessthandot.com
C# and VB.NET are even closer to each other than C# and Java. The former share an entire runtime, the latter share a similar syntax. (and yes, C#/VB.NET/CLR/DLR is getting to be quite different than the similar Java ecosystem).
Edit: Ooops... it looks like I agree. Can I blame my misunderstanding on a case of the Tuesday's?
It looks like you are both saying the exact same thing.
C# and VB.NET share lambdas, linq, anonymous functions, delegates. They share the same implementation of generics (which is different than Java), the same type system (which is different than Java, enums, nullables), covariance, contravariance. They share the same frameworks (WPF, Silverlight, WebForms, WinForms, MVC, ...), and the same IDE and other tooling. They share the same patterns: deterministic finalization, asynchronous programming, fluent interfaces. They share the same language shortcuts: auto-properties, properties, collection initializers, ...
Java and C# share braces, semi-colons, &&.
Java and C# are more similar for about 30 seconds.
"without even trying to make it easy for people to convert their old code."
VB.NET and C# even run in the same VM. You can trivially call from one language into code written in the other. The object system is (necessarily) a direct mapping, at least in the direction he's interested in, so even translating VB.net to C# shouldn't be a problem where keeping a particular piece of code in VB isn't practical for extending it.
It just striked me as a not so good priority to have when evaluating your choices for that particular decision.
I've worked on many projects in both languages and I guess I can see why VB programmers transitioned to VB.NET but I don't understand why anyone without a VB background would use it (it's certainly not easier; I've been bit so many times by VB.NET's strange idiosyncrasies).
I've had to work in both and can personally work in either interchangeably. When I switch between projects and move languages I spend a short while forgetfully mixing the syntaxes, but otherwise no biggie - and I do that when jumping in and out of SQL anyway.
Given that, when I was getting a project in a new domain started a while ago, it felt sensible to do it in C# even though I'd done more VB.Net at the time. We all use code samples that illustrate how different tasks are done, then adapt them for our purposes; it didn't take long to see that the samples were predominantly in C# and conversion was something of a hassle and not quite as simple as things made out. Most code worked straight away, but....
If it doesn't matter which you use for your own reasons, I don't see any advantage to not going with the herd of public samples.
And there are online businesses worth hundreds of millions built on copy/paste as the method of code reuse.
Source?
I've been a .net developer for a little over 10 years now, and in my experience VB.net just isn't as prevalent as it use to be. When I search for jobs I typically see one vb.net job for every 4-5 c# jobs. This gap seems to be increasing too.
There is also Mono, which is a nice way to take your c# skills and use them on other platforms.
I think when you really consider everything, C# is a much better language to bet on longterm.
This is different from being a C# or Java mercenary.
Coding should be language agnostic. What should matter is how you could easily devise an algorithm using any of the available language. In a lot of ways, VB.Net has made it quite easier to write and read the codes. The only problem with this is the fact that VB coding has allowed a lot of bad codes to be easily written. I think it is fair to say that those who have switched to C# may have been driven in part by having to maintain poorly written codes in VB.Net and the fact that there is so much hype in using C# because of its resemblance to Java.
And the other thing to point out is that VB.Net has carried the stigma of applications coded in VB6 which were the curse of developers in the MS platform.
1. Code maintenance can be quite lucrative if you can assemble a well-networked client base who'll give referrals
2. The number of other competitors in the field may decrease much faster than the slow abandonment of legacy code
3. Customers with loads of legacy code are often - secretly - interested in new solutions, and you're the one with the understanding of their existing business, software solution and can potentially migrate them out of legacy in little salami slices of profitability
And of course, .NET isn't actually dead as a VM (well I assume that, but I don't do anything in the MS space, but I still hear things about new stuff), so the migration paths (for you as a professional and for legacy code) aren't particularly awful.
Is this the reference of quality in C# development?
Working with C# is like working with a special needs child. I know that some things can happen automatically but they just don't, and I have to do them manually. This is not a language issue, but Visual Studio issue. And this is a reason for ReSharper and other addins that make my life with C# bearable. With VB.net I don't need any addins other than Visual Studio itself.
When switching to vb.net after doing c# for even couple of weeks, my code just flows from my fingers and I feel much much more efficient while writing code.
It sounds to me like the author is opposed to porting his old code to C#, and that's not a bad thing. On the list of things you should consider very, very carefully before executing, a port is right up there with a re-write. However, we're talking Visual Basic and C#.
As stated several times in this discussion, the two couldn't be better integrated. If I were the author, I wouldn't abandon VB.NET, I would simply begin writing new code in C#.
The author should start exploring other languages regardless of whether they abandone VB at work. Odds are they will once they expand their horizons a bit.
How hard would it be for VB .NET programmers to migrate over to c#? My guess is that it would be FAR EASIER than the transition they took from VB6 to VB .NET 2003.
And, the natural migration path has been to Visual Basic .NET (we have quite a lot of it as well).
Our parent company has multimillion-LOC VB6 programs, which they are migrating to Visual Basic .NET
As long as huge companies such as those continue pushing for VB.NET, Microsoft should be wise to support it.
It's not that I would mind moving to C# (it would take me out of my comfort zone, but it wouldn't be so bad), but what about all that code?
----
Choice was pretty simple for the following reasons:
a) Mature VM/Languages (although there are alternatives)
b) Existing Team knowledge-base. This is a biggie. I have another former lisper on the team and I could drag the rest kicking and screaming to lisp or python, but, it's really not worth the effort of convincing management we'll be more productive in language X.
c) Vendor support. We're using a ~$10k interface card. They offer drivers for Windows or VxWorks. The drivers come as either a user-space C Library or a .NET wrapper. Any other language choice I have to either justify to management writing an FFI wrapper to the C library or write it and maintain it on my own time.
d) WPF is very code generator friendly. A majority of our application forms are generated using either XSLT or python.
e) Easy UIs for what has to be customized.
In short, I'm more productive in python or lisp. My team is more productive in C# and WPF. That being said, I'll try to add scripting in the next version using iron python, but, the core will stay in C#.
EDIT: typo in first paragraph.
g) a vibrant Q&A community in the form of StackOverflow
Adding IronPython support is a trivial exercise. Its seriously 2 lines of code to add, plus a few lines to define the scope.
1) Add these imports to your class:
using IronPython.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
2) Instantiate your engine & scope in the appropriate location: mEngine = Python.CreateEngine();
mScope = mEngine.CreateScope();
3) Add variables to your scope like this: mScope.SetVariable("ThisIsWhatTheScriptSees", mReferenceToYourObject);
mScope.SetVariable("Cars", mCars);
mScope.SetVariable("Dog", mDog);
4) Load your script up: var source = mEngine.CreateScriptSourceFromString(strYourScript,
SourceCodeKind.Statements);
5) Run it! source.Execute(mScope);
* You can call the stuff you added to your scope from inside your script: if Dog.IsTame:
name = Dog.CheckName()
for car in Cars:
car.BeepHorn()
* Alright, this is a little more than 2 lines, but I think you get the drift. Good luck!It exists even after high school :)