473,889 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

On Java and C++

Java programmers seem to always be whining about how confusing and
overly complex C++ appears to them. I would like to introduce an
explanation for this. Is it possible that Java programmers simply
aren't smart enough to understand C++?

This is not merely a whimsical hypothesis. Given my experience with
Java programmers --- the code they write and the conversations they
have --- Occam's Razor points to this explanation. For example,

"Oooh I'm confused about the difference between pointers, references,
and objects! How confusing!"

"Oooh operator overloading confuses me! The expression x + y is so
confusing, who knows what's happening with that? If x and y are
complex numbers, what the hell could x + y mean?"

"Oooh multiple inheritance is so confusing! Though I am both a father
and a programmer, I still find it so confusing how the same object can
be two different things! How confusing!"

"Oooh and virtual bases are so bizarre! I am a student --- myself
'the father' is the same student as myself 'the programmer' --- but
nonetheless the idea of virtual bases is absolutely confounding and
confusing to me!"

Again, Occam's Razor is a valuable tool here. In deciding among
competing hypotheses, choose the simplest one. To impartial observers
of indoctrinated Java programmers, the explanation is simple indeed.

Apr 26 '06
458 21648
i am a student,
and i have seen many of my friends 'switch' over to java cos they shy
away from learning much involved language c++
and also they seem to like things like easy GUI interfacing than actual
programming (like practising data structures ..b trees et al.)

Apr 27 '06 #11
"al pacino" <si************ *@gmail.com> wrote in message
news:11******** *************@g 10g2000cwb.goog legroups.com...
i am a student,
and i have seen many of my friends 'switch' over to java cos they shy
away from learning much involved language c++
and also they seem to like things like easy GUI interfacing than actual
programming (like practising data structures ..b trees et al.)


Learning C++ is marginally more difficult than learning Java.

I used to be a die hard C++ advocate - but the added complexity doesn't
really add a great deal of usability; but it is great for obscuring the
meaning of the code.

Java is simpler, cleaner - but programming is programming. Java is
designed to be able to more easily make integrated GUI apps. This might,
in turn, make the code of two programmers with otherwise equal talent, one
in C++ and one in Java, differ and their end results differ. In C++ you
have to reinvent the wheel all the time. Except, it's not like you're
rediscovering, just annoyingly doing the same thing repetitively to take up
more time. In Java you implement one of the provided algorithms, and you
are good to go, with an exponentially smaller possibility that the
underlying algorithm code is in some way flawed. (With as many Java users
as are out there, a bug should pop up pretty quick.) GUIs are easier, in
general, so the java programmer can use that time to make their GUI better.
Web examples (sample code) tend to work, unlike C++ where if you download
something, there is only a miniscule chance that it will compile after 20-30
minutes of fiddling.

Blah - I'm just blabbering. My point is that coding in Java saves times,
and lessens bugs. It will make the end result better. All the bad things
I thought of Java are pretty much gone.

The reason I am replying is you just seem to have contempt. "Actual
Programming" problems will arise, they will just be less mundane.

I think you might be confusing Java with VB.

Trust me though - you can practice algorithms and data structures in Java -
I do so at least 3 times a week on topcoder.

--
LTP

:)

Apr 27 '06 #12
Gernot Frisch wrote:
...
In this sense C was much better language (through clever use of
preprocessor could provide ugly programs). And I understand why C is
still so popular in Linux.

...

Now, you are begging for a fight?

How should I respond to this? May be I am new to this newsgroup.
I (esthetically) liked C very much when I have first seen it, and still
think it is (and especially was (I mean in context of 70-80s when it was
created)) very good language.
However I now prefer to program on Java. I think best quality of Java is
how beautifully it removes most unnecessary choices, leaving one very
decent way to do things.
I now (esthetically) hate C++, however still program on it (using very
few 'modern' features, but using classes) sometimes.
So I stay by my opinion that C is (was) good language, and C++ is bad
language.
Apr 27 '06 #13
How should I respond to this? May be I am new to this newsgroup.
I (esthetically) liked C very much when I have first seen it, and
still think it is (and especially was (I mean in context of 70-80s
when it was created)) very good language.
However I now prefer to program on Java. I think best quality of
Java is how beautifully it removes most unnecessary choices, leaving
one very decent way to do things.
I now (esthetically) hate C++, however still program on it (using
very few 'modern' features, but using classes) sometimes.
So I stay by my opinion that C is (was) good language, and C++ is
bad language.


The so called "ugly" features is what makes C++ so powerfull. Operator
overloading is essentiall for RAD-classes. Aynway...
Apr 27 '06 #14
> Learning C++ is marginally more difficult than learning Java.

I hate feeding trolls but it is just unfair for C++...

I learned Javascript before C++. My impression is even though C++ is
noticeably more complex, it is not more difficult to learn than Javascript.

I used to be a die hard C++ advocate - but the added complexity doesn't
really add a great deal of usability; but it is great for obscuring the
meaning of the code.
A screw driver can help you fix your car; yet it can also do damage to
your car depending on how you use it. C++ is no different. It is just a
tool after all, and you CAN definitely obscure the code with C++. It
takes experience and skill to write good quality code in just about any
language.

The added complexity to C++ is a result of meeting the need of a wide
range of audiences. The language is like a big toolbox, and it is just
unfair to blame the toolbox for offering much more than what you need
for your task.

Java is simpler, cleaner - but programming is programming. Java is
designed to be able to more easily make integrated GUI apps. This might,
in turn, make the code of two programmers with otherwise equal talent, one
in C++ and one in Java, differ and their end results differ. In C++ you
have to reinvent the wheel all the time. Except, it's not like you're
rediscovering, just annoyingly doing the same thing repetitively to take up
more time. In Java you implement one of the provided algorithms, and you
are good to go, with an exponentially smaller possibility that the
underlying algorithm code is in some way flawed. (With as many Java users
as are out there, a bug should pop up pretty quick.) GUIs are easier, in
general, so the java programmer can use that time to make their GUI better.
Web examples (sample code) tend to work, unlike C++ where if you download
something, there is only a miniscule chance that it will compile after 20-30
minutes of fiddling.
It is again an unfair comparison. The ease building GUI apps with Java
has nothing much to do with the simplistic design of the Java language.
It is Java's "standard" class libraries that allows you to program Java
from a higher level than system calls.

You can program C++ GUI at the same level. First thing to do is to find
a library that supports you. These good libraries are unfortunately not
part of the C++ standard and it is a shame that a lot of people are
under the impression that C++ is incapable of, or poorly supports, tasks
that requires non-standard C++ libraries.

Part of Java's popularity comes from politics rather than technicality.
But I am not in the mood of discussing politics.

Blah - I'm just blabbering. My point is that coding in Java saves times,
and lessens bugs. It will make the end result better. All the bad things
I thought of Java are pretty much gone.


Meanwhile Java is getting larger and larger.

Regards,
Ben
Apr 27 '06 #15
Gernot Frisch wrote:

I think best quality of
Java is how beautifully it removes most unnecessary choices, leaving
one very decent way to do things.
I now (esthetically) hate C++, however still program on it (using
very few 'modern' features, but using classes) sometimes.
So I stay by my opinion that C is (was) good language, and C++ is
bad language.


The so called "ugly" features is what makes C++ so powerfull. Operator
overloading is essentiall for RAD-classes. Aynway...

I always wondered in such context what word 'powerfull' means?
Does it mean that you can write program that cannot be written on Java?
or Does it mean that you can write shorter C++ program doing the same as
equivalent Java program? Then may be you should like Perl even more?
Or does it man that you can write library, such that equivalent C++
program will LOOK simpler than Java program?
Apr 27 '06 #16
Mishagam wrote:
Gernot Frisch wrote:

I think best quality of Java is how beautifully it removes most
unnecessary choices, leaving one very decent way to do things.
I now (esthetically) hate C++, however still program on it (using
very few 'modern' features, but using classes) sometimes.
So I stay by my opinion that C is (was) good language, and C++ is bad
language.


The so called "ugly" features is what makes C++ so powerfull. Operator
overloading is essentiall for RAD-classes. Aynway...

I always wondered in such context what word 'powerfull' means?
Does it mean that you can write program that cannot be written on Java?
or Does it mean that you can write shorter C++ program doing the same as
equivalent Java program? Then may be you should like Perl even more?
Or does it man that you can write library, such that equivalent C++
program will LOOK simpler than Java program?

I meant in last case C++ program using C++ library looks simpler than
Java program using Java library.
Apr 27 '06 #17
I think that some people may be missing the point in having multiple
programming languages.

Why do you think that the world has more than one language? Why don't
we all use English instead of all having different languages, it would
make life so much easier. Well, in fact, it wouldn't.

In my honest opinion, once you know how to program at a decent level,
you should be able to use any language with just a small amount of
effort, if you want to master that language then fine, but be prepared
to put the work in. At the same time, the amount of programs or
applications that require a team of programmers to know every in-depth
detail of their language is slim.

C++ has advantages over Java, it also has its fair share of
disadvantages. I don't buy into the fact that Java is easier to learn.
I have been a learning C++ for about 3 years and as part of my uni
course, have now been asked to program some Java. I find Java as a
language nice to work with but have the same number of problems I would
have expected from learning a new language. Yes, its a slimmed down
version, yes it may be easier to do certain things but if we made all
programming languages insanely difficult only a small number of people
would ever get the joy the rest of us get from programming.

Just my thoughts.....

Apr 27 '06 #18
Gernot Frisch wrote:
The so called "ugly" features is what makes C++ so powerfull.


I don't agree with the fatalistic idea that a feature must be ugly in
order to be powerful. The warts in C++ are not due to its power, but to
its desire to integrate new features in while retaining source
compatibility with 30 years of past decisions, good and bad.

If you're willing to give up legacy compatibility, it's possible to
design a language with similar and even greater power, but in a much
simpler and straightforward package. Such is the D programming language,
www.digitalmars.com/d/

For an example of how an "ugly" power feature like templates can be made
easier (and even more powerful), see
www.digitalmars.com/d/templates-revisited.html .
-Walter Bright
Digital Mars
Apr 27 '06 #19
In article <44************ ***********@new s.optusnet.com. au>,
benben <be******@yahoo .com.au> wrote:
Learning C++ is marginally more difficult than learning Java.


I hate feeding trolls but it is just unfair for C++...

I learned Javascript before C++. My impression is even though C++ is
noticeably more complex, it is not more difficult to learn than Javascript.


That may say more about Javascript than it does about C++ though :-)

(Personally, I found ECMAScript pretty straight forward up until I
reached the chapter of the spec titled "automatic semicolon
insertion". It went downhill from there <g>)

Cheers
Bent D
--
Bent Dalager - bc*@pvv.org - http://www.pvv.org/~bcd
powered by emacs
Apr 27 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6823
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what the issue is. Thanks Ravi
1
6927
by: ptaz | last post by:
Hi I'm trying to run a web page but I get the following error. Ca anyone please tell me a solution to this. Thanks Ptaz HTTP Status 500 - type Exception report
11
9298
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
0
5664
by: mailkhurana | last post by:
Hii , I am trying to use a type 2 driver to connect to DB2 0n AIX 5 I have a small java test to class to establish a conneciton with the db .. I am NOT using WAS or any appserver When I try to connect to the DB I get the following exception at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2120)
1
9675
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
12
5939
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it says: usage: java fit.FitServer host port socketTicket -v verbose I think this is because I do not understand the jython mechanism for inheritance (yet).
0
3295
by: jaywak | last post by:
Just tried running some code on Linux (2.4.21-32.0.1.EL and Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)) and Windows XPSP2 (with Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)) and in both cases, get the following list returned from calling getDeclaredFields() on java.lang.ClassLoader via this code snippet: Field fields = loaderClass.getDeclaredFields(); for (int i = 0; i <...
1
4314
by: jaimemartin | last post by:
hello, I want to validate an xml by means of a schema (xsd). To do that first of all I´m using a SchemaFactory. The problem is that if I run the code in Windows all works fine, but If I run it in Linux there is an error. The code that fails is the following: SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); I´m sure that code is ok. In fact, I´ve found that in several...
0
3304
oll3i
by: oll3i | last post by:
package library.common; import java.sql.ResultSet; public interface LibraryInterface { public ResultSet getBookByAuthor(String author); public ResultSet getBookByName(String name);
0
9807
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11188
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10789
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9606
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7150
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5828
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6028
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3255
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.