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 20786 http://c2.com/cgi/wiki?RubyVsJava
By the way, if i may add, i dont know who submitted the language comparison
articles for that wiki but it is littered with information that simply is
not true.
"Timo Stamm" <ti********@arcor.de> wrote in message
news:44***********************@newsread4.arcor-online.net... Remon van Vliet schrieb: "Timo Stamm" <ti********@arcor.de> wrote in message news:44**********************@newsread2.arcor-online.net... Oliver Wong schrieb: "Timo Stamm" <ti********@arcor.de> wrote in message news:44***********************@newsread4.arcor-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.
Well it's worth noting that the VM initialisation is what's causing the
delay, and that only happens once. Actually loading and starting the Applet
(at least on my system) is a matter of a second or slight more.
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.
Oh yes? That surprises me, i've always assumed Flash to be faster if you're
going for the same graphical quality, especially where antialiasing is
involved. Interesting stuff.. Computing performance of Java is far superior. Even with the upcoming version of the player that was rewritten from scratch.
Yeah i thought so
"Chris Smith" <cd*****@twu.net> wrote in message
news:MP************************@news.astraweb.com. .. Remon van Vliet <re***@exmachina.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.
"Phlip" <ph*******@gmail.com> wrote in message
news:Gg*****************@newssvr24.news.prodigy.ne t... Remon van Vliet wrote:
http://c2.com/cgi/wiki?RubyVsJava
By the way, if i may add, i dont know who submitted the language comparison articles for that wiki but it is littered with information that simply is not true.
Use the Edit button and fix it.
Hehe, fair enough, but i dont really care either way, just figured i'd point
it out for those that use it as a reference.
"Remon van Vliet" <re***@exmachina.nl> wrote in message
news:44***********************@news.xs4all.nl... "Chris Smith" <cd*****@twu.net> wrote in message news:MP************************@news.astraweb.com. .. Remon van Vliet <re***@exmachina.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
--
LTP
:)
On Mon, 01 May 2006 18:16:24 +0200, Remon van Vliet wrote: 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.
The issue isn't memory. The issue is other resources which are in short
supply, or which may not get cleaned up automatically by the OS, or which
you need to ensure are cleaned up as quickly as possible - database
connections, perhaps, or shared resources in a windowing system, or
mutexes. In other words, things for which you would use the dispose
pattern in Java.
Don't think of RAII as a way to manage memory (it is used for that, but if
C++ had GC, RAII for memory management would be a lot less important),
think of it as a way of automating the dispose pattern.
"Remon van Vliet" <re***@exmachina.nl> wrote in message
news:44***********************@news.xs4all.nl... "Timo Stamm" <ti********@arcor.de> wrote in message news:44***********************@newsread4.arcor-online.net... Remon van Vliet schrieb: 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.
Well it's worth noting that the VM initialisation is what's causing the delay, and that only happens once. Actually loading and starting the Applet (at least on my system) is a matter of a second or slight more.
I was a bit surprised at the 5 second figure I arrived at as well. This
was done basically by holding my wrist watch up to the screen, and taking
the "start time" to be when I saw the HTML rendered, and the "end time" to
be once I saw the applet/flash actually running. My watch only has 1 second
precision, and my reaction time as a human may have been a factor, but I
think I was accurate to within, say, 0.7 of a second.
AFAIK, I didn't have load any applets during that instance of FireFox. I
had Eclipse and jEdit running in the background, but I'd be surprised if
Firefox could somehow "share" the VM with them.
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.
Oh yes? That surprises me, i've always assumed Flash to be faster if you're going for the same graphical quality, especially where antialiasing is involved. Interesting stuff..
I also assumed Flash would be faster for the graphics stuff. Flash has a
3D API too, doesn't it?
- Oliver
"Noah Roberts" <ro**********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com... Oliver Wong wrote:
FWIW, in my experience, Flash is not "much quicker".
Here's your half penny...payment for services rendered...
Thanks. The future of ecommerce is all about micro payments.
Now if I could only average a billion transactions a day like this.
- Oliver
"I V" <wr******@gmail.com> wrote in message
news:pa****************************@gmail.com... On Mon, 01 May 2006 18:16:24 +0200, Remon van Vliet wrote: 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.
The issue isn't memory. The issue is other resources which are in short supply, or which may not get cleaned up automatically by the OS, or which you need to ensure are cleaned up as quickly as possible - database connections, perhaps, or shared resources in a windowing system, or mutexes. In other words, things for which you would use the dispose pattern in Java.
Don't think of RAII as a way to manage memory (it is used for that, but if C++ had GC, RAII for memory management would be a lot less important), think of it as a way of automating the dispose pattern.
I'll take your word for it, but his argument was that having exact control
over memory usage is somehow an advantage.
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.
Reusable resources are usually pooled and cleanly released when necessary,
and i cant really think of any other kind of resource that would cause
issues. In fact i cant even recall a single case of resource leak in my
entire Java career, and i dont exactly believe that's due to above average
skill, it simply comes with Java, or is avoided by using Java.
"Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message
news:s6************@loki.cmears.id.au... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl... "Chris Smith" <cd*****@twu.net> wrote in message news:MP************************@news.astraweb.com. .. Remon van Vliet <re***@exmachina.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.
"Oliver Wong" <ow***@castortech.com> wrote in message
news:y_s5g.17$W6.8@edtnps89... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl... "Timo Stamm" <ti********@arcor.de> wrote in message news:44***********************@newsread4.arcor-online.net... Remon van Vliet schrieb:
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. Well it's worth noting that the VM initialisation is what's causing the delay, and that only happens once. Actually loading and starting the Applet (at least on my system) is a matter of a second or slight more.
I was a bit surprised at the 5 second figure I arrived at as well. This was done basically by holding my wrist watch up to the screen, and taking the "start time" to be when I saw the HTML rendered, and the "end time" to be once I saw the applet/flash actually running. My watch only has 1 second precision, and my reaction time as a human may have been a factor, but I think I was accurate to within, say, 0.7 of a second.
AFAIK, I didn't have load any applets during that instance of FireFox. I had Eclipse and jEdit running in the background, but I'd be surprised if Firefox could somehow "share" the VM with them.
Hm, maybe FireFox starts the VM on startup? I have no idea..
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.
Oh yes? That surprises me, i've always assumed Flash to be faster if you're going for the same graphical quality, especially where antialiasing is involved. Interesting stuff..
I also assumed Flash would be faster for the graphics stuff. Flash has a 3D API too, doesn't it?
So does Java though...sort of (Java3D)
Oliver Wong schrieb: "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl... "Timo Stamm" <ti********@arcor.de> wrote in message news:44***********************@newsread4.arcor-online.net... Remon van Vliet schrieb: 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.
Oh yes? That surprises me, i've always assumed Flash to be faster if you're going for the same graphical quality, especially where antialiasing is involved. Interesting stuff..
I also assumed Flash would be faster for the graphics stuff. Flash has a 3D API too, doesn't it?
No, there is no 3D API :(
Antialising is a good point. I am not sure whether Applets can compete
at that.
But overall graphics performance is not as good as one might think from
seeing flash movies on the web. They mostly run at 12 FPS (default
setting) instead of 25-50 (what I would choose in an Applet).
Timo
Remon van Vliet wrote: *SNIP*
That comparison is quite a stretch. GC is, as far as I know and as far as Java implements it, totally unaccessable to the programmer. Can you force the GC to delete anything? 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.
Does that mean it works if the programmer doesn't work? No. But it means that RAII _can_ be depended on to perform the actions it has been described so long as the programmer does their job. Requiring correct code is not unreasonable and in reality RAII is quite effective at keeping a lot of bugs out of code so long as it is followed.
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.
You are comming in rather late and/or don't have the knowledge to
understand what I am talking about.
Look up what RAII is and what it is used for, or read this thread where
it is spoken of quite a bit.
Then you will understand what I am talking about above.
Remon van Vliet wrote: I'll take your word for it, but his argument was that having exact control over memory usage is somehow an advantage.
Actually, my argument is pretty clearly that knowing exactly when an
object is destroyed is somehow an advantage. Direct control over when
it occurs or not, knowing when and being able to guarantee that
behavior is very adventageous.
"Remon van Vliet" <re***@exmachina.nl> wrote in message
news:44***********************@news.xs4all.nl... "Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message news:s6************@loki.cmears.id.au... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl... "Chris Smith" <cd*****@twu.net> wrote in message news:MP************************@news.astraweb.com. .. Remon van Vliet <re***@exmachina.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.)
--
LTP
:)
Noah Roberts wrote: Look up what RAII is and what it is used for, or read this thread where it is spoken of quite a bit.
Or read the huge multi-thread conversation regarding GC, deterministic
destruction, and the general proposal to add a 'finally' keyword to C++
that ran for the last 2 months at news:comp.lang.c++.moderated .
"There's enough material there for an entire conference" --Fawlty Towers
--
Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
In comp.lang.java.advocacy, Oliver Wong
<ow***@castortech.com>
wrote
on Mon, 01 May 2006 17:16:27 GMT
<Lnr5g.9$W6.1@edtnps89>: "Timo Stamm" <ti********@arcor.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.
I think part of the problem may be the loading of the
jar files for the applet. Java initialization, after
all, is not perceptible in the browser proper, though
the 1.5 version does show a "load in progress" screen,
which is an improvement over a mostly blank gray screen
in earlier versions.
Does your figure include the jar file loading?
In any event, ArcTest might have taken for me 4 seconds to bring up
something, and 1 more second to show an arc.
The RollerMouse demo took 6 seconds to come up and maybe 2-3 seconds to
load.
I'm thinking Internet time variance, or maybe server issues. - Oliver
--
#191, ew****@earthlink.net
Windows Vista. Because it's time to refresh your hardware. Trust us.
"Noah Roberts" <ro**********@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com... Remon van Vliet wrote:
I'll take your word for it, but his argument was that having exact control over memory usage is somehow an advantage.
Actually, my argument is pretty clearly that knowing exactly when an object is destroyed is somehow an advantage. Direct control over when it occurs or not, knowing when and being able to guarantee that behavior is very adventageous.
Because?
"Noah Roberts" <ro**********@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com... Remon van Vliet wrote: *SNIP*
> That comparison is quite a stretch. GC is, as far as I know and as far > as Java implements it, totally unaccessable to the programmer. Can you > force the GC to delete anything? 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.
> > Does that mean it works if the programmer doesn't work? No. But it > means that RAII _can_ be depended on to perform the actions it has been > described so long as the programmer does their job. Requiring correct > code is not unreasonable and in reality RAII is quite effective at > keeping a lot of bugs out of code so long as it is followed.
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.
You are comming in rather late and/or don't have the knowledge to understand what I am talking about.
Look up what RAII is and what it is used for, or read this thread where it is spoken of quite a bit.
Then you will understand what I am talking about above.
I read the entire thread, i understand RAII perfectly. If you're stuck on
personal sneers rather than actually coming up with practical issues you
seem to have with Java i'm just gonna give up on you. All you do is run
around claiming control over X or Y is a good thing, without bothering to
explain why, or replying to posts that explain why it isnt a good thing.
"Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message
news:79************@loki.cmears.id.au... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl... "Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message news:s6************@loki.cmears.id.au... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl...
"Chris Smith" <cd*****@twu.net> wrote in message news:MP************************@news.astraweb.com. .. > Remon van Vliet <re***@exmachina.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.
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.
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.
"Remon van Vliet" <re***@exmachina.nl> wrote in message
news:44***********************@news.xs4all.nl... "Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message news:79************@loki.cmears.id.au... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl... "Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message news:s6************@loki.cmears.id.au... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl... > > "Chris Smith" <cd*****@twu.net> wrote in message > news:MP************************@news.astraweb.com. .. >> Remon van Vliet <re***@exmachina.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
:)
Oliver Wong wrote: "Timo Stamm" <ti********@arcor.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.
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
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
"Chris Smith" <cd*****@twu.net> 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....
"Noah Roberts" <ro**********@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.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.
"Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message
news:jl************@loki.cmears.id.au... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl... "Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message news:79************@loki.cmears.id.au... "Remon van Vliet" <re***@exmachina.nl> wrote in message news:44***********************@news.xs4all.nl...
"Luc The Perverse" <sl***********************@cc.usu.edu> wrote in message news:s6************@loki.cmears.id.au... > "Remon van Vliet" <re***@exmachina.nl> wrote in message > news:44***********************@news.xs4all.nl... >> >> "Chris Smith" <cd*****@twu.net> wrote in message >> news:MP************************@news.astraweb.com. .. >>> Remon van Vliet <re***@exmachina.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
Oliver Wong wrote: Windows XP with SP2, Pentium 4 1.8Ghz, 1024MB RAM, Firefox 1.5.0.2.
Java took 3 seconds, Flash took 5 seconds.
That sounds wrong to me. Did your browser already have a JVM started (as is
likely if -- for example -- you'd visited Roedy's site since you last killed
all your Firefox windows) ?
FWIW, Flash is instant on my WinXP + Firefox settup -- I won't have Flash
installed so it fails without noticeable delay ;-)
-- chris
"Remon van Vliet" <re***@exmachina.nl> wrote in
news:44***********************@news.xs4all.nl: "Chris Smith" <cd*****@twu.net> 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....
While what you say IS true, you should handle all escape paths, I do have
to agree that RAII(or should we focus on the other end, RDIF Resource
Diallocation is Finalization) often makes it easier to handle all escape
paths. It is common in C++ to create a class on the stack that
locks/unlocks/opens a resource during construction and returns it to its
original state in its destructor. Having done so you can forget about it.
No need to deal with it at all when the method using it exits. Even
during exceptions. You know the destructor will have been called once you
are out and all will be as it was.
When I work with Java I often miss the ease deterministic destructors
provide. And I also sometimes miss 'finally' and anonymous classes when
programming in C++.
RAII is a tool. You don't need it but it does make things a lot easier
when its can be used.
Otis
ebhakt wrote: 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
No, the american military and the threat of nuclear war was the impetus
behind the internet, which started coming into being at the tail of of
the 60s. Java didn't exist until the 90's.
Remon van Vliet schrieb: "Chris Smith" wrote: 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.
The same argument could be used for unmanaged memory allocation. In that
sense, memory leaks are the result of bad programming, not a weakness of
the language.
Timo
Otis Bricker wrote: RAII is a tool. You don't need it but it does make things a lot easier when its can be used.
There it is.
"Chris Uppal" <ch*********@metagnostic.REMOVE-THIS.org> wrote in message
news:44*********************@news.gradwell.net... Oliver Wong wrote:
Windows XP with SP2, Pentium 4 1.8Ghz, 1024MB RAM, Firefox 1.5.0.2.
Java took 3 seconds, Flash took 5 seconds.
That sounds wrong to me. Did your browser already have a JVM started (as is likely if -- for example -- you'd visited Roedy's site since you last killed all your Firefox windows) ?
No. I retested just now (quit firefox, went into task manager to make sure
no hidden firefox.exe process was running), and got a similar result
(between 2 and 3 seconds). I do have Eclipse running in the background, but
as I mentioned earlier, I doubt Firefox is sharing the JVM with Eclipse.
- Oliver
ebhakt wrote: It's not of being smarter or not....
I am both a C/C++ and JAVA coder :
There is NO C/C++ language.
There is the C Language and the C++ language. There are compilers that
will compile source files from both languages - but there is no C/C++
language.
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
what are you talking about?
.... .......and its programmers are not just smart..they are bigger than that
Bhaskar
Roedy Green wrote: On 28 Apr 2006 00:59:19 -0700, "al pacino" <si*************@gmail.com> wrote, quoted or indirectly quoted someone who said :
improve your programming skills and what better tool to do that than using c++.
You might find the work of W. Edwards Deming interesting. He was the man who taught the art of quality control to the Japanese.
He argues there is no point in exhorting people to be better. You have to change the environment so they naturally and without additional effort produce better results.
This is insightful, and in my experience, correct. C++ has a problem in
that the 'right' way to do things is significantly more work than the
'wrong' way. For example, instead of:
int a[3];
I am supposed to write:
#include <vector>
vector<int> a(10);
If one expects people in general to write better programs, the
programming language should be designed so that the straightforward,
simpler expression is the right one. Doing the wrong thing should
require more work.
This principle is evident in things like power tools and aircraft
design. In the former, you've got to do extra work to remove things like
guards and safety interlocks. In aircraft design, one of the terrible
no-no's is for a mechanic hook up the flight controls backwards. So the
designers go to great lengths to make it very hard for the mechanic to
do so, hopefully hard enough so that at some point the mechanic realizes
he must be doing something wrong. If it's easy to install the flight
controls backwards, sooner or later it will be, with deadly consequences.
-Walter Bright www.digitalmars.com C, C++, D programming language compilers
"Walter Bright" <wa****@digitalmars-nospamm.com> wrote in message
news:co********************@comcast.com... If one expects people in general to write better programs, the programming language should be designed so that the straightforward, simpler expression is the right one. Doing the wrong thing should require more work.
This principle is evident in things like power tools and aircraft design. In the former, you've got to do extra work to remove things like guards and safety interlocks. In aircraft design, one of the terrible no-no's is for a mechanic hook up the flight controls backwards. So the designers go to great lengths to make it very hard for the mechanic to do so, hopefully hard enough so that at some point the mechanic realizes he must be doing something wrong.
I go through this experience all the time, e.g. when trying to assemble
furniture. It's incredibly difficult (e.g. the male connector will not fit
into the female connector, even if I try slam my entire body mass,
accelerated by gravity, to force them together), so I wonder if I'm doing
something wrong, but I'm staring at the assembly diagram (all pictures, no
words, supposedly in the interest of i18n), and I can't find any other
reasonable interpretation of the instructions than the one I was following
thus far.
I eventually end up with a working piece of furniture (e.g. if it's a
chair, then yes, you can sit on it; a table, yes, you can place items on
it), but inevitably, there are spare parts, and the box that the furniture
came in is just plain indescript brown cardboard, with no "real life"
picture to compare against to see if I got it right.
- Oliver
"Andrew McDonagh" <ne**@andmc.com> wrote in message
news:e3**********@news.freedom2surf.net... ebhakt wrote: I am both a C/C++ and JAVA coder :
There is NO C/C++ language.
There is the C Language and the C++ language. There are compilers that will compile source files from both languages - but there is no C/C++ language.
Perhaps "C/C++" is C++ "spoken" with a C "accent".
- Oliver
In comp.lang.java.advocacy, Andrew McDonagh
<ne**@andmc.com>
wrote
on Tue, 02 May 2006 19:42:45 +0100
<e3**********@news.freedom2surf.net>: ebhakt wrote: It's not of being smarter or not....
I am both a C/C++ and JAVA coder :
There is NO C/C++ language.
There is the C Language and the C++ language. There are compilers that will compile source files from both languages - but there is no C/C++ language.
No, but C++ will accept most of Ansi C, and gcc compiles both,
as well as Objective-C.
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 what are you talking about?
Indeed; I'm not sure C was all that extant when the
Internet was first formulated in the late 1960's, though
it wasn't long after -- never mind C++, Java, and C#.
Of course Java goes well with the Internet, and is
probably responsible for a goodly chunk of modern server
implementation code and the occasional applet. However,
Mosaic and NCSA came first, and FTP, telnet, and rsh
before them.
.... .......and its programmers are not just smart..they are bigger than that
Bhaskar
--
#191, ew****@earthlink.net
Windows Vista. Because it's time to refresh your hardware. Trust us.
In comp.lang.java.advocacy, Walter Bright
<wa****@digitalmars-nospamm.com>
wrote
on Tue, 02 May 2006 11:47:54 -0700
<co********************@comcast.com>: Roedy Green wrote: On 28 Apr 2006 00:59:19 -0700, "al pacino" <si*************@gmail.com> wrote, quoted or indirectly quoted someone who said :
improve your programming skills and what better tool to do that than using c++. You might find the work of W. Edwards Deming interesting. He was the man who taught the art of quality control to the Japanese.
He argues there is no point in exhorting people to be better. You have to change the environment so they naturally and without additional effort produce better results.
This is insightful, and in my experience, correct. C++ has a problem in that the 'right' way to do things is significantly more work than the 'wrong' way. For example, instead of:
int a[3];
I am supposed to write:
#include <vector>
vector<int> a(10);
I'm not entirely sure of this. Ideally, of course, int
a[3]; would allow for constructs such as Java's .length,
although a workaround might be to use
#define Nsize(a) ( sizeof(a)/sizeof(*(a)) )
or some such. But it's a bit of an ugly mess, and party
because of C's "attitude of convenience" regarding arrays
and pointers.
In short, int *b = a; is a perfectly legal assignment in C,
and it's far from clear that it should be, but presumably
nobody wanted to write int * b = &a[0] instead way back
when, or incur extra overhead in passing the length around.
(For its part Java doesn't even have this issue, since it
has neither of C's unary '*' (pointer dereference) nor '&'
(address of) operators.)
In the case of int a[3]; the array size is quite fixed,
unlike the vector, which is variably sized but potentially
incurs an extra page fault thereby. (There might be a way
around that using an allocator but I'd have to look.)
Java has a vaguely similar problem, and in fact a vaguely
similar syntax:
import java.util.Vector;
Vector<Integer> a = new Vector<Integer>();
as of Java 5, anyway. If one expects people in general to write better programs, the programming language should be designed so that the straightforward, simpler expression is the right one. Doing the wrong thing should require more work.
If one can achieve consensus on the term "wrong" in this context.
Both constructs have issues; the int a[3]; allows for fast access but
nonextensibility; vector<int> a; has slightly slower access but
can dynamically extend the array as necessary (however, be careful
of constructs such as &a[4] in the latter case; the rug might
very well vanish from under you!). This principle is evident in things like power tools and aircraft design. In the former, you've got to do extra work to remove things like guards and safety interlocks. In aircraft design, one of the terrible no-no's is for a mechanic hook up the flight controls backwards. So the designers go to great lengths to make it very hard for the mechanic to do so, hopefully hard enough so that at some point the mechanic realizes he must be doing something wrong. If it's easy to install the flight controls backwards, sooner or later it will be, with deadly consequences.
Murphy was an optimist. :-)
-Walter Bright www.digitalmars.com C, C++, D programming language compilers
--
#191, ew****@earthlink.net
Windows Vista. Because it's time to refresh your hardware. Trust us.
The Ghost In The Machine wrote: In comp.lang.java.advocacy, Andrew McDonagh <ne**@andmc.com> wrote on Tue, 02 May 2006 19:42:45 +0100 <e3**********@news.freedom2surf.net>: ebhakt wrote: It's not of being smarter or not....
I am both a C/C++ and JAVA coder : There is NO C/C++ language.
There is the C Language and the C++ language. There are compilers that will compile source files from both languages - but there is no C/C++ language.
No, but C++ will accept most of Ansi C, and gcc compiles both, as well as Objective-C.
Yes I said this about the compilers....
Phlip wrote: Ruby:
- No comment. Do agree on the syntax point from the little I've worked
with it.
Java:
- No comment. One positive aspect is their uniformity (one lib).
Negative aspect is that sometimes one needs bare-bones. They've also
dropped some good features in C++ (No comment on D just yet).
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.
- the only smart pointer that could pass the 97 committee was one so primitive and broken that its copy constructor changes the copied-from object!
Yes, a very, very handy feature. Especially for passing buffers from
lower layers to application layers. Passing data from one thread to
another etc. Certainly used often by me. But hey, long since 97, aint
it.
- mutable; because constancy is enforced at compile time, not runtime, yet it _could_ exploit hardware support
Because logic and physical constness is 2 different things.
- strings, strings, and more strings. The ISO Standard string came so late in the language's history that every serious library has its own (multiple) string classes
Agreed. How about writing your own :->. You can!
- what the >F---< does imbue() do???
Admittedly, I've used it <iostreams> less often. Others consider it
very scalable. To extend a good book is required, but very extensible.
- void main is neither illegal nor legal! Some, but not all, compiler-specific extensions use a __ prefix
Hmmm, I think most of them are working towards confomance.
- of course RAII can be better than redundant finally blocks. But _all_ these systems are cheap imitations of the Execute Around Pattern, which requires block closures, so objects can clean themselves up, exception- safely, deterministically, and _without_ elaborate destructors
I wonder which came first.
- 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 reinvented language could make better use of modern compiler technology
Yes, your humbleness ...
- teachers, bosses, and colleagues make us use the language because it's popular, even for inappropriate situations. This newsgroup gets a dozen questions per month asking how to do something that a scripting language can do
Often trivial examples are used to solve more complex problems. Given
the trivial example, readers don't need to focus on the unnecessary.
Obviously they (the trivial examples) can be performed using scripts
too, but they fit into a bigger picture/application, therefore your
point is?
- you can do an "Applet" in C++ trivially, using ActiveX. And because C++ has no security model to speak of, anyone using your applet exposes their browser to gawd-knows-what-else is out there...
No comment, mainly because I don't write applets.
- how many here have _ever_ written a program with _absolutely_ no undefined behavior? How many _know_ they did??
Yes, you have a point. Many libraries do exists that has been ported to
various (umpteen) platforms, though. Tested and working... Testing is
knowing. This is not only due to language imperfection, but due to
human imperfection (you could even make mistakes with perfect languages
- not meeting user requirements). The most imperfect humans of course
are those that believe they are perfect. Do you fall into that
category, your humbleness? :-)
- when folks say C++ is portable, they mean the _compiler_ ports easily to other platforms. By marrying your statements to the metal, a C++ implementation forces you to consider _endless_ portability issues at port time
Blah, blah...
- the exception handling model is so complex it makes me wonder if Bjarne Stroustrup actually determined how to write exception-safe programs when he invented the language
I can only disagree with this one. But what do you suggest? You can
only criticise if you have a better alternative (Philips language,
whoa!). Better start implementing, that others like you can start
critting.
Hah, hah, hah (Feel like I'm feeding a troll).
Werner
The Ghost In The Machine wrote: In comp.lang.java.advocacy, Walter Bright <wa****@digitalmars-nospamm.com> wrote on Tue, 02 May 2006 11:47:54 -0700 <co********************@comcast.com>: Roedy Green wrote: On 28 Apr 2006 00:59:19 -0700, "al pacino" <si*************@gmail.com> wrote, quoted or indirectly quoted someone who said :
improve your programming skills and what better tool to do that than using c++.
You might find the work of W. Edwards Deming interesting. He was the man who taught the art of quality control to the Japanese.
He argues there is no point in exhorting people to be better. You have to change the environment so they naturally and without additional effort produce better results. This is insightful, and in my experience, correct. C++ has a problem in that the 'right' way to do things is significantly more work than the 'wrong' way. For example, instead of:
int a[3];
I am supposed to write:
#include <vector>
vector<int> a(10);
I'm not entirely sure of this. Ideally, of course, int a[3]; would allow for constructs such as Java's .length, although a workaround might be to use
#define Nsize(a) ( sizeof(a)/sizeof(*(a)) )
or some such. But it's a bit of an ugly mess, and party because of C's "attitude of convenience" regarding arrays and pointers.
You have arrays when you want and vectors when you want. A std::vector
isn't always warranted. Sure, 99% of the time that is what you want,
but not always. In short, int *b = a; is a perfectly legal assignment in C, and it's far from clear that it should be, but presumably nobody wanted to write int * b = &a[0] instead way back when, or incur extra overhead in passing the length around.
Either you are passing around a length or you are somehow finding the
end each time. Java can be no different in this area even if the
language might hide that fact from you. If one expects people in general to write better programs, the programming language should be designed so that the straightforward, simpler expression is the right one. Doing the wrong thing should require more work.
If one can achieve consensus on the term "wrong" in this context. Both constructs have issues; the int a[3]; allows for fast access but nonextensibility; vector<int> a; has slightly slower access but can dynamically extend the array as necessary (however, be careful of constructs such as &a[4] in the latter case; the rug might very well vanish from under you!).
You've of course profiled this so lets see the result...
Mishagam wrote: I think the fact that nobody uses D means suggests that it has not only one stupid feature, but a lot of stupid features.
For a stupid language nobody uses, the D programming language is doing
remarkably well, having moved up to number 19 on http://www.tiobe.com/tpci.htm
<g>
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. http://c2.com/cgi/wiki?MicrosoftSampleCode
People are learning that technology in their lives that fails the most often
is software. And C++ is leading the charge.
--
Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
"Walter Bright" <wa****@digitalmars-nospamm.com> wrote in message
news:ia******************************@comcast.com. .. Mishagam wrote: I think the fact that nobody uses D means suggests that it has not only one stupid feature, but a lot of stupid features.
For a stupid language nobody uses, the D programming language is doing remarkably well, having moved up to number 19 on http://www.tiobe.com/tpci.htm
(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.
- Oliver
In comp.lang.java.advocacy, Noah Roberts
<ro**********@gmail.com>
wrote
on 2 May 2006 14:38:03 -0700
<11*********************@y43g2000cwc.googlegroups. com>: The Ghost In The Machine wrote:
[snippage] If one can achieve consensus on the term "wrong" in this context. Both constructs have issues; the int a[3]; allows for fast access but nonextensibility; vector<int> a; has slightly slower access but can dynamically extend the array as necessary (however, be careful of constructs such as &a[4] in the latter case; the rug might very well vanish from under you!).
You've of course profiled this so lets see the result...
I have not; the considerations are theoretical. However,
the implementation of std::vector<...>::push_back() on my
system (gcc 3.4.5) includes a call to
_M_insert_aux(end(), __x), which among other things calls
_M_allocate(2 * size()), to allocate a bigger chunk, and
_M_deallocate() on the existing storage.
This makes constructs such as b = &a[4] dangerous if one
holds onto b for too long and also inserts additional
stuff into a. One would hope most reasonable coders wouldn't
do that, of course, but anyone who's seen Jeff Relf's code
(or a facsimile thereof) has to wonder. :-)
It is barely possible that a very smart compiler might
have equivalent code for the sequences:
a[0] = 1;
a[n-1] = 2;
except for a single register load (in the case of std::vector<> the
field value _M_start). However, I'd have to experiment.
--
#191, ew****@earthlink.net
Windows Vista. Because it's time to refresh your hardware. Trust us.
In comp.lang.java.advocacy, Andrew McDonagh
<ne**@andmc.com>
wrote
on Tue, 02 May 2006 21:04:49 +0100
<e3**********@news.freedom2surf.net>: The Ghost In The Machine wrote: In comp.lang.java.advocacy, Andrew McDonagh <ne**@andmc.com> wrote on Tue, 02 May 2006 19:42:45 +0100 <e3**********@news.freedom2surf.net>: ebhakt wrote: It's not of being smarter or not....
I am both a C/C++ and JAVA coder :
There is NO C/C++ language.
There is the C Language and the C++ language. There are compilers that will compile source files from both languages - but there is no C/C++ language.
No, but C++ will accept most of Ansi C, and gcc compiles both, as well as Objective-C.
Yes I said this about the compilers....
Yes you did. :-) Oops.
--
#191, ew****@earthlink.net
Windows Vista. Because it's time to refresh your hardware. Trust us. 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...
|
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...
| |
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...
|
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...
|
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 =
...
|
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...
|
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. ...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: 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...
| |