Programming for Windows

I agree that VB was inferior to C and it always annoyed me that there were no pointers in VB but I learnt to live with it.

I like the grammatical style of VB.NET, I find it intuitive and would even go so far as to say I can think in VB.NET, If I want to do something I can dictate a "paragraph" that makes perfect grammatical sense but also perfect functional sense.

I am, however, odd as a bag of giblets.
 
Another little gripe I have with VB/VB.NET is all these bizarre, nonsensical keywords it uses; Shared, Friend, Me, etc. (as opposed to static, internal and this respectively in C#) :confused: Makes it sound like a language for children :p
 
Last edited:
What does static or internal mean?

Shared is when a function is shared
Friend is when a function can be used by "friends" ie functions in the same class or something.

Anyway, I rarely if ever use those keywords, they're a legacy compatibility thing non?
 
Well if its the same as C++ friend, it means that a friend function can modify a classes private data. Once a non-member function is declared as a friend, it can access the private data of the class similarly when a class is declared as a friend, the friend class can have access to the private data of the class which made this a friend. This is useful in sometimes for example when dealing with I/O streams.

Static members are used for example to keep track of a data that is related to the class as a whole, rarther than a particular instance of the class (object).
Static functions use no instance variables of any object of the class they are defined in.
 
Last edited:
Nope, they have nothing to do with legacy compatibility; they both see widespread use in the .NET framework. Shared/static particularly are important as OO concepts.

Friend/internal means that the type or member can only be accessed from within the current assembly (i.e. it's internal to the assembly).
Shared/static means that the type cannot be instantiated, or that the member is accessibly only through the type itself (i.e. it's static, in that it can't be instantiated or move around as an object).

I fail to understand why the VB designers chose those keywords, they make no sense :confused:
 
Una said:
Well if its the same as C++ friend, it means that a friend function can modify a classes private data. Once a non-member function is declared as a friend, it can access the private data of the class similarly when a class is declared as a friend, the friend class can have access to the private data of the class which made this a friend. This is useful in sometimes for example when dealing with I/O streams.

Static members are used for example to keep track of a data that is related to the class as a whole, rarther than a particular instance of the class (object).
Static functions use no instance variables of any object of the class they are defined in.
Friend seems to mean something else in VB.NET by the looks of it then. From MSDN:

Rules
  • Declaration Context. You can use Friend only at module, interface, or namespace level. This means the declaration context for a Friend element must be a source file, namespace, interface, module, class, or structure, and cannot be a procedure.
  • Combined Modifiers. You can use the Friend modifier in conjunction with the Protected (Visual Basic) modifier in the same declaration. This combination confers both friend and protected access on the declared elements, so they are accessible from anywhere in the same assembly, from their own class, and from derived classes. You can specify Protected Friend only on members of classes.

Behavior
  • Access Level. All code within a declaration context can access its elements. Code in other classes, structures, and modules that are compiled to the same assembly can access all the Friend elements in that assembly.
    Friend access is not a superset or subset of protected access.
  • Access Modifiers. The keywords that specify access level are called access modifiers. For a comparison of the access modifiers, see Access Levels in Visual Basic.

VB.NET apparently doesn't let you declare members as Friends, which is odd. What if you want a type to be accessible to other assemblies, but some of its members to be accessible only within the assembly? :confused:
 
Last edited:
I think that there was a place for VB when it was up against C and C++ for windows programming (and java / swing). The power of VB was that it was simple and easy to write an app without needing to understand pointers, inheritance and other concepts that were deemed complex and difficult. With the extensions to VB to make it VB.NET it's no longer the simple untyped language that it used to be, it's a horrible hack together of enough OO to make it .NET capable but not enough to make it a fully OO language.

As such imo there is no point wasting time learning VB.NET just learn C# no more dim var bob as myclass statements you just get myClass bob; I find the C# syntax MUCH easier to read. Of course if you are allready an experienced VB programmer you'll want to use VB.Net, if you're not that person just learn C#. C# skills mean that witha little bit of cross training you can now code in C++, C, Java and Pascal if they float your boat.

HT
 
VB.NET is just as up-to-date as C#, and the two teams are constantly bringing features into their languages which the other quickly decides to snatch. So, you'll find practically no difference between VB.NET and C# in what you can achieve with them.

However, C# syntax is structured in a more technical manner than what you'll get in VB.NET which to me feel quite verbose and certainly not as intuitive. (I suspect VB programmers it's C# that's hard to pick up! :) ).

C# is designed in a way that Java, and C++ programmers feel familiar with it and it has a lot of the common syntax you get in those object oriented languages.

Without looking at examples of code and starting to figure out what it's doing you won't really have a clue so I'd suggest doing that first.

Additionally, if you're unaware of this, the environment commonly used to work with .NET programming languages has something called Intellisense. So it guesses (it's actually really thick, but it does try its best) what you're about to type. Often starting a word and then using cursors to navigate alphabetically is a lot quicker than what you were having to type manually (and often remember properly). It makes you lazy as a programmer, but it increases the speed at which you write code by about 3,000,000,000,000 percent.

Anyway I think that's enough. Like I said, it's up to you.

(But if you don't use C# you might fall off a tall building some day.)
 
Inquisitor said:
Friend seems to mean something else in VB.NET by the looks of it then. From MSDN:



VB.NET apparently doesn't let you declare members as Friends, which is odd. What if you want a type to be accessible to other assemblies, but some of its members to be accessible only within the assembly? :confused:

Indeed it seems that way. I have never used VB so I won't make any comments about it. Everyone I seem to know hates it, so there is probably good reason :p

n3crius said:
Additionally, if you're unaware of this, the environment commonly used to work with .NET programming languages has something called Intellisense. So it guesses (it's actually really thick, but it does try its best) what you're about to type. Often starting a word and then using cursors to navigate alphabetically is a lot quicker than what you were having to type manually (and often remember properly). It makes you lazy as a programmer, but it increases the speed at which you write code by about 3,000,000,000,000 percent.

Thats just the IDE though, eclipse/emacs/anjuta/kdevelop etc can have forms of this as well. The thing I noticed about Visual C# EE, is that it pops up at quite pointless times like when writting void type, I don't really think it helps in that case.. but in general its pretty useful.
 
Last edited:
I must be getting old.

And here was me thinking that the last 20 years of my career developing christ knows how many solutions for companies around the world that I should choose a fashionable language with bells and whistles rather than give a solution that does the job what the customer is paying for, in a relatively quick turnaround and something that can be, generally, understood my non-techies because of it's english lexical look.

How much the industry has changed.
 
~J~ said:
I must be getting old.

And here was me thinking that the last 20 years of my career developing christ knows how many solutions for companies around the world that I should choose a fashionable language with bells and whistles rather than give a solution that does the job what the customer is paying for, in a relatively quick turnaround and something that can be, generally, understood my non-techies because of it's english lexical look.

How much the industry has changed.
Where does industry come into this? He wants to take up a language for the fun of it. If you're doing that, then it makes sense to choose a modern, feature rich language will the full backing of its developers, such as C# or Java.
 
Last edited:
~J~ said:
I must be getting old.

And here was me thinking that the last 20 years of my career developing christ knows how many solutions for companies around the world that I should choose a fashionable language with bells and whistles rather than give a solution that does the job what the customer is paying for, in a relatively quick turnaround and something that can be, generally, understood my non-techies because of it's english lexical look.

How much the industry has changed.

There is a big difference between coding for fun and coding for work. I write C++ for working, Java/Haskell for uni, and Python/asm/C for fun. I don't see why everyone has the obsession with learning languages for work. Programming for me is a fun thing and languages interest me, im not going to stop programming say functional languages because the industry hardly uses them. I have been coding on and off since I was about 14... long before I even considered working in the industry.

Sorry for the rant, this just narks me a bit :p
 
With .NET it really doesn't matter which language you use. Infact you can mix and match the languages as you see fit. So you could do all your business logic in VB.NET if you wished, and the more techie stuff in C#. That way it keeps the devs and semi-techie business managers happy. Anyone that's ever had a particularly inquisitive client will understand what I'm saying there.

VB.NET rocks. C# rocks. Simple as that really. Pre-VB.NET got a lot of flak because it was seen as an amateur's language. No need to joke or fuss about it, it was exactly that. It's a bit like taking the mick out of a pencil because in some ways it's not as good as a pen - but then a pen isn't as good as a pencil for some jobs... different job, different tool.

VB.NET is just a syntax for which you can write .NET software, and therefore it should in no way inherit the same flak that previous VB versions did. Microsoft does provide a few compatibility classes for those retro VB'ers that just won't let go of their quick-fire methods though.
 
Just to let you know if you are new to all this, the IDE support for vb.net is far better than c#, I use both languages and the IDE in vb.net mode is far more helpful to the new developer. What's important at the beginning is learning the framework, once you understand that and OO, picking the language is child's play.
 
Una said:
Indeed it seems that way. I have never used VB so I won't make any comments about it. Everyone I seem to know hates it, so there is probably good reason :p



Thats just the IDE though, eclipse/emacs/anjuta/kdevelop etc can have forms of this as well. The thing I noticed about Visual C# EE, is that it pops up at quite pointless times like when writting void type, I don't really think it helps in that case.. but in general its pretty useful.

Yes, it's not restricted to visual studio. And I'd imagine more interfaces generally will gain this feature in computing.

It is a pain sometimes. Sometimes I wish it didn't exist. But overall it makes my life so much easier.
 
~J~ said:
I must be getting old.

And here was me thinking that the last 20 years of my career developing christ knows how many solutions for companies around the world that I should choose a fashionable language with bells and whistles rather than give a solution that does the job what the customer is paying for, in a relatively quick turnaround and something that can be, generally, understood my non-techies because of it's english lexical look.

How much the industry has changed.

What exactly is it your trying to make a point about?
 
n3crius said:
Yes, it's not restricted to visual studio. And I'd imagine more interfaces generally will gain this feature in computing.

It is a pain sometimes. Sometimes I wish it didn't exist. But overall it makes my life so much easier.
One thing that's very useful about VS2005 is the code snippets feature. Say you want to type out a foreach or using block, you'd just type out that word, press tab, and the whole thing is done for you, with the relevant bits highlighted so you can just type in the variables you want to use, then press enter to start typing the content of the block :)
 
Inquisitor said:
One thing that's very useful about VS2005 is the code snippets feature. Say you want to type out a foreach or using block, you'd just type out that word, press tab, and the whole thing is done for you, with the relevant bits highlighted so you can just type in the variables you want to use, then press enter to start typing the content of the block :)

yeah. writing properties and loops suddenly becomes sooo addictive. :)
 
Back
Top Bottom