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

"Luc The Perverse" <sl************ ***********@cc. usu.edu> wrote in message
news:79******** ****@loki.cmear s.id.au...
"Remon van Vliet" <re***@exmachin a.nl> wrote in message
news:44******** *************** @news.xs4all.nl ...

"Luc The Perverse" <sl************ ***********@cc. usu.edu> wrote in
message news:s6******** ****@loki.cmear s.id.au...
"Remon van Vliet" <re***@exmachin a.nl> wrote in message
news:44******** *************** @news.xs4all.nl ...

"Chris Smith" <cd*****@twu.ne t> wrote in message
news:MP******** *************** *@news.astraweb .com...
> 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.
>

I know, but it's two different things, initialisation isnt in the way
of performance and vice versa. That said, i can see how VM
initialisation is a limiting factor. Having to wait 5+ seconds kind of
shoots applets down as a good option for dynamic web content.

I wonder if running the JVM as a process would eliminate this delay, or
at least greatly reduce it


I think it sort of is after the first invocation. I cant say for sure
though.


Typically I am opposed to background services running - but if I could
make Java programs initial startup cost go away, I could sacrifice a few
MB.

Does anyone know for sure? (To be honest, java programs interest me more
than applets.)


That's definitely not the case. I was referring to different applets running
in the same browser instance. JVM initialisation also depends on whether or
not you start it in client or server mode. The latter takes considerbly
longer to load.
May 1 '06 #271
I V
On Mon, 01 May 2006 21:11:10 +0200, Remon van Vliet wrote:
As for resources that are in short supply, i've never actually run into such
an issue with Java to begin with and i develop high concurrency servers.
Actually, I've never really had a problem with resources being released by
GC systems either, but I don't develop the sort of applications where I
would imagine it being a problem. I'd be interested if anyone knows of any
actual studies which have investigated in precisely what cases
non-deterministic destruction causes real-world problems. Or, indeed,
anecdotal experience from those with a wider range of experience than my
own.
Reusable resources are usually pooled and cleanly released when
necessary, and i cant really think of any other kind of resource that


How is the pool notified that a resource is ready to be reused? By a
finalizer, or by explicitly calling a "release" or "dispose" method? In
the later case, RAII would be useful in automating the release and helping
to ensure correctness.

May 1 '06 #272

Remon van Vliet wrote:
I read the entire thread, i understand RAII perfectly.


Obviously not as you are demanding that I reiterate the definition yet
again.

I already repeated myself enough times in this thread. If you don't
like the answer that is fine but the answer is here for you to read in
numerous locations. If you have a question about how something works
then by all means ask.

May 1 '06 #273
"Remon van Vliet" <re***@exmachin a.nl> wrote in message
news:44******** *************** @news.xs4all.nl ...

"Luc The Perverse" <sl************ ***********@cc. usu.edu> wrote in message
news:79******** ****@loki.cmear s.id.au...
"Remon van Vliet" <re***@exmachin a.nl> wrote in message
news:44******** *************** @news.xs4all.nl ...

"Luc The Perverse" <sl************ ***********@cc. usu.edu> wrote in
message news:s6******** ****@loki.cmear s.id.au...
"Remon van Vliet" <re***@exmachin a.nl> wrote in message
news:44******** *************** @news.xs4all.nl ...
>
> "Chris Smith" <cd*****@twu.ne t> wrote in message
> news:MP******** *************** *@news.astraweb .com...
>> 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.
>>
>
> I know, but it's two different things, initialisation isnt in the way
> of performance and vice versa. That said, i can see how VM
> initialisation is a limiting factor. Having to wait 5+ seconds kind of
> shoots applets down as a good option for dynamic web content.

I wonder if running the JVM as a process would eliminate this delay, or
at least greatly reduce it

I think it sort of is after the first invocation. I cant say for sure
though.


Typically I am opposed to background services running - but if I could
make Java programs initial startup cost go away, I could sacrifice a few
MB.

Does anyone know for sure? (To be honest, java programs interest me more
than applets.)


That's definitely not the case. I was referring to different applets
running in the same browser instance. JVM initialisation also depends on
whether or not you start it in client or server mode. The latter takes
considerbly longer to load.


What advantage does it hold? I plan on writing server applications (albeit
with an anticipated very low user base)

--
LTP

:)
May 2 '06 #274
Oliver Wong wrote:

"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

I agree. Java link was about 2 times faster. Firefox 1.5.0.2.
IE 6.0 speed was about the same.
May 2 '06 #275
I V <wr******@gmail .com> wrote:
Actually, I've never really had a problem with resources being released by
GC systems either, but I don't develop the sort of applications where I
would imagine it being a problem. I'd be interested if anyone knows of any
actual studies which have investigated in precisely what cases
non-deterministic destruction causes real-world problems. Or, indeed,
anecdotal experience from those with a wider range of experience than my
own.


If you're asking what I think you are, then I have such anecdotal
evidence. About a year ago, I fixed a web application that wouldn't
release a database connection if the user clicked the stop button at a
certain time. This generally didn't cause any problems, since the JDBC
spec requires that finalization will close the connection (a very bad
choice, by the way, which prevented this bug from be discovered in
testing). The app started failing by running out of database
connections when it was sold and installed for a very large customer who
had far more users than were previously seen.

That was with database connections being released in a timely manner
most of the time, and only occasionally being left open in certain
failure cases. I'd hate to see what would've happened if database
connections were never explicitly closed at all!

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
May 2 '06 #276
It's not of being smarter or not....

I am both a C/C++ and JAVA coder :

c is flexible :
this is both a merit and demerit (depending on programmers
capabilities)

Java takes care of this for both lame and stunt performers...

Its simple for those who want to go that way
but for big guys JAVA has much more......

You should not forget that JAVA was the Impetus behind internet ,
this language should be given respect
.....
........and its programmers are not just smart..they are bigger than
that

Bhaskar

May 2 '06 #277

"Chris Smith" <cd*****@twu.ne t> wrote in message
news:MP******** *************** *@news.astraweb .com...
I V <wr******@gmail .com> wrote:
Actually, I've never really had a problem with resources being released
by
GC systems either, but I don't develop the sort of applications where I
would imagine it being a problem. I'd be interested if anyone knows of
any
actual studies which have investigated in precisely what cases
non-deterministic destruction causes real-world problems. Or, indeed,
anecdotal experience from those with a wider range of experience than my
own.


If you're asking what I think you are, then I have such anecdotal
evidence. About a year ago, I fixed a web application that wouldn't
release a database connection if the user clicked the stop button at a
certain time. This generally didn't cause any problems, since the JDBC
spec requires that finalization will close the connection (a very bad
choice, by the way, which prevented this bug from be discovered in
testing). The app started failing by running out of database
connections when it was sold and installed for a very large customer who
had far more users than were previously seen.

That was with database connections being released in a timely manner
most of the time, and only occasionally being left open in certain
failure cases. I'd hate to see what would've happened if database
connections were never explicitly closed at all!


Hehe, okay, in that is Java weakness rather than bad programming? I'm lead
developer of high-concurrency servers and i cant begin to count the number
of times we use JDBC connections and file access. Not once have we ran into
any such issue. Not dealing with all escape paths is simply bad
implementation and certainly not a language weakness, Java just makes that
quite easy at times with the "finally" block....
May 2 '06 #278

"Noah Roberts" <ro**********@g mail.com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .

Remon van Vliet wrote:
I read the entire thread, i understand RAII perfectly.


Obviously not as you are demanding that I reiterate the definition yet
again.

I already repeated myself enough times in this thread. If you don't
like the answer that is fine but the answer is here for you to read in
numerous locations. If you have a question about how something works
then by all means ask.


Hehe, you're rather selective in your post reading, and you continuously
fail to reply to actual posts or the questions mentioned therein. And yes
you repeated yourself way too much in this thread, at some point you may
want to consider moving to actually come up with valid arguments for your
claims. Anyway, i'm going to just let this go and skip over your posts.
May 2 '06 #279

"Luc The Perverse" <sl************ ***********@cc. usu.edu> wrote in message
news:jl******** ****@loki.cmear s.id.au...
"Remon van Vliet" <re***@exmachin a.nl> wrote in message
news:44******** *************** @news.xs4all.nl ...

"Luc The Perverse" <sl************ ***********@cc. usu.edu> wrote in
message news:79******** ****@loki.cmear s.id.au...
"Remon van Vliet" <re***@exmachin a.nl> wrote in message
news:44******** *************** @news.xs4all.nl ...

"Luc The Perverse" <sl************ ***********@cc. usu.edu> wrote in
message news:s6******** ****@loki.cmear s.id.au...
> "Remon van Vliet" <re***@exmachin a.nl> wrote in message
> news:44******** *************** @news.xs4all.nl ...
>>
>> "Chris Smith" <cd*****@twu.ne t> wrote in message
>> news:MP******** *************** *@news.astraweb .com...
>>> 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.
>>>
>>
>> I know, but it's two different things, initialisation isnt in the way
>> of performance and vice versa. That said, i can see how VM
>> initialisation is a limiting factor. Having to wait 5+ seconds kind
>> of shoots applets down as a good option for dynamic web content.
>
> I wonder if running the JVM as a process would eliminate this delay,
> or at least greatly reduce it

I think it sort of is after the first invocation. I cant say for sure
though.

Typically I am opposed to background services running - but if I could
make Java programs initial startup cost go away, I could sacrifice a few
MB.

Does anyone know for sure? (To be honest, java programs interest me
more than applets.)


That's definitely not the case. I was referring to different applets
running in the same browser instance. JVM initialisation also depends on
whether or not you start it in client or server mode. The latter takes
considerbly longer to load.


What advantage does it hold? I plan on writing server applications
(albeit with an anticipated very low user base)

--
LTP

:)


In server mode the VM is way more aggressive when it comes to inlining code
and other things. In short it uses a bit more memory and a lot of
initialisation time to speed up your applications. Make no mistake, in a lot
of cases there's a very noticeable speed difference. I once made a real-time
raytracer in Java just for fun and it doubled speed in the server VM, and
all it really does is some vector math. Server VM can be enabled with SDK
VMs (rather than JRE) and using the -server command line parameter. I
suggest you write a small CPU intensive program and check out the
difference. Hope this helps.

Remon
May 2 '06 #280

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
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
10785
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
9603
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
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
6025
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4644
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
4249
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.