JAVA is slow because it is an interpreted language. That is, it reads source code and decides what to do on-the-fly. Therefore, it is slow, just like other interpreted languages. However, it is almost universal. Essentially, you can make one program, and it will work on other computers which support Java. Phones and other portable devices which can read web stuff can also be supported with little or no modification. The language itself is easier to understand because it does some extra little things that other programmers must do with some other languages. Visual Basic is something like Java. It is an interpreted language, easy to learn because it hides some things from the programmer, but it isn't as 'universal' as Java because Java is a web-oriented language. One important thing of note is that languages which makes tasks easier by taking care of some programming tasks for you will produce inefficient code. A good programmer can write better code in place of the things that the interpreter is doing.
C++ is an enhanced version of C. Unlike Java and Visual Basic, the code is compiled for a certain CPU and operating system. Therefore, a C/C++ source file may have to be modified if the program is to be used with another operating system and/or CPU. Since it is a compiled language, a program will run faster - unless the programmer is an idiot and wrote the program unintelligently. Unlike a language such as Java and Visual Basic, C/C++ does not really hide any tasks from the programmer. This makes programming more tedious, but a program will be more efficient because the programmer has more control of how the program is created.
The main 'improvement' of C++ is the ability to program using Object Oriented Programming. This is a programming extension which is also available on other compilers, such as Pascal.
It changes the method of creating and using code snippets called functions or procedures.
It supposedly makes programming easier, but at the cost of creating an inefficient program. The file size is larger, the program runs slower, and it consumes more memory.
I'm surprised that many people on this site learn C first. It would be better to learn with a C++ compiler instead. They could learn the basic parts that are shared with C and C++, and then move to programming the C++ side of the language. It is possible to take advantage of the newer features of C++, yet avoid using OOP.
Realistically, coming from someone who has been programming for 25 years (I usually say 21 because that's when I learned Assembly language), OOP is a load of crap. Interpreted languages such as C# and Visual Basic are a load of crap too. I hate bloated, slow code. I program with Assembly and a C++ compiler (without OOP). In Windows programming, the only realistic 'advantage' of OOP is that programmers can access pre-written OOP code which does more work for them. Lazy programmers use OOP procedures instead of making their own code with the regular Windows functions.
2006-09-30 21:37:04
·
answer #1
·
answered by Balk 6
·
0⤊
0⤋
Java is a memory hog. It is based on a template method of compiling code. It is easier to learn. Java allows one to slam together a prototype idea rather effortlessly. The coding in Java resembles C++. Java requests you grasp the concept of Objects from the beginning.
C++ was made for the preceived limitations of C. C runs the fastest. C++ is what Windows was written with. Many beginners get lost with C++ because of a feature called "pointers". Any programs of complexity in C++ become a lengthy exercise.
C requires you to code all the little nuts and bolts called "struct"s -- before deeper, more complex functionality.
I like the following analogies, all are software tools....
> Python is a mitre saw.
>
> Java is a bench saw.
>
> C is a screwdriver.
>
> C++ is a Phillips-head screwdriver.
>
> C# is a screwdriver that has a funny head.
>
> perl is a hammer
2006-09-30 19:21:01
·
answer #2
·
answered by Anonymous
·
1⤊
0⤋
The first term to be familiar with in asking a question of this nature is "language war". You will never get a straight response, you will merely receive a tirade of opinions about why My Favorite Language is better than Your Favorite Language (see links, below).
The 2nd item of importance is that you will hear (repeatedly) many misconceptions about these languages. For example, "interpreted languages are slow" -- while once (arguably) true, the opposite may actually be the case today. Eg: although Java may be called an "interpreted" language, this is only 1/3 of the story: java code IS compiled into intermediate "byte code", and the byte code is then "interpreted" by a virtual machine (VM); then the virtual machine (often, optionally) compiles the platform-independent byte-code into platform-dependent instructions -- so, just like regular C/C++ code. Code that runs repeatedly will run as-fast as native programs. And, the byte-code (and platform-dependent compiled code) may be further optimized based on the nature of the code, the platform and hardware "found" available, and now the code behaves at runtime. SO, Java could be "faster" then compariable C/C++. But the only way to truly "compare" any two modern programming languages for performance is to run benchmarks. Lastly, people who call Java a "web" language simply have no or limited experience with Java development. Maybe they're thinking about (the unrelated) Javascript language.
So, the 3rd point is to avoid all blanket statements -- especially of performace and "purpose" / applicability of a language.
The answer is actually short & simple (if you omit personal opinions):
* C is a compiled language.
* C++ adds in object-oriented programming to the C language (classes, objects), but retains the same basic syntax; additionally, note that one could choose to "program" in C++ and not do object-oriented programming.
* Java combines the syntax of C/C++ together with the stronger features of other OO languages, for example, Smalltalk. Of note: the code is compiled into platform-independent byte-code, which then can run on a virtual machine. Java has a single, common base class (like smalltalk, unlike C++). C++ has templates (aka generics); Java originally did not (not until Java 1.5 [aka Java5], when "generics" were introduced).
Strengths / weaknesses: not much to say, since it's mostly opinion.
* Object-orientation arguably is a good thing (a commonly held *opinion*) -- this can be (arguably) demonstrated through re-usable design patterns that can best be implemented in an OO language.
* The fact that Java has garbage collection may reduce the possibility of leaking memory.
* Java is (mostly) platform-independent -- your code has a good chance of running anywhere once you've written it. (Anywhere, where there's a virtual machine, that is.) C/C++ has to be "ported" to another OS (porting is most difficult from windows to Unix; otherwise, from one Un*x to another is usually trivial -- but still extra work).
* If you do "real-time" programming (has no dependency on "performance", but rather "predictibility") -- you will have to use C (or maybe real-time C++). Please see the "real" definition of "real time" to understand this requirement. "real time" does NOT mean "fast"; it means predictable.
* All of Java, C++ and C are fairly verbose languages when compared to scripting languages like Python, Ruby, Perl. Imo, it takes a while to get a quick prototype of *any* application in these languages. All three are "strongly typed" languages, compared to other scripting languages or other OO languages (like Smalltalk).
* Java has a *vast* library (API) that makes it difficult to learn to use correctly and efficiently. C/C++ often puts developers into the (self-gratifying) position of re-inventing the wheel (or, linked list, as the case may be)... For Java, there are different "platforms" for development, depending on your target deployment: Java Micro Edition (for portable devices), Java Standard (for normal Java apps), Java Enterprise Edition (for server-side apps). These are logical bundling of various APIs, depending on your target deployment platform. C/C++ don't really have "versions" as such, though, your program may be dependent on external dynamically-linked libraries that _may or may not be there_.
I wanted to post a short, succinct reply... But, even as language-agnostic as I am, I was unable to. Just goes to show.... careful what you ask...
thx,
-m
2006-09-30 22:56:17
·
answer #3
·
answered by michael 4
·
0⤊
0⤋