C# or VB.NET?

14-Jul-11 08:24 pm EST Leave a comment Go to comments
Poll hosting courtesy: Polldaddy.com.
N

o matter how much time passes it seems, the question is always being asked on one project or another: is Java better than Visual Basic?  Is C# better than VB.NET?

Linked-In has been playing host to a lengthy, but at times interesting discussion on this question which seems to have an obvious, short answer.  Yet in the discussion are useful lessons for less experienced programmers that should be taken to heart…

Some highlight replies I selected from the whole thread:

[Posted 14-Jul-2011 ~12:32 PM EDT (UTC –04:00)]

Ben Taylor • Another Twist in the topic:
Perhaps it would be wise to build your Java Skills rather than seeking C#. Why, because they can run in both Windows and many other operating systems.
Let’s face it…many companies are getting tired of the costs for server licenses and moving to LINUX. If you want to program there, the closest counterpart you are going to find to your VB skillset is Java.
Again, the patterns overlap platforms, are are more transferrable concepts.

My comments:

No offence to @Taylor, but I’ve been hearing Linux evangelists prophecy its forthcoming and even imminent triumph displacing Windows in the server rooms of the world for over a decade at least.  Every time I see or hear another report about the escalating Linux trend, I’m forced to ask myself what kind of pigeon holes I’m being stuck in as I’ve moved between assignments (especially during periods of contract work) that I don’t hear much about Linux — either in server rooms of the medium-to-large-sized enterprise or on desktops; save for perhaps the odd enthusiast or hard-core Java dev.  (And I’m speaking as a big fan of Linux; having installed and used it numerous times over the years; both professionally and on spare PCs kicking around the house.)

I’m quite sure what Taylor says about frustrating licencing arrangements (and not just from Microsoft, which at least periodically offers deals that have some appeal over its competitors).  But this frustration isn’t new and it didn’t herald a new era in Y2K-style conversions from so-called “proprietary” platforms to Linux/Java/CORBA solutions.  If there’s gonna be a real move of the sort I think he’s depicting, it will take more than a group of senior DBAs, disgruntled with Oracle and SQL Server calling for it — even in unison.


[Posted 14-Jul-2011 ~3:14 PM EDT (UTC –04:00)]

Prahlad Yeri • A simple example of how redundant and less-productive a language like C# can sometime become.
Suppose you have a Windows Form called mForm that has an object called mObject that consumes your class called mClass. All is running well, and you suddenly decide that you have generate an event in your mClass, that needs to be handled by mObject.
Introducing this new event is much less painful in VB.net than C#. In VB.net you simply have you follow three steps:
1. Declare the Event inside mClass:
Public Event mEvent()
2. Raise the Event at appropriate place in mClass:
RaiseEvent mEvent()
3. Create a procedure and add the "Handles" keyword at the end inside mForm:
Private Sub On_mEvent() Handles mObject.mEvent
End Sub
—–
OTHA to accomplish this in C#, you will have to do a lot of hard-work!!
1. Create a delegate
public delegate void mEventDelegate();
2. Create Event of that delegate type
public event mEventDelegate mEvent;
3. Add a delegate handler to this event inside your mForm:
mEvent += new mEventDelegate(On_mEvent);
4. Create this event handling function:
private void On_mEvent()
{
///
}
5. Raise the event inside mClass:
mEvent();
—————————–
So 3 simple steps of VB.net vs 5 steps of C#. Which one do you think has more simplicity and developer-productivity ? I too like hard-work, but like to utilize it in improvising business logic than writing extra syntax or code.
R,
Prahlad


[Posted 14-Jul-2011 7:13 PM EDT (UTC -04:00)]

Blair Stark • @Prahlad Yeri
This is exactly what is meant by "VB.Not encourages bad programming!"
If you were on my team, and you submitted this code, I would fire you. . . for both the VB and the C# examples you cite!

My comments:

I certainly hope he’s being rhetorical (though it seems not).  I’m not sure I’d want to work for someone who fires people instantly, provoked only a comparison of efficiency between two coding languages in a narrow context and the mere mention of that language which I shall not name out of respect to the author…


[Posted 12-Jul-2011 8:23 PM EDT (UTC –04:00)]

Michel Posseth • @Adolfo López •
Shall we name another 10 features of anny language that can be dangerous ?
but i have a small question for you just out of curiousity
why is this dangerous
Dim bla =1
and this not
var bla = 1;
Or am i now teaching a C# coder that C# has type inference since version 3.0 ? , but hey in VB.Net it is actually a option that is default set to off , so if you feel that you are a coder who can`t be trusted with this feature you have the option to not turn it on
oh and another brain teaser for you ,, without inference no anonymous types ..
by the way for C# it is a superior RAD function given by the compiler as an interesting side-effect of the var keyword is that you no longer have to specify the type name twice when you declare a variable 🙂 …
By the way inference isn`t the same as casting, a type is assigned when the code is compiled in the VB6 time we had a virtuall datatype the variant wich could change during runtime , i guess you are mistaken with that one
Or do you mean something else ?

Advertisements
  1. 25-Jul-11 05:35 pm EST at 05:35 pm EST

    You will be so interesting! I please don’t suppose I have read something like this just before. So wonderful to find a person with some authentic thoughts on this subject. realy thanks for starting this specific up. this web site is something that is required on the web, a person with a little inspiration. useful job for bringing something totally new to the web!

    Like

  2. Marc
    23-Jul-11 06:23 am EST at 06:23 am EST

    @Prahlad Yeri: If you consider a couple of lines of code “hard work”, then perhaps you should consider being a potato chip taster. Seriously, the difference is negligable.

    @Blair Stark: If you’d fire him for his programming practices based on the code he gave, then I have to wonder if a) you’ve ever written VB code, b) you’ve ever written C# code, and c) you’ve ever seen a computer program, because his examples are pretty standard.

    Mayber you’re a baker? Because I can understand you firing a sous-baker over writing a muffing the way you’d write a croissant. I mean really, WTF?

    Like

    • 24-Jul-11 10:08 pm EST at 10:08 pm EST

      There’s no denying many of the responses got nit-picky beyond reason, though he could point out that the design impact of adding “a couple lines” in the event definition in one language using one particular approach may result in more lines being needed elsewhere, etc., etc. But of course, in the end I’d have to agree with you — I haven’t seen nor can I recall this nor other structures in VB.NET yielding vastly more code (if any) than C# or vice-versa. Of all the arguments one could use advocating superiority (where one so misguided as to pick up that gauntlet), the “VB needs bigger code files (i.e. more text) than C# to implement the same functionality” argument was surely among the weakest.

      Mr. Stark’s analyses, apart from being opinionated, smacked of someone who actually hasn’t had a great deal of experience leading development teams nor perhaps even participating as a software development team member. Although I have seen projects within the Government of Canada with leadership practicing a management style whose ancestry could likely be traced back to that of Joseph Stalin were one to do the research, in general those projects where one sees 16 resources dismissed within 6 months from a division employing 30 developers would sound some sort of alarm. But not always. So perhaps Mr. Stark has found success actually implementing his expressed leadership ideals – but he shouldn’t have.

      Like

  1. 14-Jul-11 09:44 pm EST at 09:44 pm EST

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Terry Glavin

CHRONICLES

Techno Manor

Geek's Corner

VM.Blog.

an IT blog.. and an occasional rant

Yammer Site Status

Is Yammer down? Offline? Broken? Undergoing scheduled maintenance? When will it be back? Find out here.

jalalaj

A journey full of wonderful experiences

Azure and beyond

My thoughts on Microsoft Azure and cloud technologies

TechCrunch

Startup and Technology News

Ottawa Citizen

Ottawa Latest News, Breaking Headlines & Sports

National Post

Canadian News, World News and Breaking Headlines

Targeted individuals's

One Government to rule them all.

Joey Li's IT Zone

Everything about IT

jenyamatya

Unravelling the magik of code...

The Bike Escape

Because Cycling is Life

The Ross Report

Now you know where you need to know more...

Lights in the Dark

A journal of space exploration

Strength Rehabilitation Institute

Bridging the gap between physiotherapy and exercise.

The Ross Report

Now you know where you need to know more...

Little Girl's Mostly Linux Blog

Nothing to see here. Move along...

David Eedle

Geek, tech, programmer, business owner. Serial starter of things. Occasional finisher. Oh, and please don't call me Dave.

%d bloggers like this: