473,889 Members | 1,409 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
Oliver Wong schrieb:
"Timo Stamm" <ti********@arc or.de> wrote in message
news:44******** *************** @newsread4.arco r-online.net...
Andrey Kuznetsov schrieb:

[Timo wrote:]
I think applets are much worse than Flash. They take a long time to
load, their abilities to communicate with the browser (Javascript)
is even worse than Flashs.

you should try Opera.
While Firefox needs up to 5 second for applet on my page
(http://reader.imagero.com),
with Opera it starts immediately!


Some browsers handle the initialisation better than others. But for
most users, applets just take a long time to appear. Flash is
generally much quicker, regardless of platform or browser.


FWIW, in my experience, Flash is not "much quicker".


Thanks for sharing your experience.

But do you really mean that Flashs /initialization/ is not generally
much faster for you than Applets? Or were you thinking of rendering and
computing performance?

Right now on my Powerbook with Safari, it takes 11 seconds until the
following very simple applet showed it's input elements:
http://java.sun.com/applets/jdk/1.4/.../example1.html

The following Flash movie shows instantly, without any measurable delay:
http://www.contourdesign.com/rollerm...ouse_flash.htm

My experience with other Browsers on Windows and Linux is more or less
the same. Of course there is caching. The second time I load above
Applet, it only takes about one second. This might be even better on
Windows.

I have never experienced such a slow initialization with Flash on any
platform or browser. It never takes even close to one second. This is
very important to most Flash customers, because they don't want any
glitches, hiccups or blinking when the plugin starts.
Timo
May 1 '06 #241

"Oliver Wong" <ow***@castorte ch.com> wrote in message
news:MCq5g.2724 $zn1.505@edtnps 90...

"Remon van Vliet" <re***@exmachin a.nl> wrote in message
news:44******** *************** @news.xs4all.nl ...
[...]
There may be certain times when you
can expect the GC to do some cleanup but you cannot guarantee it nor
can you control it. On the other hand, refrence counting using smart
pointers is 100% programmer controlled. You _can_ force something to
get deleted and you know for certain that the object will get deleted
the instant the last reference to it leaves scope or is destroyed.
This is a totally dependable action that is 100% guaranteed. With the
GC you can have no references to an object but it hangs out until who
knows when and then gets destroyed sometime after the last reference to
it leaves scope or is destroyed..../sometime/ after.


Which is a problem because? You dont have to point out continuously that
the GC doesnt allow exact control over cleaning up discarded objects. We
all know that and consider that a good thing. What'd be more interesting
is to finally hear a valid reason why it's actually a problem rather than
an advantage.

[...]

Why are you so stuck on wanting control over these kind of things? Are
you under the impression you do a better job at manually alloc/deallocing
memory and cleaning up objects than the latest generation Java GC will
do? I'm getting a bit tired of all these unsupported assumptions. Either
come with practical examples/facts or just agree to disagree.


Even if (whoever "you" refers to here) does believe that they are
better at manually allocating and deallocating memory than a modern GC,
there's still the issue of whether the average programmer is better as
well, or if ("you") is simply gifted in that respect. If it's the latter,
non-garbage collected programming languages may be suitable for ("you"),
but not suitable for anyone else.

- Oliver


I was referring to Noah. And yes, very true, but even so his point is
flawed. Recent tests and research (from IBM, amongst others) showed that the
latest generation of garbage collectors not only meet the performance of
manual memory managment in the vast majority of cases, it's often
considerably faster. So even if you've perfected the art of manual memory
managment the odds are now still against you (and yes i can actually explain
why that would be rather than just claim it).

It's an argument quite similar to that of people claiming natively compiled
code will always (or mostly) be faster than Java code running in the VM. It
was true, but it hasnt been so for quite a while now.

- Remon van Vliet
May 1 '06 #242
On Mon, 01 May 2006 18:44:14 +0200, Timo Stamm wrote:
This is very important to most Flash customers, because they don't
want any glitches, hiccups or blinking when the plugin starts.


If there's even a flash plugin available for your particular platform
(I don't know of any for mine).

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
May 1 '06 #243
>
Some browsers handle the initialisation better than others. But for most
users, applets just take a long time to appear. Flash is generally much
quicker, regardless of platform or browser.

It can be, but with Java2D API you have access to hardware accelerated
graphical features that should be on par with Flash performance. In my
opinion everything that can be done in Flash can be done in Java. However,
Flash is way more efficient from a time to market point of view, it's just a
bit easier (and dare i say it better) for web based content.
May 1 '06 #244

"Timo Stamm" <ti********@arc or.de> wrote in message
news:44******** **************@ newsread2.arcor-online.net...
Oliver Wong schrieb:

FWIW, in my experience, Flash is not "much quicker".


Thanks for sharing your experience.

But do you really mean that Flashs /initialization/ is not generally much
faster for you than Applets? Or were you thinking of rendering and
computing performance?

Right now on my Powerbook with Safari, it takes 11 seconds until the
following very simple applet showed it's input elements:
http://java.sun.com/applets/jdk/1.4/.../example1.html

The following Flash movie shows instantly, without any measurable delay:
http://www.contourdesign.com/rollerm...ouse_flash.htm

Windows XP with SP2, Pentium 4 1.8Ghz, 1024MB RAM, Firefox 1.5.0.2.

Java took 3 seconds, Flash took 5 seconds.

- Oliver

May 1 '06 #245

Oliver Wong wrote:
FWIW, in my experience, Flash is not "much quicker".


Here's your half penny...payment for services rendered...

May 1 '06 #246
Noone prevents you from using vi to write Java. Well, maybe the Emacs
tribalists do.
You missed the point. If an editor can parse your code and predict what
you are trying to do, then the language could too. The language itself
could finish these lines, and all I'd have to do is start them.


The point wasnt exactly strong to begin with. Surely you're not serious
here, if you are you're shooting down your own credibility.

Read:

http://c2.com/cgi/wiki?RubyVsJava

log4j's src folder has 31,764 lines of code.

log4r's src folder has 2,071 lines of code.

That's not just fewer lines; it's an order of magnitude fewer, for the
exact same feature set.

Please don't say "that's because Java programmers write more professional
comments..."
Okay i wont say that, i'll rephrase it a bit since you're proving yourself
to be misinformed. As per Java convention the Java version has the lowest
level API reference documentation included in it's source code which
obviously adds quite a few newlines (an odd measurement of verbosity to
begin with but hey). It also happened to be properly spaced and indented
code. Now i took the liberty of browsing through the code of the Ruby
equivalent you mentioned and it has none of that (as in, hardly any comments
and horribly formatted code). Since both are more a matter of taste/style i
dont see it's relevance anyway. I'm pretty sure a similar amount of input
went into both versions (code + docs).
Is that the "let's pretend this block of memory is something else"
stuff "inherited" from C's union and void*?


Write an Any or Variant class in Java.


Never had to. Would very rarely want to.
- GUIs require block closures and dynamic
typing.


Whatever for? I've written GUIs in Java, and the Swing MVC system is
decent enough to use. Where do you need either of those?


You have insufficient experience with block closures.

A GUI should be event-driven. Block closures make those as easy as falling
off a log. Most of the code you write in a static-typing OO language, for
a GUI, is excess plumbing to route events to handlers, and then excess
plumbing to convey state variables into handlers. Block closures simply
turn that problem inside out. The language does the plumbing, and all you
need to do is add the custom behaviors.


I can only agree, GUI development is tedious and overly complicated in Java
nad most available visual editors produce code nobody even wants to look
at). I must say a few well chosen design patterns make the lack of block
closure functions (if that's what you were referring to) not quite as
painful, but still...Java definately loses here. And btw, it can be
succesfully argued that any need for dynamic typing will negatively affect
the robustness of your program in the majority of cases.
May 1 '06 #247

"Timo Stamm" <ti********@arc or.de> wrote in message
news:44******** **************@ newsread2.arcor-online.net...
Oliver Wong schrieb:
"Timo Stamm" <ti********@arc or.de> wrote in message
news:44******** *************** @newsread4.arco r-online.net...
Andrey Kuznetsov schrieb:

[Timo wrote:]
> I think applets are much worse than Flash. They take a long time to
> load, their abilities to communicate with the browser (Javascript) is
> even worse than Flashs.

you should try Opera.
While Firefox needs up to 5 second for applet on my page
(http://reader.imagero.com),
with Opera it starts immediately!

Some browsers handle the initialisation better than others. But for most
users, applets just take a long time to appear. Flash is generally much
quicker, regardless of platform or browser.


FWIW, in my experience, Flash is not "much quicker".


Thanks for sharing your experience.

But do you really mean that Flashs /initialization/ is not generally much
faster for you than Applets? Or were you thinking of rendering and
computing performance?


I think it's fair to say that on average Java initialises a bit slower than
Flash (not surprising considering the implementation differences). Graphics
performance is probably slightly in favour of Flash although Java2D uses
hardware acceleration as well. In terms of raw computing power i suspect
Java will blow Flash out of the water as i'm boldly assuming the "VM" of
Flash is not nearly as capable as an average JIT JVM. I must stress that's
an assumption rather than fact though.
May 1 '06 #248
Remon van Vliet <re***@exmachin a.nl> wrote:
It can be, but with Java2D API you have access to hardware accelerated
graphical features that should be on par with Flash performance. In my
opinion everything that can be done in Flash can be done in Java. However,
Flash is way more efficient from a time to market point of view, it's just a
bit easier (and dare i say it better) for web based content.


The problem is not with the performance of the graphics hardware. The
limiting factor is the initialization of the virtual machine.
Undoubtedly, if things got anywhere near the point of maxing out the
graphics card, an applet would greatly outperform Flash.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
May 1 '06 #249
Remon van Vliet schrieb:
"Timo Stamm" <ti********@arc or.de> wrote in message
news:44******** **************@ newsread2.arcor-online.net...
Oliver Wong schrieb:
"Timo Stamm" <ti********@arc or.de> wrote in message
news:44******** *************** @newsread4.arco r-online.net...
Andrey Kuznetsov schrieb:
[Timo wrote:]
Some browsers handle the initialisation better than others. But for most
users, applets just take a long time to appear. Flash is generally much
quicker, regardless of platform or browser.

FWIW, in my experience, Flash is not "much quicker". Thanks for sharing your experience.

But do you really mean that Flashs /initialization/ is not generally much
faster for you than Applets? Or were you thinking of rendering and
computing performance?


I think it's fair to say that on average Java initialises a bit slower than
Flash (not surprising considering the implementation differences).


That's my experience on a lot of different systems and with a lot of
flash movies. I am surprised that Oliver has a different experience and
I'd like to know the reason. I have quite a few customers who would not
accept a delay of five seconds.

Graphics performance is probably slightly in favour of Flash although
Java2D uses hardware acceleration as well. In terms of raw computing
power i suspect Java will blow Flash out of the water as i'm boldly
assuming the "VM" of Flash is not nearly as capable as an average JIT
JVM. I must stress that's an assumption rather than fact though.


Flash graphics performance is not very good. I have never made any
tests, but I guess that Applets are better. Flash graphics performance
on the mac is very bad, even though they improved it with version 8 of
the player.

Computing performance of Java is far superior. Even with the upcoming
version of the player that was rewritten from scratch.
Timo
May 1 '06 #250

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

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.