473,842 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beating a dead Horse: Which Language

Hi,

I know that I'm an extreme newb by asking this overly beaten question,
but I am leaning toward C#, becuase the perception is that it is better
to learn than VB.Net. I guess it makes you cooler.:-)

Anyhow, I am a novice programmer, and I will remain one as well...I have
no plans to make programming my life ambition, but I think that it would
be fun to make my databases do some cool tricks and maybe write a
simplistic client to access the database over the LAN, and by internet
as well. My programing will be centered around Data manipulation, i.e.
collecting, sorting, and reporting on this data to myself.....

I want to know which language you find most compelling to accomplish my
mission. It may be that it doesn't have anything at all to do with the
language, from my understanding they are close to equal, but everyone I
come in contact with prefer C# over VB.net
Please, NO FLAMES; just logic
Thank you in advance!
Nov 21 '05
114 3734
Jon Skeet [C# MVP] <sk***@pobox.co m> wrote in
news:MP******** *************** *@msnews.micros oft.com:
You seem to be regarding C# as equivalent to C. While the syntax is
similar in many ways, they're very different languages. For one thing,


They are significantly different. C# is much closer to C++, and even then quite different.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Blogs: http://www.hower.org/kudzu/blogs
Nov 21 '05 #91
Chad,

"Chad Z. Hower aka Kudzu" <cp**@hower.org > schrieb:
Yes, I actually think that VB.NET's casting syntax is better because
it doesn't suffer from the "lots of brackets" problem:

\\\
((SampleForm)fo o.MdiParent).Bl a();


This is one thing that I really really dont like about C#. I much prefer
Delphi's casting which I thikn
is similar to VB.NET.

SampleForm(foo. MdiParent).Bla( );
DirectCast(foo. MdiParent, SampleForm).Bla ()


Ack, Im not to fond of that either. :) I'll stick to preferring Delphi's
semantics on this one.


I don't think that the approaches taken in C#, Delphi, and VB.NET are
optimal. However, I prefer the way Delphi and VB.NET handle casts.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #92
Herfried K. Wagner [MVP] <hi************ ***@gmx.at> wrote:
How long do you really think it takes to get used to the syntax that
doesn't include redundant text?


It doesn't take long, but the code is still not as self-documenting and
self-explanatory as the VB.NET code is.


I think we'll have to agree to disagree.
Have a look at the casting syntax in C#
compared with VB.NET - do you really think that the CType syntax is
more elegant than the casting syntax?


Yes, I actually think that VB.NET's casting syntax is better because it
doesn't suffer from the "lots of brackets" problem:


And again, we'll have to disagree.
(Admittedly I wish that the
unboxing and conversion syntax in C# were distinct from casting, but
that's another issue. There are various things I'd like to see done
differently in C#...)


I'd like to see something like shown below as casting syntax:

\\\
foo.MdiParent.@ SampleForm.Bla( )
Dim x As IFooBar = goo.Bar.@IFooBa r
///


Eek - I find that as bad as anything else I've seen, personally.
In terms of a language itself, of course, it's significantly smaller
than VB.NET - what there is may be slightly harder to learn, but there
are far fewer keywords - 78 in C# compared with 151 in VB.NET.


There are many specialized keywords a beginner doesn't need to be aware of
('Declare', 'Auto', 'Unicode', 'Ansi', 'Alias', etc.). Some other keywords
increase readability of the code and are thus worth learning ('Overloads',
'AddressOf', 'RaiseEvent', 'Implements', 'Inherits', 'MyBase', ...). Other
keywords listed for VB.NET are not keywords at all ('Variant', 'Wend',
'GoSub', 'Let', 'EndIf', ...). Keywords like 'REM' and 'Stop' are rarely
used. The list of C# keywords doesn't include operators, but VB operators
are listed as keywords ('Or', 'And', 'OrElse', 'AndAlso', 'Xor', 'Not',
'Mod', ...). Another class of keywords are keywords for features only
supported by one of the programming languages ('Like', 'With', 'My',
'WithEvents', 'Handles', 'Where', 'On', 'Error', 'Resume', ...).


But you need to know those keywords if you're going to read code which
uses them, and presumably you're prevented from declaring identifiers
with those names (which is where it's not a problem with C# in terms of
the operators being symbols rather than names).
That's also not including all the VB built
in functions, many of which have been carried over from previous
versions of VB despite perfectly reasonable versions of many (most? I
don't have enough experience in VB to know) being available in the
framework.


Use of these functions is optional, it's not crucial to know how these
functions work.


But it's a cause of confusion to someone who's familiar with .NET, but
not as familiar with VB functions.
In short, being a new language, C# doesn't have nearly as much baggage
as VB.NET does. (There are one or two places where C syntax has
unnecessarily been carried over, and that's a shame, but it's far from
the same situation as in VB.NET.)


I think that both languages, C# and VB.NET, carry over a lot of legacy
syntax. I believe that the ability to reuse knowledge is very important for
the success of a new programming language. Additionally I prefer
code-compatibility to a language's predecessor over revolutionary change.


Whereas I prefer the *language* to be small, and the *library* to be
where functionality lies.
Only where you're comparing two boolean values directly, which I find
to be pretty rare. I'll certainly accept that there's potential for a
bug there though. How often have you actually seen that bug, out of
interest?


I have seen it several times when working together with C++ beginners who
come from various backgrounds, and the bug made them ask "Why doesn't the
code work as expected?"...


Ah, but in C/C++ it's different - in C/C++ you can get the error with
types other than a boolean. How often have you seen it *with booleans*?
If you were a beginner, what would you think that would do? In C# it's
not valid because Thread.Sleep is a static method. In VB.NET (2003) it
compiles without a warning, even in Option Strict mode. In 2005 it's an
optional warning/error, fortuantely.


It's a matter of semantics. The 'Shared' keyword in VB.NET means that the
member is shared between all instances of a class, which is different from
the semantic of 'static' in C#.


I don't believe it's different at all - and I don't believe it means
it's shared between all instances. Just as in C#, it really means that
the member belongs to the type rather than any particular member. Even
the VB.NET documentation says that:

<quote>
Shared elements are not associated with a specific instance of a class
or structure.
</quote>

The implication from your statement is that the member effectively
doesn't exist if there are no instances (because the set of instances
it is shared between would be empty) whereas that's not true.

Could you give an example where something being static in C# and Shared
in VB.NET would produce semantically different code?

I *do* understand the difference between VB.NET's Static and C#'s
static though.

You still haven't addressed the actual issue though - if someone writes

thread.Sleep(10 00)

in VB.NET, it compiles (in VS.NET 2003) without error, but doesn't do
what is expected.

Put it this way - if it's not a bad thing to do, why is there a warning
for it in VS 2005?
Another example - C# doesn't let you use a local variable unless it's
been definitely initialised. VB.NET (2003) does - again, a new
warning/error in 2005.


VB.NET automatically initializes variables, which is IMO a good thing in
addition to the warning.


It's good to initialize *member* variables, but why would you *want* to
use a local variable which hadn't been definitely assigned? It seems
like a bad idea to me.
Another example - VB.NET lets you pass properties by reference, even
though the semantics are significantly different in terms of timing and
what happens if an exception is thrown. I wonder what proportion of
VB.NET developers really know what happens when a property is passed by
reference?


I don't see a big problem here...


<shrugs> I do, and I suspect a lot of VB developers don't know what's
going on behind the scenes, and that some of them may be bitten by it.
And as I say, you don't need to in C# if you write readable code to
start with.


Yeah, you could still scan the code for the blocks' heads with your eyes,
but this is a costly process.


Not if the method is well written and indented. I certainly don't spend
a lot of time doing it.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #93
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in
news:eX******** ******@TK2MSFTN GP12.phx.gbl:
I don't think that the approaches taken in C#, Delphi, and VB.NET are
optimal. However, I prefer the way Delphi and VB.NET handle casts.


The syntax? Or other? I dont like the way C# handles it simply because you often have to add more
() to tell it what to cast, and if you dont it can cast something other than you might expect.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Blogs: http://www.hower.org/kudzu/blogs
Nov 21 '05 #94
"Chad Z. Hower aka Kudzu" <cp**@hower.org > schrieb:
I don't think that the approaches taken in C#, Delphi, and VB.NET are
optimal. However, I prefer the way Delphi and VB.NET handle casts.
The syntax? Or other?


I don't like the syntax for type casts in C#, I consider it a bad design and
legacy syntax because of the "lots of braces" issue that could have been
solved easily.

On the other hand, I like the syntax for casts in VB.NET and Delphi more.
However, I think that the VB casting syntax is too verbose and thus
increasing the line length of the code without adding much value to the
code. The Delphi casting syntax IMO suffers from the problem that it is
similar to a constructor call, especially when being incorporated into
VB.NET or C#, and thus maybe misleading.
I dont like the way C# handles it simply because you often have to add
more
() to tell it what to cast, and if you dont it can cast something other
than you might expect.


ACK.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #95
Chad Z. Hower aka Kudzu <cp**@hower.org > wrote:
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in
news:eX******** ******@TK2MSFTN GP12.phx.gbl:
I don't think that the approaches taken in C#, Delphi, and VB.NET are
optimal. However, I prefer the way Delphi and VB.NET handle casts.


The syntax? Or other? I dont like the way C# handles it simply
because you often have to add more () to tell it what to cast, and if
you dont it can cast something other than you might expect.


I agree it can be a pain sometimes, but I find that usually it's a good
indication that things can be made more readable by using a local
variable - the cast in one statement and the use in another.

It's one of those situations where I think there's no really good
solution - in some cases you *do* want to cast the result of a method
(eg (Foo) x.Something()) and sometimes you want to cast the "starting"
value. I dare say C#'s way isn't the best possible, but I still
personally prefer it to the VB.NET way.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #96
In article <MP************ ************@ms news.microsoft. com>, Jon Skeet [ C# MVP ] wrote:
Chad Z. Hower aka Kudzu <cp**@hower.org > wrote:
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in
news:eX******** ******@TK2MSFTN GP12.phx.gbl:
> I don't think that the approaches taken in C#, Delphi, and VB.NET are
> optimal. However, I prefer the way Delphi and VB.NET handle casts.


The syntax? Or other? I dont like the way C# handles it simply
because you often have to add more () to tell it what to cast, and if
you dont it can cast something other than you might expect.


I agree it can be a pain sometimes, but I find that usually it's a good
indication that things can be made more readable by using a local
variable - the cast in one statement and the use in another.

It's one of those situations where I think there's no really good
solution - in some cases you *do* want to cast the result of a method
(eg (Foo) x.Something()) and sometimes you want to cast the "starting"
value. I dare say C#'s way isn't the best possible, but I still
personally prefer it to the VB.NET way.


I so totally agree... VB.NET's way is very cumbersome, especially when
dealing with mutliple casts in the same expression. Besides, for a lot
of simple casts, C# does provide as.

The most confusing cases, IMHO, is when you do something like:

int y = ((Foo) x).CallSomeMeth od ();

--
Tom Shelton [MVP]
Nov 21 '05 #97
Tom Shelton <to*@YOUKNOWTHE DRILLmtogden.co m> wrote:
I so totally agree... VB.NET's way is very cumbersome, especially when
dealing with mutliple casts in the same expression. Besides, for a lot
of simple casts, C# does provide as.

The most confusing cases, IMHO, is when you do something like:

int y = ((Foo) x).CallSomeMeth od ();


Exactly - and those are the cases where I'd suggest breaking it up:

Foo whatever = (Foo)x;
int y = whatever.CallSo meMethod();

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #98

"Tom Shelton" <to*@YOUKNOWTHE DRILLmtogden.co m> wrote in message
news:eM******** ********@TK2MSF TNGP12.phx.gbl. ..
In article <MP************ ************@ms news.microsoft. com>, Jon Skeet
[ C# MVP ] wrote:
Chad Z. Hower aka Kudzu <cp**@hower.org > wrote:
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in
news:eX******** ******@TK2MSFTN GP12.phx.gbl:
> I don't think that the approaches taken in C#, Delphi, and VB.NET are
> optimal. However, I prefer the way Delphi and VB.NET handle casts.

The syntax? Or other? I dont like the way C# handles it simply
because you often have to add more () to tell it what to cast, and if
you dont it can cast something other than you might expect.


I agree it can be a pain sometimes, but I find that usually it's a good
indication that things can be made more readable by using a local
variable - the cast in one statement and the use in another.

It's one of those situations where I think there's no really good
solution - in some cases you *do* want to cast the result of a method
(eg (Foo) x.Something()) and sometimes you want to cast the "starting"
value. I dare say C#'s way isn't the best possible, but I still
personally prefer it to the VB.NET way.


I so totally agree... VB.NET's way is very cumbersome, especially when
dealing with mutliple casts in the same expression. Besides, for a lot
of simple casts, C# does provide as.

The most confusing cases, IMHO, is when you do something like:

int y = ((Foo) x).CallSomeMeth od ();


If this is confusing you might try the "clean" way:

...
Foo x = someFooRef as Foo;
int y = x.Dummy();
Willy.
Nov 21 '05 #99
Willy Denoyette [MVP] <wi************ *@telenet.be> wrote:
If this is confusing you might try the "clean" way:

..
Foo x = someFooRef as Foo;
int y = x.Dummy();


Or if you'd prefer to get a ClassCastExcept ion rather than a
NullReferenceEx ception (as I certainly would - it gives a much better
idea of what's actually happened):

Foo x = (Foo) someFooRef;
int y = x.Dummy();

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #100

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

106
5258
by: cfmortgagepro | last post by:
Hi, I know that I'm an extreme newb by asking this overly beaten question, but I am leaning toward C#, becuase the perception is that it is better to learn than VB.Net. I guess it makes you cooler.:-) Anyhow, I am a novice programmer, and I will remain one as well...I have no plans to make programming my life ambition, but I think that it would be fun to make my databases do some cool tricks and maybe write a simplistic client to...
0
9867
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9709
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9449
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7028
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5695
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4086
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3140
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.