• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Another Q for Herbert Schildt ... pure java apps

 
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Herbert Schildt,
I'm a recent (one year) newcomer to the Java language. Recently I've begun more in depth programming with Java as a server side language, and targeting some Java certifications. Referencing many books and websites while preparing for exams have led me to some interesting information.
The most curious to me is that many of the texts claim that C++ will run faster and with less resources than a pure Java application. Additionally, I've found that some Java servlet containers are written in C++, but opertate Java-like. Though I believe that Java as a server side technology has proven itself, are pure Java applications a real contender in desktop computing (when compared to C++ apps)?
Thanks for your response!
Michael Sullivan
 
Author
Posts: 253
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael:
Thanks for your question. It raises an interesting point. A full discussion of these issues would involve a very long discussion -- longer than is possible here. However, I will offer a few thoughts.
First, your question about runtime performance: As things currently stand, given two identical programs, one Java, one C++, the C++ program will typically run quicker because C++ is typically compiled to native code that the CPU executes directly. Java code is compiled to an intermediate code (called bytecode) which is executed under the control of the Java Virtual Machine (JVM). Thus, the typical Java environment incurs an overhead that is not present with C++.
In the preceding paragraph, I repeatedly use the word "typically' because I am sure that exceptions can be found. Furthermore, it is now possible to write "managed C++", which executes in a managed environment in much the same way as Java does.
One other point: Because of advances to the JVM over the years, (such as on-the-fly compilation), the runtime differences between Java and C++ are less pronounced today than they were years ago. Frankly, I think that Java is a good choice for many, many different types of programs. In fact, this is one of the main themes in my book The Art of Java. Java is a powerful, full-featured language that is up to nearly any task!
In general, when thinking about Java and C++ it is important to remember that both were invented to solve different sets of problems. In the case of C++ (which grew out of C), it was to facilitate the creation of high-performance, system-level software. For Java, it was to enable the creation of cross-platorm, portable, safe, and secure code. Thus, both languages have their uses, and their strong points. Fortunately, because of their similarities, most programmers eventually become fluent in both.
To a larger point: Today, the world of professional programming revolves around a core syntax that is shared by C/C++/Java/C#. This is the mainstream. Its where the action is. Its where the next advance in programming will flow from.
Its really an exciting time to be a programmer!
 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic