views:

83

answers:

9

First, let me ask you to consider this as a real question, and not a subjective one.

That out of the way, here's my situation: We are looking to port our existing classic ASP application to .NET, but we're unsure of what language to use for the new app.

I personally would 'prefer' C#, as I'm more familiar and comfortable with that languages way of doing things, but, the original code is VBScript, so it would possibly be easier to port to VB.NET ... One possible situation I fear would be that, because the code is so similar between the two variants of VB, that we might end up getting stuck on something that is not similar between the two, even though it looks like it would work. A shift to a wholly different language might avoid that kind of situation.

Does anyone have any practical examples of this kind of situation? Insights to illuminate the issue with? Do the potential benefits of a complete paradigm shift outweigh the gains from a high degree of 'copy-and-paste-ability' ?

+2  A: 

There are 10X as many questions re: C# as there are VB.NET on StackOverflow. That seems to indicate there are more developers using C#, or perhaps a more thriving community (or maybe it just means C# is harder or C# developers don't know as much).

Any gains made due to the similarity of VBScript to VB.NET are far outweighed by the fact that you need to learn the new data types, .NET namespaces, and a new style of web development using webforms or MVC (my preference).

For this reason I think the choice of language should be made independently of what was used before.

RedFilter
I admit that both of your responses are part of my own personal reasons for wanting to go with c#....I actually had something about th 10X factor in the original question, but edited it out before I posted.:D
reidLinden
Great point! I have also found that almost ALL code samples for frameworks are in C#. Some provide samples in VB.NET as well, but most JUST provide C# examples. I have yet to see any tool that provides only VB.NET code examples.
Zoidberg
+4  A: 

I have used C#.NET and just recently learned VB.NET and I have to say that once you get around the small syntactical differences, VB is also a very good language. So for you, this is a win win.

That being said, I think a syntax change will help protect the project from any careless copy pastes from the old dirty code base. I believe a fresh start with a fresh language is your best bet for a top notch re-write.

Zoidberg
+1 for the careless copy/paste angle. Platforms are different enough that changing syntax and forcing the code review is not a bad thing.
Wyatt Barnett
A: 

When moving to ASP.NET, I believe that less focus needs to be on the page itself, and more on how you're going to write the business logic. This is a subjective question because different units will have different results.

That said, always play to your strengths. If your team is more familiar with C# than VB.NET, use C#. If they're more familiar with VB.NET, use VB.NET. If they have no real .NET Experience, then you probably want to set up some sample projects with which they can play to see which will be easier to learn. You want the most bang-for-your-buck, and that means making sure the team is as comfortable as possible.

Further, I wouldn't worry too much about copy & paste code, as there are enough differences that any professional developer (as in one who acts professional, not just one who gets paid) will see how much he/she is changing and go back through the rest of the code to ensure it is working properly.

AllenG
Copy/Paste SHOULDN'T be an issue... but we all know that lazyiness is far too common in our industry.
Zoidberg
A: 

The difference between an ASP.NET and Classic ASP application is already so big, that it will not be an easy copy/paste port anyway.

So I think you should go for the language that you feel most comfortable with (and as another answer suggests, there is a much larger community using C# than VB.Net).

Jappie
A: 

Why are you rewriting the application? What are the short and long term objectives you hope to achieve through this change?

At a high level there is not much to choose between VB and C# - both are extremely functionally rich labguages that compile to teh same IL code.

Personally I moved to C# a few years ago because the vast majority of code examples found on the net are in C#, and the programmer's best friend is the internet where you may just find that nugget of useful information that save you hours of head scratching.

In your situation, by fircing yourself to rewrite the code in a different language will force you to possible rething the implementation and therefore review carefully the code and functionality required - if yuo have the time and budget. If you are up against tight deadlines then VB would be the natural choice, but may negate the benefiots if the rewrite.

Clicktricity
Why rewrite ? mostly, because the existing app continues to change, and each successive change becomes harder to manage, because the (non-existant) framework is always in the way. We don't want to make changes because the current app feels like a house of cards, likely to fall with the very next card we place.
reidLinden
A: 

3 years ago I had to make this same decision. My preference would have been C# but we ultimately went with VB.Net because that was the closest language available to the developer base we had. All of the developers had experience with VBScript, so learning VB.Net was easier for them. While the framework is the framework and the rest is just syntax and best practices, you'd be surprised the difference in learning curve just by adding a few curly braces for VB developers (the reverse seems to be exactly the same for C# developers going the other way with an itchy semi-colon finger, learning new keywords and relearning event syntax).

You should look at your developer pool and consider what is the easiest for your team to perform development and maintenance. If this is not a serious criteria (because the developers are proficient equally in both), then I would recommend a C# approach. The primary reason is that the VBScript will be relying on outdated methodologies, but converting to VB.Net will not necessarily throw exceptions for these methods whereas C# will. It will also force you to touch every aspect of your application, which (while tedious) will provide your team an opportunity to evaluate how older methods may be refactored into more efficient processes.

Just keep in mind - the "easiest" seeming solution seldom is.

Joel Etherton
Can you clarify what you mean about C# throwing exceptions because of "outdated methodologies"? If you use `Option Strict`, isn't VB.Net just as rigorous as C#?
MarkJ
@MarkJ - Typically it is yes, but when you go with VB.Net, by default it adds the Microsoft.VisualBasic namespace allowing methods like CStr, CInt, CDbl, etc which are deprecated under the .Net framework. There are also some Server.CreateObject statements (none of which I can't cite without redoing my research) that would work under VB.Net but for some reason broke under C#. Mostly they were design/syntax niggles more than anything else, but on a large scale project, a lot of small things can turn into a big one.
Joel Etherton
`Microsoft.VisualBasic` is **not** deprecated, it is [fully supported as part of the .Net runtime](http://msdn.microsoft.com/en-us/library/aa289509.aspx). See discussions in [this question](http://stackoverflow.com/questions/226517/is-the-microsoft-visualbasic-namespace-true-net-code). I can understand you might wish to avoid `Microsoft.VisualBasic.Compatibility` which Microsoft advise "should not be used for new development". I don't understand how Server.CreateObject could work in VB but not C#, unless `Option Strict` was Off.
MarkJ
@MarkJ - All of the documents you referenced are from 2002-2004. I would challenge you to find a similar VB document for the more modern IDE versions. It may not be "officially" deprecated, but Microsoft has been weening all of their documentation away from this namespace. As for Server.CreateObject, I don't remember which calls failed. I recall we had 3 failures to Server.CreateObject when we converted, but I don't recall what specifically they were.
Joel Etherton
Selected as the answer, mostly for the reason :You should look at your developer pool and consider what is the easiest for your team to perform development and maintenance. All other answers were also pretty much on the money too, suggesting pros and cons of both. Thanks much, all!
reidLinden
A: 

I have been in exactly this position, and I urge you not to translate the app in two ways at once--from VB to C# and from classic ASP to ASP.NET.

You have chunks of business logic in your code that will not need to change much, so why change it? You are guaranteed to introduce new bugs in the translation.

I can't count how many times I thought, "this looks exactly the same, why isn't it working?"

Just adapting your code to the new codebehind pattern will be challenging enough. A vast and worthwhile improvement, of course, but not trivial.

egrunin
A: 

VB.NET and C# are so incredibly similar that technically the choice is almost irrelevant. Each language has some minor things they excel in, but overall, the two are practically identical, just with wildly different syntax.

With that said, I highly recommend going with C#, just because it's the language the .NET community really got behind. It will have the most books, websites, blogs, forums, you name it. Not having to translate the oodles of examples out there on the net into VB.NET alone makes C# a better choice. I think in my 10 years of being a .NET developer, I could count the number of people I've ran into that genuinely chose VB.NET on one hand. Most people that are using VB.NET are using it in a "stop gap" fashion, with the intention of ultimately going to C#.

Matt Greer
A: 

Many people go for C# because they think that VB.Net and C# is only syntactically different which is just not true. VB.Net has better features for handling interactions with COM components for example, like optional parameters (these are now available in C# 4.0). But there are catches too in a line by line conversion of VB to VB.net. A very simple example is the array index. If I'm not mistaken array indexes start from 1 in vb and in vb.net it starts from 0 which causes horrible bugs. Overall, I'd definitely consider going for VB.Net even though I work basically in C#.

Sidharth Panwar