VB/C# "Coevolution"
-
C# = VB - (VB.UglySyntax | VB.CounterIntuitiveUseOfTheSameBracesEveryWhere | VB.OverlyVerboseAndHardToReadCode );
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
C# = VB - COBOL.SyntacticVerbosity + C.Braces
Software Zen:
delete this;
Fold With Us![^] -
puromtec1 wrote:
C# is more succinct, and is therefore easier to read and write.
Not in all cases... And more succinct isn't necessarily easier to read and write... See two examples in William's post here[^]. I could probably think of a few more situations in which VB is easier to read, but it's just about time to go home, and I'm close to passing out (#%*@ing insomnia)... Personally, I started out in Basic and was pretty decent at VB before I even tried C#, but now I work almost exclusively with the latter. I do prefer the C# syntax in most cases, but that doesn't mean it's universally better.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of Guardians of Xen (Sci-Fi/Fantasy novel)Ian Shlasko wrote:
I'm close to passing out
I hear you on that one... It is true that his for example demonstrates a for statement is less characters in VB. However, it highlights another readability issue which is that the VB statement requires pause to remember "when does 'i' stop, at 5 or before 5?' Also, you have to realize that characters like these '{}()[]' are visual aids that help our eyes separate and identify information. This is in fact a plus for readability while it does increase the number of characters on the page in some instances.
Ian Shlasko wrote:
I started out in Basic
Basic on the TI calculator is where I started and did vb before C#, too.
Ian Shlasko wrote:
but that doesn't mean it's universally better.
I don't think it is worthwhile to postulate if anything is universally better to everything else regardless of topic. However, it is an important question to answer because it may affect the bottom line of our customers.
-
Ian Shlasko wrote:
I'm close to passing out
I hear you on that one... It is true that his for example demonstrates a for statement is less characters in VB. However, it highlights another readability issue which is that the VB statement requires pause to remember "when does 'i' stop, at 5 or before 5?' Also, you have to realize that characters like these '{}()[]' are visual aids that help our eyes separate and identify information. This is in fact a plus for readability while it does increase the number of characters on the page in some instances.
Ian Shlasko wrote:
I started out in Basic
Basic on the TI calculator is where I started and did vb before C#, too.
Ian Shlasko wrote:
but that doesn't mean it's universally better.
I don't think it is worthwhile to postulate if anything is universally better to everything else regardless of topic. However, it is an important question to answer because it may affect the bottom line of our customers.
puromtec1 wrote:
Basic on the TI calculator is where I started
Oh yeah, I did a little line bouncing screensaver on my TI-83+ 6 to 10 years ago... I should add that to my resume. ;P
-
William Winner wrote:
or instead of for (int i = 1; i <= 5; i++) how about for i = 1 to 5.
But what if you wanted to do something crazy like
for(float f=0; f < someNumber; f*=f)
My current favourite word is: Smooth!
-SK Genius
SK Genius wrote:
for(float f=0; f < someNumber; f*=f)
Well, first of all, that is an infinite loop as 0 * 0 is always going to be 0, but I get your point, and I agree that in many cases, including that one, c# is quicker...though you can still always just do a
while
ordo while
loop. You're never limited to just thefor
loop. -
Maybe I haven't set up VS to make C# programming quicker, but I find the IDE in VB so much easier to use. For instance, the fact that you don't have to know which methods are available for a control, you just pick the one you want from the drop down's at the top of the code window. Or the fact that the VB IDE seems to correct a lot, which can make it a lot quicker...like if I type "if i = 0" and hit enter, it fills in the "Then" and "End If". And some of the statements seem more streamlined or with more functionality...for instance
Select Case intI
case <5
do something
case 6-10
do something else
case >10
do another thing
End Selector instead of
for (int i = 1; i <= 5; i++)
how aboutfor i = 1 to 5
. Personally, I find the VB IDE soooo much easier and quicker to use.Rather than "End Select", "End Sub", "End While", and so on, C# has "}". More concise. You are ending a code block, so you really only need one thing to do that, and why not make it one character, so you don't need anything to be filled in when you press ENTER. In C# Windows Forms development, you just right click a control (in the designer) and select "Properties". You then click the little lightning icon if you want to see all the events on the control you can subscribe to. Same as the "which methods are available for a control" you mention in VB. Or you can use intellisense by typing the control name and typing "."... a list will pop up with all the methods, properties, and events on that control. There are even little icons to identify what type of thing (event, method, property, etc) each thing is. No real difference here between VB/C# in the IDE. C# has the "switch" statement, which is much like the "select case" statement in VB. One thing I do like in VB is the ability to do ranges and such (e.g., "case < 5"), which you cannot do in C#. The only way to do that in C# is to do a chained "IF" statement, but that's not too ugly given how concise the syntax is in C#. For example:
if (intI < 5)
{
// Do something.
}
else if (intI >=6 && intI <=10)
{
// Do something else.
}
else if (intI > 10)
{
// Do another thing.
}I'm sure the builders of C# could add an extra construct to parse a "for(i = 1 to 5)" or something of that sort, but I don't see any reason to clutter up the language with specific cases. The included "for" statement is more flexible than the VB version. There is also "foreach" which I think is in both languages. I like that C# doesn't add unnecessary syntactic sugar unnecessarily to burden me with learning extra stuff. Some people like that kind of thing though, so I suppose VB works fine for them. I'd say the main difference between VB and C# is that C# seems more geared to those who want to understand the underlying concept (e.g., a code block is the same no matter which context it is in) while VB is more geared toward concrete thinkers who want to see things in more explicit terms (e.g., there is a "SELECT" code block and a "WHILE" code block and a "FOR" code block and so on).
-
Rather than "End Select", "End Sub", "End While", and so on, C# has "}". More concise. You are ending a code block, so you really only need one thing to do that, and why not make it one character, so you don't need anything to be filled in when you press ENTER. In C# Windows Forms development, you just right click a control (in the designer) and select "Properties". You then click the little lightning icon if you want to see all the events on the control you can subscribe to. Same as the "which methods are available for a control" you mention in VB. Or you can use intellisense by typing the control name and typing "."... a list will pop up with all the methods, properties, and events on that control. There are even little icons to identify what type of thing (event, method, property, etc) each thing is. No real difference here between VB/C# in the IDE. C# has the "switch" statement, which is much like the "select case" statement in VB. One thing I do like in VB is the ability to do ranges and such (e.g., "case < 5"), which you cannot do in C#. The only way to do that in C# is to do a chained "IF" statement, but that's not too ugly given how concise the syntax is in C#. For example:
if (intI < 5)
{
// Do something.
}
else if (intI >=6 && intI <=10)
{
// Do something else.
}
else if (intI > 10)
{
// Do another thing.
}I'm sure the builders of C# could add an extra construct to parse a "for(i = 1 to 5)" or something of that sort, but I don't see any reason to clutter up the language with specific cases. The included "for" statement is more flexible than the VB version. There is also "foreach" which I think is in both languages. I like that C# doesn't add unnecessary syntactic sugar unnecessarily to burden me with learning extra stuff. Some people like that kind of thing though, so I suppose VB works fine for them. I'd say the main difference between VB and C# is that C# seems more geared to those who want to understand the underlying concept (e.g., a code block is the same no matter which context it is in) while VB is more geared toward concrete thinkers who want to see things in more explicit terms (e.g., there is a "SELECT" code block and a "WHILE" code block and a "FOR" code block and so on).
I don't use C# a whole lot, and I hadn't found that little lightning bolt yet. Yeah, that would have helped a lot. I do like that the brackets identify a code block, but the VS IDE automatically handles the tabbing for both languages (though, every once in a while, they don't), and without that, both languages can be hard to determine which '}' goes with which '{'.
-
SK Genius wrote:
for(float f=0; f < someNumber; f*=f)
Well, first of all, that is an infinite loop as 0 * 0 is always going to be 0, but I get your point, and I agree that in many cases, including that one, c# is quicker...though you can still always just do a
while
ordo while
loop. You're never limited to just thefor
loop.True. To be honest if I need to do anything other than increment or decrement then I'll use a while loop.
My current favourite word is: Smooth!
-SK Genius
-
puromtec1 wrote:
C# is more succinct, and is therefore easier to read and write.
Not in all cases... And more succinct isn't necessarily easier to read and write... See two examples in William's post here[^]. I could probably think of a few more situations in which VB is easier to read, but it's just about time to go home, and I'm close to passing out (#%*@ing insomnia)... Personally, I started out in Basic and was pretty decent at VB before I even tried C#, but now I work almost exclusively with the latter. I do prefer the C# syntax in most cases, but that doesn't mean it's universally better.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of Guardians of Xen (Sci-Fi/Fantasy novel) -
You are assuming that the ability to find each word of a programming language in an english dictionary defines how easy the language is to read. Within the context of programmers reading code (not an average Joe), C# is more succinct, and is therefore easier to read and write.
Nonsense - txt spk is > sccnt ! ez As a general rule the total mental processing in any communication is constant therefore the more effort made by the writer the less is required by the reader and vice versa. The design goal of "easy to write" should only be prioritised if more people are going to write the code than are going to read it.
'--8<------------------------ Ex Datis: Duncan Jones Free eBook: Printing - a .NET Developer's Guide (Part 1)
-
VB = --Programmer;
Christopher Duncan
www.PracticalUSA.com
Author of The Career Programmer and Unite the Tribes
Copywriting ServicesThere's a difference between being a VB programmer and liking it, and being a VB programmer because you have to be right now (me).
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
Maybe I haven't set up VS to make C# programming quicker, but I find the IDE in VB so much easier to use. For instance, the fact that you don't have to know which methods are available for a control, you just pick the one you want from the drop down's at the top of the code window. Or the fact that the VB IDE seems to correct a lot, which can make it a lot quicker...like if I type "if i = 0" and hit enter, it fills in the "Then" and "End If". And some of the statements seem more streamlined or with more functionality...for instance
Select Case intI
case <5
do something
case 6-10
do something else
case >10
do another thing
End Selector instead of
for (int i = 1; i <= 5; i++)
how aboutfor i = 1 to 5
. Personally, I find the VB IDE soooo much easier and quicker to use.William Winner wrote:
Or the fact that the VB IDE seems to correct a lot, which can make it a lot quicker...like if I type "if i = 0" and hit enter, it fills in the "Then" and "End If".
But with c#, you don't need to worry about the extra typing.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
As someone who develops in both C# and VB as a given project requires, one of the things I've noticed is that if I'm coming from working with VB to C# I find it takes longer for me to get the VB syntax and structure out of my head rather than the other way around, I rarely have difficulty going from a C# project to VB. My background is in C++ which is the only explanation I can offer.
-
There's a difference between being a VB programmer and liking it, and being a VB programmer because you have to be right now (me).
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001Using the commonly accepted definition of the phrase, you are not now, nor will you ever be, a VB programmer. You're merely a programmer, and one who occasionally must resort to VB in order to continue eating on a regular basis. I used to dig ditches, work in factories and do other mindless and menial tasks in order to pay the bills. It's called survival skills. :)
Christopher Duncan
www.PracticalUSA.com
Author of The Career Programmer and Unite the Tribes
Copywriting Services -
-
Maybe I haven't set up VS to make C# programming quicker, but I find the IDE in VB so much easier to use. For instance, the fact that you don't have to know which methods are available for a control, you just pick the one you want from the drop down's at the top of the code window. Or the fact that the VB IDE seems to correct a lot, which can make it a lot quicker...like if I type "if i = 0" and hit enter, it fills in the "Then" and "End If". And some of the statements seem more streamlined or with more functionality...for instance
Select Case intI
case <5
do something
case 6-10
do something else
case >10
do another thing
End Selector instead of
for (int i = 1; i <= 5; i++)
how aboutfor i = 1 to 5
. Personally, I find the VB IDE soooo much easier and quicker to use."...Personally, I find the VB IDE soooo much easier and quicker to use."
My thoughts exactly. VB has its drawbacks like any language. But all the curly braces and semicolons in C# add to the clutter on the screen. VB's syntax is nice and clean. -
That's all well and good and people can debate about which code is easier to read. What's really important, though, is how easy a language is to look at code written for it and understand all of what it's doing. Unfortunately, the best language for that in the .Net world, C++/CLI, gets almost no support.
-
Nonsense - txt spk is > sccnt ! ez As a general rule the total mental processing in any communication is constant therefore the more effort made by the writer the less is required by the reader and vice versa. The design goal of "easy to write" should only be prioritised if more people are going to write the code than are going to read it.
'--8<------------------------ Ex Datis: Duncan Jones Free eBook: Printing - a .NET Developer's Guide (Part 1)
You'd be right, except that it turns out in practice that succinctness often contributes to clarity. Exception taken for use of obscure tricks.
-
VB code is easy to read - what drugs are you on. Can I have some ?
Candy: Here's the plan: we changes our names, move to a distant island, and disguise ourselves as a family of traveling donkey polishers.
VB code is THE ugliest code I've ever seen. I'm a .net developer, and am looking at a peachy job, only 8 miles from my house (I currently commute over 45 miles ONE WAY to work). I'm second guessing taking that job because... they code in VB. While I realize that vb.net is every bit effective as C#, it takes me back to the mid 90's, where VB6 (and earlier incarnations) was what people who WEREN'T real programmers used. It makes my stomach turn to even look at VB syntax. Do a search on CareerBuilder (or monster, or whatever) for the city where you live for ".NET DEVELOPER". Then see how many refer to VB. I did this for Charlotte, and got 51 hits (25 per page). On the first page, 22 were C#, one said vb/c#, one said vb, the other didn't specify. That's not even 10% usage. I didn't even bother to look at the second page. Businesses are primarily settling on C#. Probably because "real" programmers don't wanna look at that VB crap. That's not ME talking... that's the facts of the business world. Do your own search and see it for yourself.
-
Using VB / C# is down to a personal preference for one reason or another. But at the moment i am getting more consistant work with VB where i live
-
Rather than "End Select", "End Sub", "End While", and so on, C# has "}". More concise. You are ending a code block, so you really only need one thing to do that, and why not make it one character, so you don't need anything to be filled in when you press ENTER. In C# Windows Forms development, you just right click a control (in the designer) and select "Properties". You then click the little lightning icon if you want to see all the events on the control you can subscribe to. Same as the "which methods are available for a control" you mention in VB. Or you can use intellisense by typing the control name and typing "."... a list will pop up with all the methods, properties, and events on that control. There are even little icons to identify what type of thing (event, method, property, etc) each thing is. No real difference here between VB/C# in the IDE. C# has the "switch" statement, which is much like the "select case" statement in VB. One thing I do like in VB is the ability to do ranges and such (e.g., "case < 5"), which you cannot do in C#. The only way to do that in C# is to do a chained "IF" statement, but that's not too ugly given how concise the syntax is in C#. For example:
if (intI < 5)
{
// Do something.
}
else if (intI >=6 && intI <=10)
{
// Do something else.
}
else if (intI > 10)
{
// Do another thing.
}I'm sure the builders of C# could add an extra construct to parse a "for(i = 1 to 5)" or something of that sort, but I don't see any reason to clutter up the language with specific cases. The included "for" statement is more flexible than the VB version. There is also "foreach" which I think is in both languages. I like that C# doesn't add unnecessary syntactic sugar unnecessarily to burden me with learning extra stuff. Some people like that kind of thing though, so I suppose VB works fine for them. I'd say the main difference between VB and C# is that C# seems more geared to those who want to understand the underlying concept (e.g., a code block is the same no matter which context it is in) while VB is more geared toward concrete thinkers who want to see things in more explicit terms (e.g., there is a "SELECT" code block and a "WHILE" code block and a "FOR" code block and so on).
That is one thing I miss about VB. I always prefered the End If/While/Function/Sub stuff instead of }. Makes it easier to see, yes, this code was an if statement, this was a while loop, etc. At least VS highlights the opening brace though. But that being said, I prefer c#, case sensitivity is actually nice when knowing where a variable was defined if you always follow a programming standard, variables starting with _ are global, lower case are defined in the method, and capitals are always the name of the method. At least, thats the way we do it here.
I like dead people. They are quiet and happy with what you give them.