Advertisement

Visual Basic Vs. C++

Started by November 16, 2000 11:21 AM
51 comments, last by CHollman82 24 years, 1 month ago
I''ve recently been forced at gunpoint (okay, exagerration, but that''s what it feels like) to learn Visual Basic because I have to take a programming course to get a credit to go to university to etc. Most of my programming expereince having been in C++ (DOS and Win, with and without DirectX) and web programming (PHP, mySQL, and of course, good ol HTML and java-script ). I have also expereience with other langauges, but this is the stuff that i have stuck with. Anyway, needless to say, I was very displeased. When i entered this course i thought, well hell, okay, a free class to do hwk in, since i know everything in there anyway. Well, i was partially wrong, this has proven to be by far the most demanding class (although this might be just because i genuinely care about this course mark and wish to do my best), and it has given me new perspectives on stuff. Having said that, VB still sux

Okay, first of all, I better go on to elaborate on why VB sux, or I will not be presenting much of an intelligent post, and probably collecting a basketful of flames from VB devotees. The concept of VB is great, but the implementation is poor. In fact (and plz correct if im wrong, even though this fact isnt really all that relevent, and maybe not fact at all) I think it was Borland with their Delphi that first invented that concept of plopping components onto forms. This is a great idea, and for business applications, it makes sense. MS, despite being a billion dollar corporation with more power than the governments of many countries, have created a product far inferior to Delphi. Let''s list a few quick major reasons why Delphi is better, and if you haven''t tried this language, give it a few months of serious learning before you disagree, and be prepared to humble urself

Language
--------

Borland chose to base their language on Pascal, a language that, while not quite as good as C++ IMO, is sufficiently versatile, neat, and best of all, still not too difficult to learn. MS chose BASIC. Of all the languages in the world, they chose the one that would give them the most trouble. It is not a powerful language, MS had to extend it quite a bit in VB, and programming in it requires far too much typing. The language has far too many oddities, and Visual Basic continues this tradition with even more catches such as "you can''t have an array of withevent objects" and "variables of types with dynamically allocated arrays or variable length strings cant be public". It adds up to an awkward language that requires a lot of awkward solutions. In comparison, Delphi does things relatively neatly.

Components
----------

Components in Visual Basic are few and poorly featured. VB starts up with a tiny library of only the most basic of Windows controls, and these controls are not implemented as well as their Delphi counterparts. If you wish to add more components, you must go through the process of right clicking, selecting the components thingy, and finding ur component from a list of sometimes cryptic names. And even then, that list is not nearly as big as the rich library of components which Borland have thougtfully included with Delphi. The Delphi IDE is friendly and powerful, and the creation of a form is a pleasure in itself. The VB IDE, while not that horrible either, once again falls short of Delphi, with a few awkward interface "bugs" and clunky project/properties windows. Learning how to use the blasted thing effectively needs a book in itself.

Okay, I''m typing too much and I still have a lot of work in *ick* VB to do for school. The above two heading encompass a lot. If your a VB programmer, go and try Delphi, you might like it!


As far as the C++ vs VB debate goes, it is pointless. C++ is good at what it is used for (games, scientific stuff, etc) while VB does what it is meant for lucklusterly and in the typical Microsoft spirit of "good enuff, but not great, but also severly bloated"

And in response to what can C++ do that VB can''t? Okay, pointers were mentioned as was bitshift. Those two are critical, so lets explore them first:

bitshift: the VB programmer says "but you can use multiplication". The C++ programmer says "but we are using bitshift to avoid multiplication!". Multiplication and division are horrible speed suckers, taking many many many times more cpu cycles than a humble bitshift. When you are in ur main game loop, every cycle counts, and since game calculations (and other speed critical programs) often require much multiplying, the bitshift is a huge performance increase. I was forced to pre-multiply all my coordinate calculations and put them in an array in my Tetris game in VB, because of no bitshifting (performance with multiplication was dismal). The fact that bitshifting is a standard CPU instruction since men (and women) starting walking on two legs, this is a real insult towards VB.

Pointers: Okay, get a book on pointers, they are one of the single most powerful constructs, and their implementation in C and C++ plays a large role in the language''s huge acceptance. From dynamically allocated memory to complex data structures and alogorithms, pointers are incredibly powerful and fast.

Okay, now here are some of the C++ features that I have been crying for since forced into the world of VB:

Assembly! Why the hell not? Near as I can tell, (and i researched this a lot), there is no way to insert assembly directly into ur vb code the same way you can in C++ with Asm (correct me if im wrong once again, but u vb programmers, if u have such knowledge, have never revealed it to me before). This just hurts, because sometimes, (and quite often in a language like VB) u just need assembly.

Proper OOP: I must admit VB6 objects aren''t that bad, but they aren''t as good as C++. The thing is C++ objects work, but whenever i try to use a VB object concept, such as adding events, i get hit in the face with a lot of errors that shows typical MS programming. For example (yes, this is a big pain in the neck), withevents objects cant be arrays! This is ridiculous, espeically since u can have control arrays. This sort of half-done coding that results in all these weird catches is really annoying.

Disclaimer:
Obviously im not an expert VB programmer, so some of the things i may have said are not entirely true, but whenever u have to correct me, that is a slam against VB documentation and the VB community because i have honestly and earnestly researched the points i brought up, since they have personally caused me trouble in my projects. Sorry if I sound a bit negative, or pompus, or whatever, i don''t mean to come off that way, but this is a subject i feel strongly about and im willing to argue it to wit''s end.
BetaShare - Run Your Beta Right!
quote: Original post by Machaira
I have yet to find something I couldn''t write using VB. If someone can show me something (other than the aforementioned Unreal2 or similar) I''ll retract that, but I doubt I''ll have to.


How about porting to other platforms? MacOS? BeOs? Palm Pilots? etc?

C++ allows a programmer to create programs that can be ported to a lot of non-Windows platforms. There''s even a version of GCC for TI-89 calculators!

I''d like to see that done with Visual Basic.



"Science is a tool. If the tool works, we use it. If it''s true, that''s great, but if it isn''t, it doesn''t matter" -- ("Desert Fox" from GameDev.net)''s physics teacher
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away"--Henry David Thoreau
Advertisement
Lord Electro is an idiot. He sent me to this to read his message. It''s too bloody long.

Hey Matt, do your homework, and Sirega *MIGHT* not kill you.

"Your honour is your life: Let none dispute it"
-Black Templar creed
"Your honour is your life: Let none dispute it"-Black Templar creed
VB''s strengthens are it''s weaknesses. Depending on what you are doing it can be a godsend or a nightmare. If you are wanting to write a 3D engine that puts Unreal to shame then it is a nightmare. If you want to throw together a quick program for tracking the football pool you are running it is a godsend. You can either make it relatively easy to write relatively easy programs or you can make it relatively easy to write relatively complex programs. A strength in one is a weakness in the other. Saying C++ or Visual Basic is better is taking a narrow view of limited circumstances. The reality is that C++ Builder beats both Oops, I mean it is like saying a car is better than a truck.
Keys to success: Ability, ambition and opportunity.
Following on from *2* posters....
all I can say is...
GET BCB / DELPHI!
It provides both VB features and C++ features. Fast window creation, properties, etc. and fast code (real C/C++ power). So I get the best of both worlds. And about platform migration.... you can compile BCB / Delphi apps w/o any changes, or very minor changes, to run under Linux, also the *BSD variants, etc.
And all that about VB being powerful w/ databases? Thats not true, all it is saying is SQL is powerful. All you do is connect to the damm database, run a query, and get the results. PHP (a server side parsing script language) can do it, so can Java and everything else in the damn world.

EDIT
Make that 3 posters... all these VB/C++ threads pull all the BCB / Delphi ppl out of the cracks, so to speak...

------------------------------
BCB DX Library - RAD C++ Game development for BCB

Edited by - c++freak on November 20, 2000 11:52:42 PM
quote:
You are wrong. There are a few ways to do pointers in VB. And a plenthora of other things that elitists, crap for brians (I won''t call them C/C++ programmers since I also used it), programmers not worth a damn, don''t know about or how to do cross-language.

What would you do? Store the pointer & use it ByVal as Long. Now what? How do you derefernce it? Make function calls to existing frameworks, fine for Win32/Dx/etc... What if you wanted to make your own framework?
Or better yet, make a struct & do it ByRef to a api call. Then all hell breaks loose becuase VB doesn''t pad the same way... twidlle fill with bytes? And what if the struct contained pointers? ...ok suppose we cleared up all those problems and have our VB reference all hunky dory, now its time to delete... IF you knew enough about C & VB you could do all this. But you''d need to know C first! This is not an efficent way to use our time, or the programs.

quote:
This boils down to the mere fact that those who complain about a language are not and will never be true programmers. Programmers don''t care if they have to punch cards by hand to make all those 1''s and 0''s appear, feeding them slowly into a 10 foot by 10 foot tin box, only to add 2+2. The point is the zen of programming.

no vb leaves a lot to be desired. and shoe boxes full of punch cards mustov really sucked. VB seemed really cool to me for about two months. I wrote a simple program using VB5 to read in cached CDDB files (text), and create .m3u playlist (also text). Its performance was ridiculous poor. When I clicked on stuff I had to wait for drop-down boxes to appear! It was just generally too lethargic to be taken seriously. Supposely its no longer so bad with VB6 & 1GHz machines.

quote:
Only cry babies not worth spit, bitch about C++ being better than VB being better than Qbasic, being better than.... ad nausea.

no, cry babies cry that vb is good enoough. C++ is just a little bit better than most languages. It has dual high abstraction & low level nature, making it possible to do whatever you want. Learning how to write C++ code takes longer than VB, but experienced people creating programs with C++ are faster than experience people creating VB programs. So learn VB first, but don''t stop there.

quote:
For all their pain I suggest they go and learn about some of the really powerful languages, Haskell, LISP, ProLog... now there is a damn good language. But better than VB? Who cares. I can still control what I need to control when I need to control it with whatever damn toolset I am given.

I wouldn''t call LISP or ProLog powerful. Usefully, but not powerful.

quote:
You think because C/C++ has become a standard in College for the last ten years it is the de facto?

Actually Pascal was invented because C & C++ was preceived to be too difficult to teach to dumb freshmen. And if the whole business world still used COBOL, and you knew about VB, wouldn''t you want them to switch?

quote:
Get a grip. I challange anyone to come up with some problem that they think can not be solved in VB and C++, side by side. I would bet dollars to donuts, upon my 15 years worth of programming experience, anyone programmer worth a damn can do it in both languages just as easily.

OOD is impossible in VB because there is no Inheritance; I suppose you could come with some sort adhoc method, but that exact what OOD is made to avoid.
RT DSP, you''re on acid if you think you could create any kind of signal processing algorithm in VB.
And if you create or use a .dll made using someother language, then you''re not really using VB then are you?
And even the front ends, that VB is so "great" for and just sluggish. Compare an MFC app to a VB one, the MFC application responds to your command, VB gets around to it.

quote:
Complainers need to get over it. This is a community site, get with the community, enough bullshit bickering about who''s got a bigger dick around here. No one cares. They ask questions to have answers, not pissing contests.

I concur, maybe we should both take your advice.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Advertisement
quote:
I was forced to pre-multiply all my coordinate calculations and put them in an array in my Tetris game in VB, because of no bitshifting (performance with multiplication was dismal).


If you had problems getting tetris running up to speed, then I think that perhaps you don''t know the language, on the other hand maybe I don''t know what I''m talking about or maybe this was just a figure of speech.

Anyway, I suppose its time for me to investigate delphi (and perhaps teach myself some more C++), does anyone happen to know of a free Delphi compiler (being a high school student, I''m stapped for cash, and no warez thanks) so I can mess around, or is it a proprietory sorta thing? I suppose I should do some research before I go asking all these questions, so perhaps I will be back somewhere else later.

(Don''t argue with this {I don''t wan''t to start a flame war} just take it as a fact: using object references among other tools, I can make dynamic structures and allocate memory with them.)


As for assembly, I don''t think it is possible yet, although perhaps there is a way to pull the same trick that people used in QBasic (Use Peek/Poke to get the assembly into memory and run it from there) but I''m pretty sure you can''t do it (or at least I can''t do it)

Off to find some delphi =)

Trying is the first step towards failure.
Trying is the first step towards failure.
quote: Original post by Machaira
I read that a version of UnrealEd was written in VB. Hmm, something to think about there.

Yes... I''m thinking about that right now. It''s gotta be the slowest piece of software I''ve seen. Even 3dstudio MAX is faster.
quote:
As for speed differences - VB is slightly slower in some areas, slightly faster in others.

And where would VB code be faster? Have you ever looked at a disassembly of a VB program? If someone wants to, I could post a couple of disassemblies of the same algorithms in C and VB for you to look at, and the only conclusion one can come to, is that VB code under no circumstances can be faster!
If you do know of such occasions, where VB will be faster, please let me know, and I''ll test it.
quote:
Don''t try to tell me otherwise unless you''ve done the testing yourself, you''ll just make yourself look more stupid than you obviously already are.

Uh-huh. There''s an easy way to prevent people from arguing against you, when you didn''t even bother to give any examples of when VB code would be faster.

quote:
Development time - VC++ (or probably any other compiler) can''t stand up to the ease and speed of developing a Windows app in VB.

There are these two little thingies from Borland. One is called Delphi, the other is called C++ Builder. Both of these can be used for creating apps at a rate that will make VB blush... Since they actually produce rather fast code too.
quote:
Again, don''t try to tell me otherwise - I''ve done both. Need a new window? Just a double click away, no code needed. Try that in VC++.

Uh-huh. Try that in BCB. Simple, huh? No runtime DLL needed.
quote:
I have yet to find something I couldn''t write using VB. If someone can show me something (other than the aforementioned Unreal2 or similar) I''ll retract that, but I doubt I''ll have to.

Well, how about simply doing a simple multithreaded app in VB 6? Piece of cake, huh? No?
quote:
What''s this boil down to - I love VB and C++ (although MFC is irritating me a little right now :>) and will use whatever gets the job done the best.

RAD: BCB | Delphi
Generic non-RAD programming: VC++
Belandrew: You can dynamically allocate memory in VB using dynamic arrays embedded in a custom data type (Dim, ReDim, Erase). This is extremely easy to do and requires a pittance of extra code.

CHollman: Here are your ten reasons:

1. Rapid Application Development
2. No hand-typed code necessary to construct a window
3. Easy access to ActiveX objects
4. Resource repository is generally much smaller
5. Fill-As-You-Go and dropdown lists
6. Now fully supported by DirectX!
7. Supports 99.9 percent of C++ features
8. New features in VB6 are completely bad-ass
9. Immediate compilation and execution with a single keypress
10. Compiles to native code for speed

Of course, I've got my arguments for C++ as well. Like all intelligent people, I don't think VB is better than C++, so your original request was silly. However, it has its uses, and it never hurts to learn a new language, particularly one so useful.

The single greatest drawback to VB: Windows only.

Edited by - Tom on November 21, 2000 9:17:52 AM

GDNet+. It's only $5 a month. You know you want it.

Punchcards forever!!.. nah

Honestly I have used VB for years and yes for a begginer its easier than learning C, C++, then win32..... but its far to limiting for me... I mean you din''t get as much control as in c++ but then again you can do a lot of things that C++ can do but I have moved on from VB as I hope to get a ob in the industry and don''t want to get laughed at.

perception -> Consciousness -> life

This topic is closed to new replies.

Advertisement