|
-
November 25th, 2002, 02:35 PM
#1
Advantages of C++?
What are the advantages to using C++, as opposed to using something like Visual Basic or Java? I'm interested in learning what it is that makes C++ a good choice for a programming language. Any posts at all would be appreciated, thank you for your help.
'Grat is not nice, indeed!
-
November 25th, 2002, 03:28 PM
#2
templates -- generic programming is very powerful and useful, something completely lacking in VB or Java.
More control -- C++ gives you more control, which is both a blessing and a curse, depending on the developer.
Execution speed.
STL.
Jeff
-
November 25th, 2002, 05:13 PM
#3
E.g., C++ is not linked at runtime, like Java or VB, but already at compile-time.
And it's not as abstract as other Languages, so the Compiler can make more effective (faster) code.
Mikey
-
November 26th, 2002, 03:25 AM
#4
-
November 26th, 2002, 04:26 AM
#5
Advantages of C++
The basic advantage of C++ is speed. Add to that additional control over what happens - but in reality that still comes down to performance - ie you can maximise speed and minimise memory footprint. If you compare C++ to Java directly you find that the languages are very similar. There are really only 2 key differences (pretty much every other differences relates back to these differences). The first is that Java is pure OO - ie every single thing you write derives from another class. This gets rid of some of the ugly things in C++ like multiple inheritance. The second thing is that Java garbage collects. That means that you will never get a memory leak in Java. The disadvantage of that is that Java has to add a load of reference counting code to every class you write which weighs them down, slows down you code and increases the memory footprint. Also, if you program well, you should be able to control the lifecycle of objects more efficiently that a simple reference counting system - again reduced memory footprint.
If you look at things from the other direction the (supposed) key advantage of using Java is portability - but this is (IMHO) a myth. The hassles getting Java to work on multiple platforms is a nightmare - you may as well write portable C++ code. Really the main advantages are:
(1) Garbage collection - sorry for the contradiction but Garbage collection makes for easier coding (albeit slower) - you don't need to think about objects, references and pointers like you do in C++.
(2) EJB etc. There are a lot of libraries for quickly generating specific code like applets, EJBs, etc.
If you want any more specific information let me know - I can also talk you through a similar comparison with VB - although the main thing with VB is that it is as slow as treacle!
Dave
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|