The Artima Developer Community
Sponsored Link •

C# Answers Forum
is VB.NET a TRUE object oriented language ?

3 replies on 1 page. Most recent reply: Jun 3, 2004 1:33 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
ghostWolf

Posts: 1
Nickname: ghostwolf
Registered: May, 2004

is VB.NET a TRUE object oriented language ? Posted: May 26, 2004 10:28 PM
Reply to this message Reply
Advertisement
I am currently having an argument with a work college about VB.NET and wether this version of VB should/can be classified as a true object oriented language or not.
It seem to be a general missconception that it is and I would argue that it is'nt.
Microsoft themself is descriping it as "having more object oriented features than before" - that to me does not make it an object oriented language but since I havent managed to find any articles on this subject I would like to know what the general view of VB.NET is when it comes to defining it as a object oriented language.

I would also like to get peoples for and against view on mixing languages (C++.NET, C# and VB.NET) in the .NET architecture.
Can you do anything with VB.NET or is this language restricted in ways which would argue for using C++.NET and/or C#?

/ghostWolf


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: is VB.NET a TRUE object oriented language ? Posted: May 28, 2004 10:50 AM
Reply to this message Reply
First, I don't think there is a definition of a "true object oriented language." Even Java and C++, the languages which probably account for the vast majority of "object oriented" programmers are often derided by Smalltalkers (and others who think thier favorite language is more truly object-oriented) as not being "truly" OOP.

Second, why does it matter? What does it mean? You can write purely procedural code in an "object-oriented" language just as you can write object-oriented code in a "procedural" language. Using the right language for the given style can just make the task a lot easier and more pleasant.

I think the .NET platform and the CLR are largely object-oriented and any language you plop onto it (them?) will have a lot of object-orientedness feel to it.

I personally prefer C# to VB.NET, but if I were collaborating with someone who wanted to use VB on a project (it would have to be a .NET project, of course), that would be fine. Especially if you have a very component-based design, it works just fine to have different components in different languages. However, I wouldn't want to have VB and C# (and/or others) modules mixed together willy-nilly. On my current project, I use mostly C# with some C++ (for building some COM components used by the C# code) and Python for build automation, code generation and other project-related tasks. I even have a little VB (or is it VB script? Or VBA? Hard to tell...) in the form of Visual Studio macros (sometimes it just calls a Python script that does some code generation, or other task). I would prefer to do those VS scripts in Python, or even C# over VBScript, but I can tolerate a little VB here and there.

I don't think there are any restrictions in what you can do with VB vs. C# in .NET. In fact, if there were restrictions, knowing Microsoft, VB would be the one with fewer (I say this based on the way that VBScript and JavaScript compare: VBScript is able to do lots of things that are either impossible or much more clunky in JavaScript; perhaps Microsoft did it that way in order to try and push VBScript over JavaScript). There are definitely differences in the way you do things between the languages. I think the choice between C# and VB.NET comes down to what you already know, what are are comfortable with and what you like in a language.

Joe Cheng

Posts: 65
Nickname: jcheng
Registered: Oct, 2002

Re: is VB.NET a TRUE object oriented language ? Posted: Jun 2, 2004 11:06 PM
Reply to this message Reply
I would call VB.NET a true object oriented language, by most mainstream programmers' standards.

It uses the traditional class/object model, offers subtyping and (single) implementation inheritance, polymorphic method dispatch, method- and field-level access controls... pretty much what you find in Java and C#.

In fact, if you consider C# an OO language then I think you pretty much have to consider VB.NET an OO language as well. Sorry if that disappoints you.

As Matt points out, it's a pretty academic debate, when everyone has their own version of what a "true OO" language is anyway--or whether that's even a worthy goal. Bjarne Stroustrup, creator of C++, often derides Java for being "too OO" in its design. Python and Ruby consider the ability to write procedural code (in addition to classes) to be a feature. Lispers think of any OO language as inherently less powerful than Lisp.

Currently there are very few differences between C# and VB.NET in terms of things you can do in one but not the other. VB.NET is missing a few primitive data types that you weren't going to use anyway, and it doesn't have bit shift operators. I also think it doesn't let you override operators. On the other hand, you can write somewhat more dynamic code in VB.NET, since it allows you to use late binding, i.e. method calls that are not resolved at compile time (which you'd almost never want to do, if you ask me).

C# also has an "unsafe" mode that VB.NET lacks, that lets you work with pointers. I think this is probably less useful than it sounds; our (C#) codebase has a ton of platform and COM interop and we never use unsafe.

More data available here: http://support.microsoft.com/?kbid=308470

The differences will increase a little bit with the Whidbey release; VB.NET will get "Edit and Continue" support in Visual Studio (i.e. change code on the fly during a debugging run), and C# will get at least one unique language feature (closures, a.k.a. anonymous methods).

Visual C++.NET is a different beast altogether. From what I understand, it is basically halfway between C++ and C#. If you need to do very heavy interop with C/C++ libraries, there is stuff you can do very naturally in VC++.NET that you can only do very painfully (or not at all) in VC#.NET or especially VB.NET. But if you have to ask if you need VC++.NET, you almost certainly don't.

I think it is a bad idea to mix VB.NET and C# in the same codebase. In general I think you should just pick C# unless most of your people are VB6-heads who don't want to learn C#, in which case you should maybe just pick VB.NET. I find it hard to imagine a realistic scenario where the same development organization could justify supporting two languages when one would perfectly suffice, and if you have to pick between two languages with equally mature compilers and the same runtime libraries, why wouldn't you pick the one with less syntactic baggage?

Plus, VB.NET code just looks gross. ;)

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: is VB.NET a TRUE object oriented language ? Posted: Jun 3, 2004 1:33 PM
Reply to this message Reply
> Visual C++.NET is a different beast altogether. From what
> I understand, it is basically halfway between C++ and C#.
> If you need to do very heavy interop with C/C++ libraries,
> there is stuff you can do very naturally in VC++.NET that
> you can only do very painfully (or not at all) in VC#.NET
> or especially VB.NET. But if you have to ask if you need
> VC++.NET, you almost certainly don't.

I fooled around with C++.NET and found it to be confusing in that it looks like C++, isn't the real thing, especially when it comes to linking to libraries. I couldn't see much sense in using it over C# for .NET work. I found it much simpler and cleaner to do all my .NET code in C# and create COM Automation libraries for those things which could only be done in C++. Those libraries are a snap to access from the C# and you get the side benefit that those facilities can also be easily used by Python, JScript, VB/VBScript/VB.NET and any other language that can use COM Automation.

> Plus, VB.NET code just looks gross. ;)

Aye! Now that's the salient point!

I would say Lisp has a similar problem; after looking at it, I thought it should be called "paretheses-overuse-oriented programming" or something like that. It may hava nice features and desing philosophy, but it sure has icky syntax.

Flat View: This topic has 3 replies on 1 page
Topic: VB.NET to C# translation Previous Topic   Next Topic Topic: dealing with bluetooth by c#

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use