C

Last Edited By Krjb Donovan
Last Updated: Mar 11, 2014 07:50 PM GMT

Question

QUESTION: Hello Sir,

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: At the outset, let me clarify that I have done most of my programming in C++ and Python. I've just done some background checks on C# and Java and written a few programs using these languages. With that caveat in place, these are my impressions of C# and Java.

1. If you get to know one of these languages well, you will have absolutely no problem picking up the other in just a couple of days.

2. Both C# and Java target the same kind of applications. Neither can step into the niche occupied by C/C++ for performance critical platform/middleware applications. And languages like Python beat both C# and Java hands down on development time and ease of use.

3. Overall, I feel that C# provides greater expressiveness and is more suited to writing performance-critical code than Java, while it shares Java's simplicity. C# is faster to develop in (especially GUI design), has a better IDE then any of the various Java IDEs out there, one can perform lower level operations in a much easier and much more efficient way (for instance native code invocation), and in my experience clearly outperforms Java.

4. Java is better at cross-platform compatibility. java is ported everywhere, will run on almost every system, though in some cases the code would require tweaking. Right now C# is, in effect, limited to Microsoft platforms. Perhaps when Mono becomes more mature, it might make more sense to use C# for multi-platform development.



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

QUESTION: Gr8. Thanx...!

Being from c++ background, can u plz give a few examples of middlewares built in c++. Or applications that are preferably built in c++. Which c++ compiler is the best?I have heard that C++ is most preferred for system prog. Is it mainly about driver design ? Can u also explain middleware and list examples? Whats is SCADA and is c++ used for it? I lov data structures. Where r they primarily used, and for what purpose?

Thanx again...!

Answer

> a few examples of middlewares built in c++. Or applications that are preferably built in c++.

Many examples can bew found here: http://www2.research.att.com/~bs/applications.html


> Which c++ compiler is the best?

There can be no one compiler that is best for everyone, people's needs differ too much for that. The GNU compiler g++ and the Microsoft compiler VC++ 8.0 are both good compilers which are heavily used.


> I have heard that C++ is most preferred for system prog. Is it mainly about driver design

C++ can be used for system programming. C too is still used heavily for that.


> Whats is SCADA and is c++ used for it?

See: http://en.wikipedia.org/wiki/SCADA


> I lov data structures. Where r they primarily used

They are used everywhere in programming.


> and for what purpose? Different data structures are used for different purposes. For example B+ trees are used for:


NTFS, ReiserFS, NSS, XFS, and JFS filesystems all use this type of tree for metadata indexing. Relational database management systems such as IBM DB2, Informix, Microsoft SQL Server, Oracle, Sybase ASE, PostgreSQL[, Firebird, MySQL[ and SQLite support this type of tree for table indices. Key-value database management systems such as Tokyo Cabinet and Tokyo Tyrant support this type of tree for data access. InfinityDB is a concurrent BTree." - from http://en.wikipedia.org/wiki/B%2B_tree



Question

QUESTION: Hello Sir,

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.


---------- 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.

Advertisement

©2024 eLuminary LLC. All rights reserved.