473,889 Members | 1,357 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

Phlip wrote:
werasm wrote:
C++ (deep breath):
- where in memory do you want to
accidentally jump today?
- This is not so much of a problem anymore. Actually, it's not a
problem at all. Using vectors instead of arrays. Using combo of shared
and weak pointers. Wrapping strings or using std::string. We have large
c++ apps running like a clock.

In general, >70% of all software features are not used as first delivered,
and malware is a crushing burden on global productivity. We have a new form
of war on our hands - a new kind of arms race.

Yet when you look at the sources of security breaches, over and over again
you find the things that sloppy C++ programmers revel in. Double deletes,
array overruns from unchecked buffers, runaway recursion, gratuitous
typecasts, etc.

Yes, its time that we get a good book on exactly how software can be
exploited (what to look out for). Maybe they are around. I haven't seen
one in the Bjarne Stroustrup series though, which is what I have come
to like to read.

As far as the things you've mentioned are concerned, they are quite
rare, and with a little of experience easy to spot. Simply look for
sprintf, strncpy, memcpy, memset - replace arrays with vectors, using
at() for indexing. Prohibit c-style casting (actually, prohibit C, or
tuck it away where no one can see it, testing the tucked away part well
- most legacy API's are C - hence the unfortunate need for
compatibility). I was suprised to see on a VxWorks course that none
programmed in C++. There is a lot of embedded code running out there
and still being developed every day. Most of the projects I work on
interface with the hardware very closely. Runaway recursion, hmmm -
sometimes recursion can reduce code and make it much simpler (Tower of
Hanoi, quicksort etc). Is recursion only applicable to C++ as
programming language, if so, one more reason to use it :-).

Hmmm, that's Win32 for you. A good c++ implementation would hide that
as far as possible - but you know that! Yes, it compiles with a c++
compiler - so does assembler. Obviously non-standard.

People are learning that technology in their lives that fails the most often
is software. And C++ is leading the charge.

No, not C++ - the humans using it (BTW, maybe its the Win32 API with
hundreds of ways to do things and no organised documentation indicating
more correct ways). As far as stability is concerned, IMHO the standard
is pretty clear on when you should test your code before trusting it,
aside from many authoritative books written on the subject.

The biggest thing the Java guys (SUN) did was to give humans less
freedom - this cut out >50% of their problems. Leave the hard work to a
couple of guys that know how to develop software (BTW, in which
language was their VM written). Programming in sub-standard teams
before I could appreciate the value in this. This does not mean I
personally enjoy programming in C++ far more than other languages (I
have not tried D, BTW - I appreciate that they maintain templates with
similar flexibility that C++). As far as ruby is concerned, I've tried
it briefly, and it's a bit too loose for my liking. Maybe I should try
it more before commenting.

Kind regards,


May 3 '06 #321
Mishagam schrieb:
What is measured here anyway?

| The ratings are calculated by counting hits of the most popular search
| engines.

TIOBE Programming Community Index Definition
http://www.tiobe.com/index.htm?tiobe_index (you have to click the first
link on the page yourself, stupid website doesn't allow direct links)
May 3 '06 #322
In article <11************ *********@j33g2 000cwa.googlegr oups.com>,
peter koch <pe************ ***@gmail.com> wrote:

So e.g. Swing, JDBC and Vector are all implemented in Java? Without a
single JNI-call in the code? It seems my knowledge of Java needs an

Swing certainly has native portions to interface with the native GUI,
as will generally any library that needs to access some native
third-party library (I/O, thread handling, etc.).

There is no reason for Vector (or its replacement, ArrayList) to have
native code and so they don't, and I don't expect JDBC has any but I
haven't actually looked.

I seem to recall that a while back, some maths functions were moved
from native code to Java code, resulting in a speedup of the maths
operations involved. Can't remember any details though.

Bent D
Bent Dalager - bc*@pvv.org - http://www.pvv.org/~bcd
powered by emacs
May 3 '06 #323
In article <kn************ *************** *****@4ax.com>,
JustBoo <Ju*****@BooWho .com> wrote:


Wow, given that list I would feel more comfortable paying a monkey to
code my apps. Why pay a human just to follow the banana around when I
can get chimps to do it for less.

The day we have a programming language that is so good a monkey could
produce quality software with it is the day we have won.

Until then, we'll just have to get by with incremental steps along the

Bent D
Bent Dalager - bc*@pvv.org - http://www.pvv.org/~bcd
powered by emacs
May 3 '06 #324

"JustBoo" <Ju*****@BooWho .com> wrote in message
news:kn******** *************** *********@4ax.c om...

Java Progammer Criteria?

On Thu, 27 Apr 2006 10:43:36 GMT, Mishagam <no*****@provid er.com>
a) You don't have to think [...]

Okay. No thinking when programming...
b) You don't have to bother to use auto_pointer (not working with

Never having to bother... yeah.
c) You don't have to decide about programming style. Sun provided

No decisions... right.
d) You don't have to decide about naming of files and classes - they are
the same.

Once again.
e) Logical package directory structure is forced on you.

Likes being "forced." Ugh...
f) You don't have to choose between char *, string, CString ... - String

Once again.
g) you don't have to choose between long int, unsigned int, WORD, DWORD,
size_t .... - close to optimal choice if forced on you.

Ohhh, yes, how horrid to have to actually make an informed decision. I
feel for you.
h) You don't decide do you use internal or external functions

I'm starting to see a pattern.
i) You don't have to decide if you use methods or define new operators.

There IS a *clear* pattern. Quite clear.
Java choice is sometimes more verbose, but usually more clear.

Well apparently it's *not* the Java programmer who is going to be
clear, so something has to be, right? I mean s/he is too busy not
making decisions, right. I get the feeling there would be lots of
left-over rotten food and sticky keyboards that could never be decided
upon either. Hygiene would be something to consider though.
As you can guess, I can continue.
Dropping all these choices first - makes programming easier, you have
less things to bother about,

If you were never meant to be a programmer in the first place I
guess.... Hmm, VB and Java programmer are a lot alike. A river in
Egypt, baby, a river in Egypt....

Wow, given that list I would feel more comfortable paying a monkey to
code my apps. Why pay a human just to follow the banana around when I
can get chimps to do it for less.

"Some drink at the fountain of knowledge... others just gargle."

It's not that i dont appreciate sarcasm, selective copy'n' pasting and
painfully biased opinions. But are you
"C++-programmers-are-vastly-superior-to-you-Java-types" kinda people ever
going to come up with actual practical arguments or are we gonna stick to
the "we have [insert C++ specific feature/design patters here] so Java
sucks" kinda mentality (even though in 90% of the cases quitely ignoring
Java has features that either make said feature/pattern obsolete or have
other equally viable options). Saying just because we dont have to think
about/manually do memory managment (which by itself isnt completely true,
but that aside) Java programmers are somehow less capable is painfully
naive. If you're argueing Java programmers dont have to think about certain
things that the average C++ programmer has to think about then i completely
agree, it's called progress.
May 3 '06 #325

"peter koch" <pe************ ***@gmail.com> wrote in message
news:11******** *************@i 40g2000cwc.goog legroups.com...

Roedy Green skrev:
On 28 Apr 2006 00:59:08 -0700, "peter koch"
<pe************ ***@gmail.com> wrote, quoted or indirectly quoted
someone who said :
>It's time to come out of the bush. What adressing mode is not needed?
>Anyone with a reasonable knowledge of C++ knows theyre all necesarry

C++ has more addressing modes than other languages except for
assemblers. So obviously they are not "necessary" in some absolute
sense. They are only necessary in the legacy sense. Java has only one
addressing operator.

This is not quite true. Take old fashioned Pascal as an example. Pascal
has all the adressing modes of C++. Algol has (had) more.

Java has two adressing modes - one for the ints and one for the
objects. And this approach is simple but with drawbacks.

His point was that having more than one addressing mode (from a conceptual
point of view) is not necessary. And if with ints you mean primary types
then yes. It's often argued that types not descending from Object shouldnt
even exist in Java and it's a pretty valid argument. Also the odd mix
implemented for arrays is dodgy design at best.All of the above was meanly
done for performance reasons (and possibly to make code slightly less
verbose?). If there's ever going to be a language based on Java that's
surely the first thing to go in my opinion.
May 3 '06 #326
On 3 May 2006 01:02:01 -0700 "werasm" <w_*****@telkom sa.net> waved a
wand and this message magically appeared:
I was suprised to see on a VxWorks course that none
programmed in C++.

That's because C is better for this sort of work. How else will you
manage to shoe-horn zillions of features into an embedded device with
only 2MB of flash ROM and 16MB of memory?


Take a nap, it saves lives.
May 3 '06 #327
werasm wrote:
I was suprised to see on a VxWorks course that none
programmed in C++.

The last major VxWorks project I worked on was C++....

Ian Collins.
May 3 '06 #328

Alex Buell wrote:
On 3 May 2006 01:02:01 -0700 "werasm" <w_*****@telkom sa.net> waved a
wand and this message magically appeared:
I was suprised to see on a VxWorks course that none
programmed in C++.

That's because C is better for this sort of work. How else will you
manage to shoe-horn zillions of features into an embedded device with
only 2MB of flash ROM and 16MB of memory?

Oh you can - see "Inside the C++ object model" by Lipman. However,
you've enforced my point - the compatibility (with C) is necessary. I
must mention that the course was back in 2000. I have programmed in C++
since for the VxW OS :-).


May 3 '06 #329
Oliver Wong wrote:
(referring to http://www.tiobe.com/tiobe_index/images/tpci_trends.gif
as of May 2nd, 2006): I wonder what happened in 2004 that made Java drop
considerably, and everything else jump up a bit.

From the TIOBE faq:

Q: What happened to Java in April 2004? Did you change your methodology?
A: No, we did not change our methodology at that time. Google changed its
methodology. They performed a general sweep action to get rid of all kinds of
web sites that had been pushed up. As a consequence, there was a huge drop for
languages such as Java and C++. In order to minimize such fluctuations in the
future, we added two more search engines (MSN and Yahoo) a few months after
this incident.

-- chris
May 3 '06 #330

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

Similar topics

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
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
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();
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)
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?
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).
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 <...
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...
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);
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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,...
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...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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();...
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...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.