Solved

C++ or Java To be or not to be??

Posted on 2000-04-29
5
320 Views
Last Modified: 2010-04-16
Hi,

I have been playing around with Java and C++ for a little while (Visual Studio 6).

In general terms, if I wanted to write a simple dialog based win app, is there any benefit using c++ over Java (or visa versa).

I know its a bit vauge but i'm only really looking for thoughts / opinions on this.
0
Comment
Question by:Ginger_Ed
5 Comments
 
LVL 4

Expert Comment

by:adam923
ID: 2764863
java is much easier to program and just about as powerful as c++, some may disagree here, but it's also slower to run and requires the computer that's running the app to have a java runtime environment installed
0
 
LVL 1

Expert Comment

by:rowisoft
ID: 2765332
Hy!

I think C++ is easier! Of course, the language sometimes is difficult, but the IDEs are better, I think!
Look at www.borland.com! Order a Demo-CD and you'll see, the C++Builder is very easy to use!!!
(and creates standalone exes, too)
Robert
0
 
LVL 2

Author Comment

by:Ginger_Ed
ID: 2765628
I've got Visual C++ so I'll be using that.

But is there any noticable difference in speed in a small app.  

Also am I right in thinking that the only java runtime they need already comes with win98 / nt / 2000??


Ed
0
 
LVL 3

Accepted Solution

by:
matth012098 earned 100 total points
ID: 2831157
Hi

   Ive programmed in VisualC++ for many years and find that writing software for windows based applications takes a lot of reading the docs, especially using MFC. It can also be quite difficult getting to frips with the way the messaging system works. I have just recently over the last couple of months started to learn Java and I find it much easier to manage. I am a computer games programmer and have written many games in many languages and I must say that I find Java the best for its simplicity and portability. Java could probably never be as fast as something like C++, because C++ compiles straight to native assembly, however companies are now working on hardware implementations of the Java Virtual Machine (JVM), which does come with Windows 98 and can be upgraded from Suns site. These hardware JVM's will allow software that is as competitive if not as good as software for todays native systems. Here are list of advantages and disadvantages of using Java:

Java - Advantages
-----------------
1. Java can call native code written in C++ via COM
2. Cross platform support, including mobile phones, digital set top boxes, Unix, Windows, DOS, Linux etc.... The code you write will work on any machine that has a JVM and you will not have to rewrite whole lilbraries of code to get it to work.
3. Hardware JVM's in development, bye bye software interpreters
4. Versatile and very very easy to use
5. Excellent support on the net
6. Applications can be written to run in a web browser (ActievX can , but it is generally not as trusted due to its client side access to your information)
7. When your software crashes it doesnt generally take the OS down with it.
8. Fun to write in
9. Windows functionality is part of the huge Java library that comes with it
10. The IDE for VisualJ++ is the same as for VisualC++
11. Free compilers and tools from sun
12. Syntax is very similar to C++, so you could learn both at the same time

Java - Disadvantages
--------------------
1. Bytecodes (Java assembly) must be interpreted by the JVM so it can be slow for doing things such as advanced calculations, however performing tasks such as blitting images to the screen are implemented in native platform code inside the JVM so they are as fast as C++
2. More work in C++ at the moment, but theres even more work in VB

The above lists are by no means complete, they are simply off the top of my head

C++ and many other languages that compile to native code absolutely faster but they are harder to write in and will fade out in years to come.


Hope this helps

Matth

P.S

  Heres a small example in Java

class Example
{
  public static void main(String[] args)
  {
    System.out.println("Hello World");
  }
}

and in C++ (Well C)

#include <stdio.h>

void main(int argc, char *argv[])
{
  printf("Hello World\n");
}

Although noted the above is not encapsulated into any class. If I did this as with the Java implementation then the source would be much longer and complicated.



0
 
LVL 2

Author Comment

by:Ginger_Ed
ID: 2832386
cheers,  I have been playing around and I find Java a hell of a lot easier.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question