You are here:

C++/C# vs Java vs C++

Advertisement


Question
QUESTION: Hello Sir,
I am a 21 years old guy. Don’t really know much about programming (especially OOP) and software development. Though am pretty good in C and data  structures.  Am  not particularly interested in embedded prog or designing drivers.
I am interested in hardcore prog, ie building applications.
I am now turning my attention towards OOP. But I am pretty confused which one to pursue - C# or Java.
What sort of softwares/application can be built by C# and JAVA. Which one should be preferred and why? Is it that C# is preferred for a certain type of application and Java for something else.
I also wish to know where should  VC++ replace C#.  And why is C# more famous than VC++.

In which environment JAVA is more preferable to C#.
Can everything that can be done in JAVA , also be developed in C# and vice versa.
All I know is that .Net is from MS and Java to SUN.

Thanking you in advance.

ANSWER: Hello Alok.

I don't think there is one correct answer to your question. Any of the 3 programming languages will let you learn OOP. At your stage you should be moving on to object oriented analysis and design, and design patterns. I can recommend to you the following books.

I can recommend "Head First Design Patterns" which you can find at
http://oreilly.com/catalog/9780596007126
and at google books too.
Its a fun read, but serious too. I am currently reading it. It is based on Java, but applies to all object oriented languages.

There is also "Head First Object Oriented Analysis and Design" which is very good.

For building desktop applications, any of the 3 programming languages will work. I always find C++ to perform better than any dot net or Java application, and that gives the user a better experience. The problem with C++ is that there is no built in GUI library, so you have to use something specific to the operating system, or you can use Qt which will work on Windows, Linux, or Mac.

You can get Qt for free at
http://qt.nokia.com/products
You can get a good free book on it from  
http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip

If you want to use dot net, I'd suggest using C# because that language is built for dot net. The VC++ dot net version is very unpleasant to use. The only other GUI option for Windows in C++ is the Microsoft Foundation Classes (MFC) library. It is also unpleasant.

Both the C# and Java have very good GUI libraries.

Another thing to consider is that Qt and Java are free and have free development environments, but for C#, you may have to pay for visual studio.

I have never written in Java professionally. All of my C# has been done on small programs. Almost all of my career has used C and C++ so, I cannot say much about what C# and Java are best for.

Finally, if you are looking for work soon, you should look at what is in demand in your country.

I hope this has answered some of your questions. I'm sure that other people will give you other valid points of view.

Best regards
Zlatko

---------- FOLLOW-UP ----------

QUESTION: Whats a GUI library and whats its use? Which is a better compiler for C++ - Gcc or something else? Can u pls name a few applications that can be built on  c++ platform to get an idea of the various types of applications possibly developed. C++ is often used for System prog, network prog, any other applications? I aint much interested in game devlp. I was also interested in GIS  & SCADA. How can c/c++ be used for SCADA.
Btw, I am from INDIA, a country known for its potential in  software engg. And all 3 C++, C# , and JAVA are used here.

Imp question - Since u r into C++, I wish to know the use & advantages of pointers, a facility that Java like lang lack. What is it that can be done rather easily and usefully with pointers that java cant(or would require more efforts & tedious prog and would still be inefficient without pointers). I lov data structures. But it too can be done in Java without the programmer having the facility of using pointers directly.

Again thanking you.

Answer
Hello Alok

Very good questions.

A GUI library is used to display windows on your screen.

GCC is an excellent compiler for C++.

Microsoft Windows, Microsoft Office, and Linux are written in C and C++. Systems for inspecting nuclear power plant pressure tubes with ultrasonic signals are written in C and C++.

C++ is used for system programming, network programming, and also real time programming. Dot net does not have as good performance when real time programming is needed. Java is not suitable for real time programming. C/C++ is good for SCADA because it performs well in real time environments. I don't know what GIS is.

Java references are equivalent to pointers, except you cannot do pointer arithmetic. You can do all the data structures which you are familiar with in Java. Because you cannot do pointer arithmetic, you cannot iterate through memory with pointers in Java. Typically, you use arrays, and array indexes instead. In java, or C# you cannot directly access memory locations of machines, so you cannot create drivers.

Once you know OOP concepts and design patterns, you can pick up any of the languages.

Best regards
Zlatko

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.