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

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


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

....Can D treat classes as objects?

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

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

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


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


snipped brilliantly researched response.

v cool TJW.


100% ACK

Andrey

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

Apr 28 '06 #202

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

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


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


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

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

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


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

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

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

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

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

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

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

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

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

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

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


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


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

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

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

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

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

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

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

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

Java:

C++ (deep breath):


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

Long live the PDP11 !

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


Newbie: Why do I have to define classes twice?

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

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

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


They already make that joke on their web page.

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

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

Mishagam skrev:
Noah Roberts wrote:

[snip]
Third...COM is not C++, it is a MS specific standard of coding a set of
functionality in ANY language that can be used from ANY language
capable of interacting with COM. I do believe Java can be counted
among them but of course any such program instantly looses any platform
independance.

I programmed on COM on C/C++, and all COM procedures use HRESULT as
error code. Other often used COM Language is VB, where error codes
apparently are somehow hidden - I don't know VB very well. Java cannot
directly use COM, probably there exist JNI Libraries allowing
communications Java <-> COM through native calls.

This is absurd. If you program against a COM interface you use a
HRESULT. This is so in ANY language - even Java. Unless Java does not
support COM programming, of course.

Finally, if you don't know then your doubts are meaningless.


/Peter

Apr 29 '06 #211
Alex Buell wrote:
On Thu, 27 Apr 2006 16:07:01 -0700 Walter Bright
<wa****@digitalmars-nospamm.com> waved a wand and this message
magically appeared:
Language design is complicated, with lots of tradeoffs. I don't know
any language that doesn't contain at least one stupid feature its
designer should have known better about.


OK, are there any stupid features in D? ;o)

It is not honest to ask about stupid feature of language nobody knows
much about.
Everybody knows about C++ stupid features, because it had it's period of
fame when everybody programmed on it. The same for Java.
I think the fact that nobody uses D means suggests that it has not only
one stupid feature, but a lot of stupid features.
Apr 29 '06 #212
Noah Roberts wrote:
Mishagam wrote:
Noah Roberts wrote:
Mishagam wrote: f) You don't have to choose between char *, string, CString ... - String
is better (or same) than either of them and it is only choice.
Actually, you are in err. Java also has char[] and there is nothing
stopping someone from using it or designing a new String. Therefor
Java suffers from the same "problem" as C++ here except there are no
Java functions and tools to work with char[]...you have to write them
from scratch. Yes, you can use char[] (or byte[]), but as you said it has no support,
so nobody uses it (as opposed to String, which is more heavily supported
than any C/C++ strings version). It is VERY rare Java programmer who
would spend time deciding which string representation to use. Everybody
just uses String. And the beauty it - it is really very close to optimal
choice. (as opposed too, for example, original Pascal strings)


Interesting statement. Just how close, in quantifiable values, to
optimal is it then? Also, optimal in what way?

For strings main feature is convenience. You can easily define strings,
you can easily make operations, especially concatenations, with strings.
You don't bother about allocating pieces of string. You can use strings
as keys. You can easily convert other type to strings, and simple types
from strings. Strings should be efficient.
C char * strings are very fast, have decent support and great
improvement over Pascal strings (not to mention Fortran), especially
because of sprintf / sscanf functions, but you always have to bother
where to allocate strings, and C strings are not safe.
STL string and CString are slower than C, but safe. They have some
support, but Java strings are supported better. You also always have to
choose which string to use, and different programs and libraries use
different strings. For example, part of pain of COM programming on
Windows was very frequent need to convert strings from one format to
another.
So Java String look better than any C/C++ strings version. This is what
I call close to optimal.
g) you don't have to choose between long int, unsigned int, WORD, DWORD,
size_t .... - close to optimal choice if forced on you.
h) You don't decide do you use internal or external functions
definitions, or do you use macro. - close to optimal choice if only one
possible.
i) You don't have to decide if you use methods or define new operators.
Java choice is sometimes more verbose, but usually more clear.
...
As you can guess, I can continue.
Yes, but all the benefits you are listing are things you *can't* do and
the things forced upon you. Where are the list of things you *can* do?
You make Java sound like a jail sentance. Yes, it COULD easily become jail. The beauty of Java is that all choices
are made so clever, that they are very close to optimal, and (I am sure
for me) that advantage of not having to think about alternatives
overweights possible gains from other choices.
It also makes different pieces of software much more compatible.


Cleverness is subjective. IMHO a lot of choices in Java where rather
dumb.

"Very close to optimal"...that seems like a fluff statement to me but
if you can quantify it I'll place more value in it.

Not having any choices doesn't seem to me to be that great.

I'm still looking for the can. You listed all the thing Java *can't*
do but haven't come with anything it can. I don't see much advantage
in *can't*.

Generally you can do anything on any general purpose computer language.
I can say you can write safe programs on Java, you can do GC on Java.
There is also very long list of things that is more easy to do on Java
(almost everything). For example.
Connect to databases.
Use http connections, requests and responses.
Write string to clipboard.
Write servlet (comparing to use CGI programs or ISAPI module).
and so on.

Apr 29 '06 #213
Bent C Dalager wrote:

Interestingly, of course, while there are no CPUs that support C++
instructions natively (that I know of anyway), there are those that
support Java bytecode natively. The conclusion being that while it is
possible to have a pure Java system, it is not possible to have a pure
C++ system :-)

Because C++ is compiled language, and has no defined intemediate
language, it is very difficult to see what Computer that "support C++
instructions natively" should look like. For Java there is defined
bytecode and so you can make computer to run this bytecode directly.
This doesn't mean that Java is better, but it does mean that speed
advantage of C++ wouldn't exist (it if still exists with modern JIT JVM)
on such computers.
Apr 29 '06 #214
Phlip wrote:
Ian Collins wrote:

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

Newbie: Why do I have to define classes twice?

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

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

Because it makes then easier to read?

I've been doing a lot of PHP lately and the biggest problem I have is
not being able to see all of the methods on one page. So I end up
creating an interface for each class as a documentation tool.

--
Ian Collins.
Apr 29 '06 #215

Mishagam skrev:

[snip]
I understand that RAII is basically use automatically called
destructor's to dispose resources? That is correct. When the lifetime of an object, its destructor is
automatically called. I do not need to say that this is regardless of
whether an exception is thrown or not. I agree it is useful where it can be
used.
It works if you work with objects as values, it doesn't work if you work
with pointers or references. This is correct - and it should not work in such cases. In such cases destructor can easily leave
dangling pointer. I do not know that statement. If you work with references you are on your own, or
have to duplicate something like reference counting or Java GC. Replace references with pointers here and I agree. I don't
think you can work without using references in big program. (I assume again that you mean pointers here.)You surely can. Modern C++
uses almost no raw pointers. Instead it uses objects called smart
pointers and these could well rely on reference counting. I think because of this STL mostly works (in examples) with value
elements, and this creates a lot of problems - you cannot place
descended class objects were you can place base objects, you have to
deal with constructors, destructor's, copy constructors called in
strange places, you waste memory and so on. STL is value-based and rightly so in my opinion. For places where
value-based objects don't fit (your example with a container that
should hold elements of a type or descendants of that type), you simply
store a smart pointer. Also, you have to have
different generated code for different objects and use templates. This is partly true. By having different code generated for each type
you get far better runtime performance so this is a good thing. As an
example, the sort in C++ is three times faster than the C qsort for
double. This is primarily a result of having code inlined.
Still, sometimes code might be shared across different template-types.
E.g. std::vector<int> could share much of its code with
std::vector<unsigned>. And in
Java one Collections library works OK with any object.

If you do not use Java generics you basically end up with runtime type
checks. This is not nice.

/Peter

Apr 29 '06 #216
TJW

Andrew McDonagh <ne**@andmc.com> writes:
TJW wrote:
Hello,
On 28 Apr 2006 09:34:56 -0700 "Noah Roberts" <ro**********@gmail.com> writes:
Won't respond to your personal attack but I will respond to your claim
I am purposfully misinterpreting your statements.

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


snipped brilliantly researched response.

v cool TJW.


Thank you ... I got lucky on this one, a post of mine actually
made sense. :)

Peace,
TJW
Apr 29 '06 #217
TJW

"Noah Roberts" <ro**********@gmail.com> writes:
You can come to any conclusion you want and provide whatever view you
wish people to see if you quote people out of context.
I can, and I often do. Seriously, I was not trying to insult you.
That was in reply to someone telling me I'm a fundamentalist religious
nut because my parents apparently are because my name is Noah. That is
an incredibly stupid statement to make
.... I totally agree, any such statement is inappropriate. I think my
specific response to reading that statement was tempered however
because I thought that the poster was joking.

Everything in my reply fit, including the admision that the reply
itself was a personal attack that was not on topic...something you
neatly snipped from my post.
This is my error and was unintentional. I apologize, but this is
not totally my point. My point was simply that the set of
statements:
{
Statement 0: Ad-Hominem arguments are irrelevant and meaningless.
Statements 1..n: Ad-Hominem argument (i)
}
is inconsistent. I saw a series of statements in this thread that
match that pattern (qualified by the poster or not) which I found
humorous. Nothing against you personally, just a comment on what
the discussion had become.
Your post is no more informed, About the previous discussion on the costs/benefits of Java
vs. C++, you are 100% correct. I never claimed to be qualified to
engage in such a discussion. My comment however was on the thread
itself, which was informed as I quoted numerous references for the
single point I wanted to make.
balanced, Honestly, I'm not sure how this requirement applies in general to
a group that discusses the use of a programming language, but if
your referring to my omitted quote, again, I apologize.
or interesting than the person's to whom that above quote replies
to.

Matter of opinion. I happen to disagree.

I am way too new here to continue defending a mediocre joke, so I
will make this my last post in this thread.

Peace,
-TJW
Apr 29 '06 #218
peter koch wrote:
Mishagam skrev:
It works if you work with objects as values, it doesn't work if you work
with pointers or references. This is correct - and it should not work in such cases.
In such cases destructor can easily leave
dangling pointer.

I do not know that statement.

I mean here you pass pointer or C++ reference to your object, this
pointer is saved somewhere, and then you destruct you object. Then
pointer in pointing to basically random position. I name such pointer
dangling. I thought it is standard name for such pointers.
If you work with references you are on your own, or
have to duplicate something like reference counting or Java GC.

Replace references with pointers here and I agree.

You can work with C++ pointers or references. Both of them can have
problem of pointing to no longer existing objects.
I don't
think you can work without using references in big program.

(I assume again that you mean pointers here.)You surely can. Modern C++
uses almost no raw pointers. Instead it uses objects called smart
pointers and these could well rely on reference counting.

I, unfortunately, not very fluent in C++ smart pointers. I know that COM
objects used reference counting, and it was major pain in ass. However I
didn't use smart pointers there - mey be they would alliviate problem?
If you use reference counting you cannot be sure when you object gets
destructed, you cannot use RAII, you can get memory leak because
somebody forgot to delete reference. You are in the same position as in
Java, except that GC works with cyclic references.
I think because of this STL mostly works (in examples) with value
elements, and this creates a lot of problems - you cannot place
descended class objects were you can place base objects, you have to
deal with constructors, destructor's, copy constructors called in
strange places, you waste memory and so on.

STL is value-based and rightly so in my opinion.

Doesn't moving around full objects instead of just pointers to them feel
wasteful?
For places where value-based objects don't fit (your example with a container that
should hold elements of a type or descendants of that type), you simply
store a smart pointer. I never actively used smart pointers. I looked on Web - there are
actually a lot of different types of smart pointers in C++ (as usual,
Java has one close to optimal choice). I suspect it is another hole, not
"simply store a smart pointer".
Also, you have to have
different generated code for different objects and use templates.

This is partly true. By having different code generated for each type
you get far better runtime performance so this is a good thing. As an
example, the sort in C++ is three times faster than the C qsort for
double. This is primarily a result of having code inlined.

Yes, if in C you call custom function for every comparison of doubles it
should be slower. I bet if you sort array of structures C++ speed up
will disappear. Actually in Java they wrote separate sort procedures for
native types - because there are only about 8 native types it is
manageable. But all objects are sorted by the same procedure. And they
don't have to copy objects (with calling copy constructor and
destructor's) on each operation. I would be tempted to write benchmark
program, but feel too lazy. Still, sometimes code might be shared across different template-types.
E.g. std::vector<int> could share much of its code with
std::vector<unsigned>.
And in
Java one Collections library works OK with any object. If you do not use Java generics you basically end up with runtime type
checks. This is not nice.

Even in Java with generics I am almost sure there is only one compiled
library for all (Object) types.
/Peter

Apr 29 '06 #219
peter koch wrote:
Mishagam skrev:
Noah Roberts wrote:

[snip]
Third...COM is not C++, it is a MS specific standard of coding a set of
functionality in ANY language that can be used from ANY language
capable of interacting with COM. I do believe Java can be counted
among them but of course any such program instantly looses any platform
independance.

I programmed on COM on C/C++, and all COM procedures use HRESULT as
error code. Other often used COM Language is VB, where error codes
apparently are somehow hidden - I don't know VB very well. Java cannot
directly use COM, probably there exist JNI Libraries allowing
communications Java <-> COM through native calls.

This is absurd. If you program against a COM interface you use a
HRESULT. This is so in ANY language - even Java. Unless Java does not
support COM programming, of course.

What is absurd? I suspect you don't know what you are talking about. Are
you sure VB programmers use HRESULT? I cite "You, as the programmer,
never see the HRESULT; Visual Basic hides its existence to make your
code more manageable. " from
http://support.microsoft.com/kb/q189134/How To Raise an Error in Visual
Basic From Your C DLL
Does in mean VB doesn't support COM? Now that is absurd. VB is one of
main users of COM objects.
Even on C++ Microsoft likes to hide COM objects behind special kind of
smart pointers that convert HRESULT to exceptions.
Java, on the other side, doesn't support COM, but it is possible to
write library to communicate between Java and COM (as I wrote).
Finally, if you don't know then your doubts are meaningless.


/Peter

Apr 29 '06 #220
Phlip wrote:
- impersonates the worst of C++ - typecasts
for simple containers, two different kinds
of type to store a stupid Integer, multiple
String classes, What are you talking about?
and last but least generics! - arrays aren't really arrays. But they really
are. Kinda.
- static typing, to flatter Pascal with a vain
impersonation that, instead, forces you to
break typesafety just to get anything done. Types are checked on each casting, but in run-time. You begin whining
about absence of dynamic typing few lines lower. - adds keywords, like interface, based on
someone else's preconceived notion of good
design. Not keywords like 'virtual', based
on what the hardware will actually do What 'interface' means is much more clear than what 'virtual' means.
Nobody is interested much in what hardware actually do. - provides whole new categories of bugs, based
on zombie objects, non-deterministic
destructors, redundant finally blocks, all
under the excuse we are saving you from all
the C++ memory errors that a good standard
library implementation will save you from
anyway Call me when memory errors will disappear from C++. STL and templates
are so complex, I bet they actually increase number of errors.
- why the >F---< does Netbeans ask me where
the _same_ JAR files are, _each_ time I
launch it??? It feels the sucker ;) - a marketing campaign that teaches newbies
that a language is good if only smart
people can figure out how to use it
- GUIs require block closures and dynamic
typing. But what language does your boss
tell you to write the GUI in???

Apr 29 '06 #221

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


Where to start...

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

You can of course return 0 or null or false or something on error, but
most programmers and libraries use Exceptions. Exceptions in Java are
very convenient, there is usually no sense not to use them.


No different than C++ there then. The only thing that could apply is
there are people who insist on using the old C ways for everything and
pretend not to use exceptions. Usually they come up with some make
believe argument about performance but they are usually arguing from
ignorance with small nuggets of fact from something some expert said 20
years ago.

Frankly, unless you do everything with the old C functions and don't
use a single class out of the std lib you ARE using exceptions in
C++...some people just don't get it though.

At any rate, the languages have little difference in this area from
what I can tell. Slightly different approaches but in effect the same
idea.

Apr 29 '06 #222

Mishagam wrote:
What is absurd? I suspect you don't know what you are talking about. Are
you sure VB programmers use HRESULT? I cite "You, as the programmer,
never see the HRESULT; Visual Basic hides its existence to make your
code more manageable. " from
http://support.microsoft.com/kb/q189134/How To Raise an Error in Visual
Basic From Your C DLL
Does in mean VB doesn't support COM? Now that is absurd. VB is one of
main users of COM objects.
Even on C++ Microsoft likes to hide COM objects behind special kind of
smart pointers that convert HRESULT to exceptions.
Java, on the other side, doesn't support COM, but it is possible to
write library to communicate between Java and COM (as I wrote).


Going off on a bit of a tanget here now. The real point wrt to COM is
that COM is a red herring. We could discuss the various ways in which
some API's hide the facts of COM from the programmer but what bearing
does it have on the conversation? None that I can see.

COM is an MS creation meant for use on their systems, with their
languages, and their toolsets. Any other use is asking for
unpleasantries. VB and the .NET languages make COM easy because they
are both creations of the same company with the same target platforms;
in these languages a COM object looks like any other object. I doubt
Java has a very nice COM interface and I know working with it in C++ is
less than ideal.

At any rate, COM is unimportant. It's use in this argument was
fallacy. We should move on.

Apr 29 '06 #223

Mishagam wrote:
I don't
think you can work without using references in big program. (I assume again that you mean pointers here.)You surely can. Modern C++
uses almost no raw pointers. Instead it uses objects called smart
pointers and these could well rely on reference counting.

I, unfortunately, not very fluent in C++ smart pointers. I know that COM
objects used reference counting, and it was major pain in ass. However I
didn't use smart pointers there - mey be they would alliviate problem?
If you use reference counting you cannot be sure when you object gets
destructed, you cannot use RAII, you can get memory leak because
somebody forgot to delete reference. You are in the same position as in
Java, except that GC works with cyclic references.


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.

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.
STL is value-based and rightly so in my opinion.

Doesn't moving around full objects instead of just pointers to them feel
wasteful?


As is said, you can store pointers. They don't have to be smart but
then you do have to be. If you use smart pointers you can be dumb and
get away with much more.
For places where
value-based objects don't fit (your example with a container that
should hold elements of a type or descendants of that type), you simply
store a smart pointer.

I never actively used smart pointers. I looked on Web - there are
actually a lot of different types of smart pointers in C++ (as usual,
Java has one close to optimal choice).


Java has no such choice. Java doesn't need smart pointers as it has no
pointers to begin with. Nor could it support a construct remotely
resembling a smart pointer. Half of the benefits of smart pointers are
the fact that they look like any other pointer and can be used anywhere
a normal pointer would be...this requires operator overloading.

A smart pointer is nothing else but an RAII wrapper around a gatherable
resource that must be released. Most of the time we are speaking of
memory and some dynamically allocated object. There are several types
because there are several targets. One pointer does not fit all
situations. For instance, should it check to be sure the object exists
before dereferencing it? Does it need some sort of shared process
locking mechanism? Not everyone wants these things....choice is good
in this case as it allows one to choose the correct mechanism for their
needs. There is no "most optimal" choice here.

I can't parse the rest of the post.

Apr 29 '06 #224
Phlip wrote:
Ruby: [snipped]
Java: [snipped]
C++ (deep breath): [snipped -- reluctantly]


Good rant. Enjoyable. Thanks.

I'd pick different points to, um, pick on in all three languages, but -- what
the hell -- it's still just shooting fish in a barrel.

-- chris

Apr 29 '06 #225
Ian Collins wrote:
Phlip wrote:
Ian Collins wrote:

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


Newbie: Why do I have to define classes twice?

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

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

Because it makes then easier to read?

I've been doing a lot of PHP lately and the biggest problem I have is
not being able to see all of the methods on one page. So I end up
creating an interface for each class as a documentation tool.


This is very easily over come by using a decent IDE which shows all the
method signatures - all the time. eclipse, intellj, etc...

but then again some strange people still think vi is good.....

Apr 29 '06 #226

"Noah Roberts" <ro**********@gmail.com> wrote in message
news:11*********************@y43g2000cwc.googlegro ups.com...

Phlip wrote:
[snip]

And the moral is....
We should all be using Objective-C.


That's a good one, but it's funnier this way:

And the moral is...
We should all be using Visual Basic.
Apr 29 '06 #227
"Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> wrote in
message news:n8******************************@comcast.com. ..

"Noah Roberts" <ro**********@gmail.com> wrote in message
news:11*********************@y43g2000cwc.googlegro ups.com...

Phlip wrote:
[snip]

And the moral is....
We should all be using Objective-C.


That's a good one, but it's funnier this way:

And the moral is...
We should all be using Visual Basic.


Oh . . .was it a joke before?

I get it now

--
LTP

:)
Apr 29 '06 #228
On Sat, 29 Apr 2006 03:59:04 -0500 "Larry Barowski"
<MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> waved a wand and this
message magically appeared:
We should all be using Visual Basic.


Death to all VB programmers and the buggers that dreamed up the
language!
NB: It's a JOKE!
--
http://www.munted.org.uk

Take a nap, it saves lives.
Apr 29 '06 #229
Phlip <ph*******@gmail.com> writes:
- write once debug everywhere
Less of an issue now than back in the horrid days of applets.
- forgets everything on all its CLASSPATHs at
the drop of a hat
There's no such thing as CLASSPATHs in Java, only ClassLoaders, which
may or may not use something called CLASSPATH. I have luckily not run
into a case where a ClassLoader suddenly forgot all its classes.
- impersonates the worst of C++ - typecasts
for simple containers, two different kinds
of type to store a stupid Integer, multiple
String classes, and last but least generics!
Well the latter cancels out the first. Pick your poison I guess.
- arrays aren't really arrays. But they really
are. Kinda.
They are. But they're not C/C++ "syntactic sugar for pointers".
- pretends you broke something if your file
name differs from your class name. Figure
it out, stoopid!
You can have lots of classes in a source file that differ from the
file name, but none of them can be top-level public ones.
- when a smart editor like Eclipse can finish
every line for you, it makes you wonder
what the language is _there_ for!
Noone prevents you from using vi to write Java. Well, maybe the Emacs
tribalists do.
- adds keywords, like interface, based on
someone else's preconceived notion of good
design. Not keywords like 'virtual', based
on what the hardware will actually do
Language defines what is virtual or not. It's up to the (virtual)
hardware to comply.
- instead of providing a narrow and reasonable
implementation of multiple inheritance like
C++ (or an alternate "mixin" system like
Ruby) we instead get endless lectures,
endlessly repeated by newbies, about why
real programmers don't need multiple
inheritance of implementation
The syntax for multiple inheritance of implementation in Java is more
convoluted, but doable. (It involves delegate objects, nested member
classes if necessary etc.)
- at least C++ makes some of the benefits
of dynamic typing available. Java instead
enforces such a narrow view of static
typing that you can't even simulate
those benefits
Is that the "let's pretend this block of memory is something else"
stuff "inherited" from C's union and void*?
- GUIs require block closures and dynamic
typing.


Whatever for? I've written GUIs in Java, and the Swing MVC system is
decent enough to use. Where do you need either of those?
Apr 29 '06 #230
Noah Roberts wrote:
Mishagam wrote:
I don't
think you can work without using references in big program.
(I assume again that you mean pointers here.)You surely can. Modern C++
uses almost no raw pointers. Instead it uses objects called smart
pointers and these could well rely on reference counting. I, unfortunately, not very fluent in C++ smart pointers. I know that COM
objects used reference counting, and it was major pain in ass. However I
didn't use smart pointers there - mey be they would alliviate problem?
If you use reference counting you cannot be sure when you object gets
destructed, you cannot use RAII, you can get memory leak because
somebody forgot to delete reference. You are in the same position as in
Java, except that GC works with cyclic references.


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?

You can call something like System.gc(). But if you want to be 100% sure
that something happen you don't rely on gc, you use finally blocks.
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, reference counting using smart
pointers is 100% programmer controlled. If you have valuable resources other that memory, with reference
counting they get called only when all pointers to it in all parts of
program are explicitly closed. You have no help here from RAII, smart
pointers or anything.
You have help from C++ only with one reference in one place in program
(and in RAII object). Then you don't need reference at all you can use
value object. Otherwise there is no help, it becomes worse than finally
block.
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. You can close object in finally block and be 100% sure that non-memory
resources are freed. Then you can be 100% sure that GC will do it's best
to provide you with memory. You also can be sure (not so in C++) that
this memory isn't pointing to other active objects. (of course last part
happen in C++ only if programmer made some error somewhere in program).
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.
For places where
value-based objects don't fit (your example with a container that
should hold elements of a type or descendants of that type), you simply
store a smart pointer.

I never actively used smart pointers. I looked on Web - there are
actually a lot of different types of smart pointers in C++ (as usual,
Java has one close to optimal choice).


Java has no such choice. Java doesn't need smart pointers as it has no
pointers to begin with. Nor could it support a construct remotely
resembling a smart pointer. Half of the benefits of smart pointers are
the fact that they look like any other pointer and can be used anywhere
a normal pointer would be...this requires operator overloading.

Ok, Java has references, which resemble C++ pointers, but are better.
Java doesn't need smart pointers because references provide most of
advantages of smart pointers.
A smart pointer is nothing else but an RAII wrapper around a gatherable
resource that must be released. If you have several pointers (you insist on pointers, however C++ HAS
references which are almost the same as pointers from this point of
view) to the same object/resource, you cannot speak about RAII. Logic of
releasing resource when going out of block doesn't work.
I can imagine you can hope that if you made all pointers to your object
smart, and if you didn't pointed to your object from non RAII objects.
Then you can be sure than when you stop your program (and went out of
all blocks) you released all objects. If you had only one thread . But
OS will release all your resources anyway.
If you have only one pointer you can just as well use value object.
Most of the time we are speaking of memory and some dynamically allocated object. There are several types
because there are several targets. One pointer does not fit all
situations. For instance, should it check to be sure the object exists
before dereferencing it? Does it need some sort of shared process
locking mechanism? Not everyone wants these things....choice is good
in this case as it allows one to choose the correct mechanism for their
needs. There is no "most optimal" choice here.

I can't parse the rest of the post.

Apr 29 '06 #231
You made me think you code directly in binary machine instructions. At
least that's your favorite language.

As for me, I'd dream to program in English, but someone is yet to invent
an English compiler for me.

Regards,
Ben
Apr 29 '06 #232
Andrey Kuznetsov schrieb:
I think applets are much worse than Flash. They take a long time to load,
their abilities to communicate with the browser (Javascript) is even worse
than Flashs.


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


Some browsers handle the initialisation better than others. But for most
users, applets just take a long time to appear. Flash is generally much
quicker, regardless of platform or browser.
Timo
Apr 29 '06 #233
benben wrote:
You made me think you code directly in binary machine instructions. At
least that's your favorite language.

As for me, I'd dream to program in English, but someone is yet to invent
an English compiler for me.

Regards,
Ben


already done - google Domain Specific languages
Apr 29 '06 #234
Tor Iver Wilhelmsen wrote:
- write once debug everywhere


Less of an issue now than back in the horrid days of applets.


Ooh, I love it when they fight back.
- arrays aren't really arrays. But they really
are. Kinda.


They are. But they're not C/C++ "syntactic sugar for pointers".


There is no language C/C++.

Arrays in C++ convert to pointers very easily, but they are still
first-class objects. They have a complete type, including a length, and all
these can be manipulated by ... generics.
- when a smart editor like Eclipse can finish
every line for you, it makes you wonder
what the language is _there_ for!


Noone prevents you from using vi to write Java. Well, maybe the Emacs
tribalists do.


You missed the point. If an editor can parse your code and predict what you
are trying to do, then the language could too. The language itself could
finish these lines, and all I'd have to do is start them.

Read:

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

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

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

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

Please don't say "that's because Java programmers write more professional
comments..."
- adds keywords, like interface, based on
someone else's preconceived notion of good
design. Not keywords like 'virtual', based
on what the hardware will actually do


Language defines what is virtual or not. It's up to the (virtual)
hardware to comply.


Again you missed the point. 'virtual' is a weak, primitive keyword that I
can use to assemble a class or an interface. I can control how concrete and
how abstract the class is. Just because I _should_ create interfaces doesn't
mean the language should _force_ me to.

You cannot legislate morality. (You _can_, however, legislate immorality!)
- at least C++ makes some of the benefits
of dynamic typing available. Java instead
enforces such a narrow view of static
typing that you can't even simulate
those benefits


Is that the "let's pretend this block of memory is something else"
stuff "inherited" from C's union and void*?


Write an Any or Variant class in Java.
- GUIs require block closures and dynamic
typing.


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


You have insufficient experience with block closures.

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

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Apr 29 '06 #235
Alex Buell wrote:
[A spanking] to all VB programmers and the buggers that dreamed up the
language! Take a nap, it saves lives.


A 6-hour work day to all VB buggers.

As the mental clarity takes effect, they will ask "why am I debugging all
the time instead of thinking?"

;-)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Apr 29 '06 #236
Andrew McDonagh wrote:
Ian Collins wrote:
Phlip wrote:
Ian Collins wrote:
You can do the same with a number of C++ compilers, whether or not they
support the 'export' keyword.

Newbie: Why do I have to define classes twice?

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

Newbie: Why do I have to de...scribe classes three times?
Because it makes then easier to read?

I've been doing a lot of PHP lately and the biggest problem I have is
not being able to see all of the methods on one page. So I end up
creating an interface for each class as a documentation tool.


This is very easily over come by using a decent IDE which shows all the
method signatures - all the time. eclipse, intellj, etc...


And allow folding of areas you currently don't want to look at.
but then again some strange people still think vi is good.....

Apr 29 '06 #237

"Timo Stamm" <ti********@arcor.de> wrote in message
news:44***********************@newsread4.arcor-online.net...
Andrey Kuznetsov schrieb:

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


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


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


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

- Oliver

May 1 '06 #238
*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.
May 1 '06 #239

"Remon van Vliet" <re***@exmachina.nl> wrote in message
news:44***********************@news.xs4all.nl...
[...]
There may be certain times when you
can expect the GC to do some cleanup but you cannot guarantee it nor
can you control it. On the other hand, refrence counting using smart
pointers is 100% programmer controlled. You _can_ force something to
get deleted and you know for certain that the object will get deleted
the instant the last reference to it leaves scope or is destroyed.
This is a totally dependable action that is 100% guaranteed. With the
GC you can have no references to an object but it hangs out until who
knows when and then gets destroyed sometime after the last reference to
it leaves scope or is destroyed..../sometime/ after.
Which is a problem because? You dont have to point out continuously that
the GC doesnt allow exact control over cleaning up discarded objects. We
all know that and consider that a good thing. What'd be more interesting
is to finally hear a valid reason why it's actually a problem rather than
an advantage.

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


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

- Oliver

May 1 '06 #240
Oliver Wong schrieb:
"Timo Stamm" <ti********@arcor.de> wrote in message
news:44***********************@newsread4.arcor-online.net...
Andrey Kuznetsov schrieb:

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

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


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


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


Thanks for sharing your experience.

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

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

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

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

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

"Oliver Wong" <ow***@castortech.com> wrote in message
news:MCq5g.2724$zn1.505@edtnps90...

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


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

[...]

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


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

- Oliver


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

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

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


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

/gordon

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

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

"Timo Stamm" <ti********@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

May 1 '06 #245

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


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

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


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

Read:

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

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

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

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

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


Write an Any or Variant class in Java.


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


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


You have insufficient experience with block closures.

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


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

"Timo Stamm" <ti********@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:]
> I think applets are much worse than Flash. They take a long time to
> load, their abilities to communicate with the browser (Javascript) is
> even worse than Flashs.

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

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


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


Thanks for sharing your experience.

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


I think it's fair to say that on average Java initialises a bit slower than
Flash (not surprising considering the implementation differences). Graphics
performance is probably slightly in favour of Flash although Java2D uses
hardware acceleration as well. In terms of raw computing power i suspect
Java will blow Flash out of the water as i'm boldly assuming the "VM" of
Flash is not nearly as capable as an average JIT JVM. I must stress that's
an assumption rather than fact though.
May 1 '06 #248
Remon van Vliet <re***@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.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
May 1 '06 #249
Remon van Vliet schrieb:
"Timo Stamm" <ti********@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.

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


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

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6785
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
6902
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
9215
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
5640
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...
1
9593
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...
12
5894
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...
0
3255
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...
1
4289
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 = ...
0
3241
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
7368
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5833
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...
0
4859
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...
0
3361
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...
0
3359
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1764
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
1
934
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.