473,889 Members | 1,327 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
They /both/ suck.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Apr 27 '06 #31
REH

Ben wrote:
REH wrote:
Luc The Perverse wrote:
Java is simpler, cleaner - but programming is programming.

Yeah, and that's why I write real-time systems in Perl. Languages are
tools. Use the right one for the right job. No language has yet
filled the "one-size-fits-all" catagory.

REH


I've programmed both in JAVA and C++

Try writing a OS in JAVA...wait is that even possible?

or try writing web based programs in C++, get ready for a headache...


I don't know if you are agreeing with me or just misunderstood my
statement.

REH

Apr 27 '06 #32
In comp.lang.java. advocacy, Ben
<be******@vt.ed u>
wrote
on Thu, 27 Apr 2006 11:03:52 -0400
<e2**********@s olaris.cc.vt.ed u>:
REH wrote:
Luc The Perverse wrote:
Java is simpler, cleaner - but programming is programming.

Yeah, and that's why I write real-time systems in Perl. Languages are
tools. Use the right one for the right job. No language has yet
filled the "one-size-fits-all" catagory.

REH


I've programmed both in JAVA and C++

Try writing a OS in JAVA...wait is that even possible?


It's been done, although AFAIK it didn't fare all that well in the
marketplace.

http://en.wikipedia.org/wiki/JavaOS

A freeware variant is also active. This one looks rather interesting,
although the compatibility list is a little skimpy...but then, that's
why freeware is such fun; someone will write those drivers (and one
might port them from equivalent Linux drivers) if they need them.

http://www.jnode.org/

or try writing web based programs in C++, get ready for a headache...


Not as bad as one might think if one avoids pointers and
sticks to the Standard Template Library. However, Java
may very well be more efficient under those conditions,
as it copies pointers instead of entire structures.

There is one thing missing from Java, the equivalent
of std::multiset<> and std::multimap<> . However, the latter
can be replaced by std::map<..., std::list<>>, and I don't
know of any really good uses for the former offhand that
wouldn't be better served by a std::multimap<> or a
std::map<...,st d::list<>>.

--
#191, ew****@earthlin k.net
Windows Vista. Because it's time to refresh your hardware. Trust us.
Apr 27 '06 #33
"Ben" <be******@vt.ed u> wrote in message
news:e2******** **@solaris.cc.v t.edu...

Try writing a OS in JAVA...wait is that even possible?


http://en.wikipedia.org/wiki/JavaOS

- Oliver

Apr 27 '06 #34
On Wed, 26 Apr 2006 22:48:25 GMT, Mishagam <no*****@provid er.com>
wrote, quoted or indirectly quoted someone who said :
I agree that may be C++ programmers are smarter.


There are two meaning for smarter.

There is a the sort of guy who can keep his home books doing all the
arithmetic in his head.

There is the sort of guy who uses an adding machine with a tape for
verification.

The first has more raw skill. The second gets the job done more
accurately with less effort, and gets to go fishing sooner.

--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Apr 27 '06 #35

Mishagam wrote:
c) You don't have to decide about programming style. Sun provided
standard Java style.
d) You don't have to decide about naming of files and classes - they are
the same.
e) Logical package directory structure is forced on you.
Three things I _really_ hate about Java.
f) You don't have to choose between char *, string, CString ... - String
is better (or same) than either of them and it is only choice.
Actually, you are in err. Java also has char[] and there is nothing
stopping someone from using it or designing a new String. Therefor
Java suffers from the same "problem" as C++ here except there are no
Java functions and tools to work with char[]...you have to write them
from scratch.
g) you don't have to choose between long int, unsigned int, WORD, DWORD,
size_t .... - close to optimal choice if forced on you.
h) You don't decide do you use internal or external functions
definitions, or do you use macro. - close to optimal choice if only one
possible.
i) You don't have to decide if you use methods or define new operators.
Java choice is sometimes more verbose, but usually more clear.
...
As you can guess, I can continue.


Yes, but all the benefits you are listing are things you *can't* do and
the things forced upon you. Where are the list of things you *can* do?
You make Java sound like a jail sentance.

I don't think one is better than the other but common, these are just
bad arguments.

Apr 27 '06 #36
On Thu, 27 Apr 2006 10:43:36 GMT, Mishagam <no*****@provid er.com>
wrote, quoted or indirectly quoted someone who said :
a) You don't have to think should you include fields of have variables
as objects or references or pointers. It is decided for you usually
close to optimal way (closest to references).


This is a huge benefit. There are so many addressing modes in C++ that
really don't buy you much other than confusion.

The other huge benefit is platform independence. Java has everything
removed that would temp you to write platform dependent code.

Granted I tend to use a very vanilla style of coding, but platform
specific problems just don't happen to me.

Even writing something as UI-free as a compiler takes a huge amount of
platform-adjusting application code. In Java, that his already
handled by standard libraries.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Apr 27 '06 #37
On Thu, 27 Apr 2006 15:06:53 +0200, "Gernot Frisch" <Me@Privacy.net >
wrote, quoted or indirectly quoted someone who said :

I like new/delete. Makes me feel I'm in charge. Just my .02$


The problem is a bit like "feeling in charge" at a 747 control panel.
You know you are not up to the job for any serious app.

I used to use Numega to track leaks in a C/C++ team's code. It was
not a matter of fixing them, but getting them down to a dull roar.

Mixing exception handling and memory management boggles the human
mind.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Apr 27 '06 #38

Roedy Green wrote:
The other huge benefit is platform independence. Java has everything
removed that would temp you to write platform dependent code.


Well, that is one area where Java *can't* be used then isn't it.

Another can't. Where is the can?

Apr 27 '06 #39
On Thu, 27 Apr 2006 15:48:54 GMT, Mishagam <no*****@provid er.com>
wrote, quoted or indirectly quoted someone who said :
c) You don't have to decide about programming style. Sun provided
standard Java style.


Juck!


You don't like Sun Style? I find it not worse than any other, and it has
advantage that most Java programmers use it. In C, for example, Linux
core uses one style, and Gnu uses other, incompatible style, and
Microsoft, of course, uses third.


1. A Java shop can adopt Sun style which every new programmer knows
since they have seen it ad nauseam in the Sun classes.

2. Or a shop can adopt its own more rigid super set of Sun rules.

3. Or a shop can adopt its own style.

4. Or a shop can adopt chaos and start blood feuds between programmers
to poison the coffee of the programmers who reformat "their" code and
deal with repository false deltas.

How is a C++ shop better off having only choices 3 and 4?

see http://mindprod.com/jgloss/codingconventions.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Apr 27 '06 #40

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
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...
1
10889
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,...
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...
1
7993
isladogs
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...
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
6028
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.