473,889 Members | 1,387 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 21629
Walter Bright wrote:
You can put template bodies in separate .d files in the D programming
language, and it works with a standard linker.

-Walter Bright
www.digitalmars.com C, C++, D programming language compilers


I'm not yet qualified to put your D on the Suck list, but rest assured I
will soon work to correct the situation. However...

....Can D treat classes as objects?

That's about the most complex and subtle programming concept that I
understand, so I tend to harp on it too much. ;-)

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Apr 28 '06 #201
"Andrew McDonagh" <ne**@andmc.com > schrieb im Newsbeitrag
news:e2******** **@news.freedom 2surf.net...
TJW wrote:
Hello,

On 28 Apr 2006 09:34:56 -0700 "Noah Roberts" <ro**********@g mail.com>
writes:
Won't respond to your personal attack but I will respond to your claim
I am purposfully misinterpreting your statements.


As a purely outside observer to this thread, I found this
statement fairly amusing considering the following text that has
appeared in this thread.


snipped brilliantly researched response.

v cool TJW.


100% ACK

Andrey

--
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities

Apr 28 '06 #202

Phlip wrote:
Walter Bright wrote:
You can put template bodies in separate .d files in the D programming
language, and it works with a standard linker.

-Walter Bright
www.digitalmars.com C, C++, D programming language compilers


I'm not yet qualified to put your D on the Suck list, but rest assured I
will soon work to correct the situation.


Common, just look at its name. Can't possibly be anything but suck
with a name like "D".

Apr 28 '06 #203
In article <MP************ ************@ne ws.astraweb.com >,
Chris Smith <cd*****@twu.ne t> wrote:

I don't see any "C++ is not as good as Java because" in that paragraph.
I took it as an indictment of the silliness of bringing up this hardware
CPU/bytecode stuff in this conversation in the first place. Maybe I
misinterpret ed something, but I really don't think so.


It was a bit of that, and also a bit of a stab at the language zealots
from both sides of the fence: this is the sort of uninteresting trivia
that seems to interest them a lot for some reason.

A bit trollish of me, perhaps, but then this _is_ a troll thread :-)

Cheers
Bent D
--
Bent Dalager - bc*@pvv.org - http://www.pvv.org/~bcd
powered by emacs
Apr 28 '06 #204
Walter Bright wrote:
Phlip wrote:
Walter Bright wrote:
Phlip wrote:

- the majority of the glitches and
common bugs when implementing code
in C++ happen because it's designed
to be efficiently compiled by a
simple compiler.

A C++ compiler is probably the most complex of all language compilers.

There's a better way to state that item, because otherwise C++ wouldn't
suck, and we all know that's not the case.

Newbie: Why can't I put template bodies in .cpp files?

Guru: Because the linker doesn't have a compiler in it.

You can put template bodies in separate .d files in the D programming
language, and it works with a standard linker.

You can do the same with a number of C++ compilers, whether or not they
support the 'export' keyword.

--
Ian Collins.
Apr 28 '06 #205
On 28 Apr 2006 15:31:16 -0700 "Noah Roberts" <ro**********@g mail.com>
waved a wand and this message magically appeared:
I'm not yet qualified to put your D on the Suck list, but rest
assured I will soon work to correct the situation.


Common, just look at its name. Can't possibly be anything but suck
with a name like "D".


That name reminds me of being back at school, getting my prep graded on
a scale between A (good), to F (fail). Getting a D meant you made a very
poor effort... ;o)

--
http://www.munted.org.uk

Take a nap, it saves lives.
Apr 28 '06 #206
Noah Roberts wrote:
Mishagam wrote:
And of course one of main items:
j: In Java you generally don't have to think how to report error - you
throw Exception. In C++ you have different conventions for different
systems changing over time. Some programs return NULL or 0 or -1 or
SIGNALS ..., Microsoft COM programs returned HRESULT, lately C++ started
using exceptions, but I am sure it is still only one of choices. I don't
know, but doubt that C++ exceptions are as convenient as in Java. Of
course this result of Java being designed later when exceptions already
were well known .
Where to start...

First, are you really making the statement that Java supports no other
error reporting facility? That is blatantly false but let's assume for
the moment that is true and ask ourselves if that is actually a good
thing...

You can of course return 0 or null or false or something on error, but
most programmers and libraries use Exceptions. Exceptions in Java are
very convenient, there is usually no sense not to use them.
Second...I'm not sure of you use of the term "program".
I made and error. I meant procedure, not program.

Are you really claiming that a Java *program* can somehow report exceptions to the OS
or object running it in a way other than what the OS supports - signals
being one common facility? If this is in fact true it would be an
interesting CAN I am not aware of. C++ programs never "return NULL"
but do most commonly return an integer...0 meaning all is ok. AFAIK
Java must do this too as many operating systems depend on the behavior.

I was writing about how called procedure can inform calling procedure
about error or some condition, like broken network connection. All I
wrote about C was also about communicating errors to calling procedure.
I don't know exactly how JVM informs OS how program ended - (I thing it
is value in System.exit( code )) this is not what I was talking about
(and not most central part in programming, if you are not programming
mainly in Unix shell). Third...COM is not C++, it is a MS specific standard of coding a set of
functionality in ANY language that can be used from ANY language
capable of interacting with COM. I do believe Java can be counted
among them but of course any such program instantly looses any platform
independance. I programmed on COM on C/C++, and all COM procedures use HRESULT as
error code. Other often used COM Language is VB, where error codes
apparently are somehow hidden - I don't know VB very well. Java cannot
directly use COM, probably there exist JNI Libraries allowing
communications Java <-> COM through native calls.
Finally, if you don't know then your doubts are meaningless.

Apr 29 '06 #207
On Fri, 28 Apr 2006 18:14:07 +0000, Phlip wrote:
Andrew McDonagh wrote:
go Ruby ..Go Ruby...Go Ruby
Ruby:

Java:

C++ (deep breath):


makes me miss Fortran-4 and LSI-11 assembler even more so... :^(

Long live the PDP11 !

cause everybody knows that architectures should be based on octal values,
right?
Apr 29 '06 #208
Ian Collins wrote:
You can do the same with a number of C++ compilers, whether or not they
support the 'export' keyword.


Newbie: Why do I have to define classes twice?

Guru: You don't define them twice. You declare them in header
files, define them in header files, and define their methods
in implementation files.

Newbie: Why do I have to de...scribe classes three times?

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Apr 29 '06 #209
Alex Buell wrote:
That name reminds me of being back at school, getting my prep graded on
a scale between A (good), to F (fail). Getting a D meant you made a very
poor effort... ;o)


They already make that joke on their web page.

I tried its source on the train ride home, and d2html.d struck me as one
huge function, with absurdly deep nested blocks. Couldn't it have been a
table?

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

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
6926
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
5938
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
9961
marktang
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...
0
11187
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
10784
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
9602
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...
1
7991
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
7148
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
5825
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
6021
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3252
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.