• Welcome to Valhalla Legends Archive.
 

Learning C++ Over VB

Started by Rock, March 04, 2004, 09:10 AM

Previous topic - Next topic

Rock

I started learning VB a while ago and I heard in many forums how learning VB is worthless and C++ is ten times better. That's why I figure imma probably take a beginner C++ class in some college and then take the advanced C++ classes. Hopefully the ppl here know what they're talking bout.

Mephisto

That's true depending on what you plan to do with programming, both as to what you want to make, and if you plan to take programming to a career level.

As for programming "stuff" you can keep some of these things in mind.
These is for Visual Basic +'s
- fast GUI application development
- overall faster to develop an application, and easier
- good for development where you need a good functioning application in a day or two which is user friendly

These are +'s for C/C++:
- flexibility
- more APIs to work with (e.g. winsock, win32 api, etc.)
- generally faster and more efficient executables
- full support of object oriented programming and use of pointers
- top software/game development language (this may not be completely accurate)
- people are constantly writing new libraries for C++ to make it easier for you (this may be true for VB)
- supported on different platforms providing you recompile the source code for that platform (you can't compile on windows and use on linux, you would have to compile on linux and then use it on linux)
- blunt, but more than likely true:  best language to learn for multi-purpose use

I hope that helps you decide on that subject, and as for taking it to the career level:
There are simply too many VB6 programmers out there looking for jobs.  Wages are starting to go down for them, and there is now little demand for them because they are so plentiful right now.  So with this information alone, you can pretty much bet that VB6 isn't going to be the language to learn for a career path.  However, you may consider VB.Net, and if you can program how .Net was intended for people to program, you can certainly bag yourself a job.
Good, expert and experienced C++ programmers are always what companies want to have, so if you can acquire these skills, and have knowledge of things like Visual C++, C#, Visual C++.Net, etc. you will definetly have a high paying job.

Anyways, I hope this helps.  Some of this information may not be completely accurate, but for the most part it's just factual.

Kp

Some corrections:

Quote from: Mephisto on March 04, 2004, 09:28 AM
As for programming "stuff" you can keep some of these things in mind.
These is for Visual Basic +'s
- fast GUI application development
- overall faster to develop an application, and easier
- good for development where you need a good functioning application in a day or two which is user friendly

These are +'s for C/C++:
- flexibility
- more APIs to work with (e.g. winsock, win32 api, etc.)
- generally faster and more efficient executables
- full support of object oriented programming and use of pointers
- top software/game development language (this may not be completely accurate)
- people are constantly writing new libraries for C++ to make it easier for you (this may be true for VB)
- supported on different platforms providing you recompile the source code for that platform (you can't compile on windows and use on linux, you would have to compile on linux and then use it on linux)
- blunt, but more than likely true:  best language to learn for multi-purpose use

VB can call most Windows functions, if you prototype them yourself (though you really should be able to just #include an appropriate header, as you can in C!).  VB applications tend to run slower, build to be bigger, and require certain runtime files that are not installed on all computers by default.

The usability of a given library for VB depends on whether it was compiled to use _stdcall or not (you'll learn this term once you deal with C/C++ for a while).  For reasons I've never encountered, VB does not support calling things which do not use this horribly inferior calling convention.  C code can call _fastcall, _stdcall, or _cdecl functions with no particular effort beyond marking the calling convenion of the function in its prototype.

Regarding portability: although it is correct that you can compile C code on non-Win32 platforms in theory, most applications oriented towards performance will make substantial use of platform-specific calls.  You just can't get top performance on Windows using the Microsoft implementation of the CRT; you'll have to use Windows API calls directly.  However, doing so makes the application Windows-specific.  Conversely, there are certain features of libc that Microsoft completely failed to implement (afaik), such as the ability to select(2) on non-socket file descriptors.  Unix code which depends upon this (or upon the mostly-standard-except-for-Microsoft behavior that select(2) can be used for subsecond sleeps) will fail when moved to Windows.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Adron

Quote from: Kp on March 04, 2004, 02:41 PM
VB applications tend to run slower, build to be bigger, and require certain runtime files that are not installed on all computers by default.

Note: C++ applications typicall require certain runtime files that are also not installed on all computers by default. You can reconfigure your project settings to link C++ applications statically, but it's not the default, and it mostly makes them very much larger.

Kp

Really?  Which DLL(s)?  Aside from some problems running things Skywing built to VS7, I've never had a C-based program fail on me for lack of DLLs (nor have I ever heard of such occuring, aside from this thread).
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

iago

What kp said is completely right.  Another thing you should think about is Java, though:

*cons*
-It builds to larger files which run slower
-Some features are missing

*pros*
- Code ends up A LOT cleaner (compared to using the STL)
- TONS of built-in functionality
- Complete cross-platform (dont' have to recompile for different platforms)
- Full (superior) use of object oriented programming, and automatic pointers (all objects are pointers).
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Adron

Quote from: Kp on March 04, 2004, 06:18 PM
Really?  Which DLL(s)?  Aside from some problems running things Skywing built to VS7, I've never had a C-based program fail on me for lack of DLLs (nor have I ever heard of such occuring, aside from this thread).

I don't remember exactly now, but I'm pretty sure msvcrt40.dll (run-time for msvc4) wasn't in all the old Windows versions, perhaps not in win95 original. The std c++ libraries for msvc5 definitely wasn't in whatever OS I used back then, which might've been NT4. And they obviously won't have the vs7 run-time libraries either.

Mephisto

#7
Quote from: iago on March 04, 2004, 06:46 PM
What kp said is completely right.  Another thing you should think about is Java, though:

*cons*
-It builds to larger files which run slower
-Some features are missing

*pros*
- Code ends up A LOT cleaner (compared to using the STL)
- TONS of built-in functionality
- Complete cross-platform (dont' have to recompile for different platforms)
- Full (superior) use of object oriented programming, and automatic pointers (all objects are pointers).

Java doesn't support pointers much more than VB does, at least from the research I have done.  Java uses reference arithmetic when dealing with such things like arrays, as where C++ uses pointer arithmetic.  Additionally, I believe Java is interpreted, causing for slower performance of the program, correct?  I'm not too sure if you can comepile a program in Java on Windows and then run that same program in Linux.  Also, I wouldn't really call Java superior in object oriented programming.  It doesn't even support multiple inheritence, or operator overloading (not necessarily an OOP concept).

Banana fanna fo fanna

Quote
Java doesn't support pointers much more than VB does, at least from the research I have done.
True
Quote
Java uses reference arithmetic when dealing with such things like arrays, as where C++ uses pointer arithmetic.
Dunno.
Quote
Additionally, I believe Java is interpreted, causing for slower performance of the program, correct?
Bytecode with a JIT, and it's pretty fast these days.
Quote
I'm not too sure if you can comepile a program in Java on Windows and then run that same program in Linux.
Um...duh?
Quote
Also, I wouldn't really call Java superior in object oriented programming.  It doesn't even support multiple inheritence, or operator overloading (not necessarily an OOP concept).
I think java is far superior than C++. C++ had to deal with backwards compatibility to C, while Java didn't. Thus, I like Java's take on OOP much better. The lack of operator overloading sucks (some would call it "clean"). I don't really miss multiple inheritance, since you can implement multiple interfaces.

Mephisto

#9
I've never had any problems with C++'s object oriented approach.  Additionally, those of my friends who have programmed in Java havn't really been able to do anything with object oriented concepts in Java that couldn't be done in C++ just as well.

iago

Quote from: Mephisto on March 04, 2004, 09:17 PM
I've never had any problems with C++'s object oriented approach.  Additionally, those of my friends who have programmed in Java havn't really been able to do anything with object oriented concepts in Java that couldn't be done in C++ just as well.

One major thing that makes Java's better: Object.  Having an all-encompassing superclass is the best idea I've ever seen.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Mephisto

#11
Still...What advantages does that provide over C++ in the respect that you may beable to do more in Java with its OOP approach than in C++?

Edit: Maybe this should become a C++ vs Java forum?

Adron

Quote from: iago on March 05, 2004, 06:42 AM
One major thing that makes Java's better: Object.  Having an all-encompassing superclass is the best idea I've ever seen.

Why is this so good? It doesn't seem like such a good idea to me.

iago

It means that you have a generic superclass that you can use for, for instance, a Vector.  

So a Vector object can take a list of Objects, which can be *any class*, and store them all the same way.  And if you know which class they come from, you can cast it back.

A default Vector can also be displayed because Object implements toString().  So if you have a Vector of, say, users, you can easiy display all the users in the list with a call to "Vector.toString()".  

Take a program that uses Templates, and a program that uses Objects (they, in effect, do the same thing).  See which one is cleaner, more understandable, and just plain prettier :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Adron

Quote from: iago on March 05, 2004, 11:28 AM
So a Vector object can take a list of Objects, which can be *any class*, and store them all the same way.  And if you know which class they come from, you can cast it back.

That doesn't make sense though. When would you ever want to have a list of items of random types? I can't think of a reason you would.

I can think of plenty good reasons to produce a list of objects that have something in common, but then you'd design your class hierarchy so that they have a common base class abstracting the common functionality.

It sounds like it might be useful for quick hacks, but not for programming if you have a design you're following. A bit like having a list of void* in C++, allowing you to store anything you like, but you still have to cast it back to the right type for it to be useful.

Storing every single variable as an object (kind of like how VB does with variants?), would presumably need at least a vtable pointer for each object, and seems like it would cost a *lot* of memory.