Subject: RE: [hackers-il] Java vs. C vs. the World [was Re: Malloc Checkin g [was Re: Re: Another Interesting Case Study: Permutations of a range of characters ] ]

From: Chen Shapira <[email-masked]>
Date: Wed, 16 Jan 2002 20:32:46 +0200

Hi,

I'll try protecting java for a bit (although I don't like it all this
much...)
If you aren't interested about this, skip to the end, I'm saying things
about C++ down there :-)

> 1. Technical ones: it crashes a lot.

Eh? The VM? which VM on which platform? 
From what I see here, recent JVM's are stable as a rock on windows and
linux.
It can still crash if provoked, but then its your code, not the VM/language.

> 2. Licensing ones: Sun is killing Java with the way it 
> develops it. I'm
> not saying it should be 100% open-source, but everything should be at
> least a project with a collaborative feel about it. (i,e: a public CVS
> server, mailing lists for developing the core components, etc.)

I'm happy enough with open specs, but this is a religious, not technical
issue.

> 3. Philosophical ones: it still gives me a higher level of abstraction
> than C. It's not just C with garbage collection - it's a 
> whole new ball
> game with lots of APIs and abstraction.

Yes. Most of us think its a good thing :-)

> I usually prefer Perl over Java because I get a lot of cool 
> primitives for
> doing common tasks, and because I find Perl's syntax and 
> grammar much more
> natural than Java's. Larry Wall has written an article in which he
> explains how he tried to embed natural language principles in Perl:
> 
> http://www.wall.org/~larry/natural.html
> 
> I think he did a marvelous job, because Perl programming is 
> more natural
> to me than any other language.

Naturalness of syntax is a matter of taste.
I'm a fan of very strict syntax with well defined rules. C++ does a good job
at that, it got to the point that if something compiles it'll almost
certainly run.

About common tasks: Java has a very large library, too bad large parts
aren't standard (XML. logs, regexp).
One thing Java does much better than Perl is scale. In Java it isn't
difficult to move a well designed system to run on multiple servers moving
objects back and forth.

> (Please don't turn it into a Java vs. Perl war)

Too late  :-)

Just to balance it out, here's what I hate in Java (true for JVM 2 , so no
flames about things getting fixed).

I hate the clunky UI, specifically swing. Its slow, it has memory leaks, and
it has a very distinct look that tends to scare people away. It doesn't look
like windows, so they decide it isn't professional.

I hate the over-hyped and over-engineered feeling around it. Too many names
for the same things, too many buzzwords floating around, its very difficult
to seperate the usefull stuff.

Simple things that are way too dificult, like printing, and copy/paste.

> When I encounter a Java project in Freshmeat, I usually don't take a
> second look. (you make the deduction why). I plan to translate the
> Freecell Solver code to Java because I think it would be 
> really cool if
> people can browse into a web-site and have there a Freecell 
> implementation
> that solves Freecell using my algorithm as an applet. And 
> converting it to
> Java seems inevitable because Java is the de-facto standard.

Last time I looked, FCS was macroized to death because you wanted to squize
performace.
Doesn't sound like a good applet candidate to me :-)

> My point is that the strength of a chain is the strength of 
> the weakest
> link and sometimes languages can fail or not gain momentum from purely
> technical reasons.

I was just thinking about this bit, in the context of "why C++ is so
successfull?".
I thought that C++ had many features from the Academia, which the business
world dismissed for a very long time.
generic programing, templates, ingeritence, exceptions, references, etc. 
All these things were availble in several languages for a while, and no one
seemed very interested.
And all of the sudden, C++ became a huge success and everyone was talking
OO, patterns and generic thingies.
I blame its "better C" philosophy. People started using C++ for its neat
comments. The "deeper" features creeped into the culture slowly, only after
the language was in wide use. First a "better C", than classes, than
inheritance, the templates... the rest is history.

To sum things up, in many cases that biggest obstacle is the cost of
switching. Learning a new language, integrating old skills, convincing
developers, looking for libraries, learning curve, etc. C++ did this part in
a very very good way. There was almost no switching obstacles, so everyone
just switched, only later stopping to think why.

---

From: Shlomi Fish <[email-masked]>
Date: Thu, 17 Jan 2002 01:23:56 +0200 (IST)

> It can still crash if provoked, but then its your code, not the VM/language.

AFAICT, a virtual machine should not segfault ever, unless one uses buggy
hard-coded stub functions. At least that is the case with Perl in which
the process gracefully exits even if there is a run-time error. Naturally,
Java processes can die with an uncatched exception - that's OK. But when I
worked on Java (for a commercial position) some years ago, it was known
that all the existing VMs could segfault on you.

> I'm happy enough with open specs, but this is a religious, not technical

I disagree here. Your philosophical (= "religious") practices can have a
drastic impact on how successful is your project. This is true for
everything in life - philosophy is very important.

> Yes. Most of us think its a good thing :-)

Normally, I find that too. But I believe Java is the middle of the road
between C and Perl. Not enough C to be able to write elemental code in
style, but not enough Perl to be able to enjoy high-level abstractions.

> at that, it got to the point that if something compiles it'll almost

Then you should try Haskell. I think it does a better job of eliminating
bugs than even C++ (albeit my C++ knowledge has become rusty recently,
and I never used it to the full scope that exists now). Of course, the
problem with Haskell, is that at the moment there's very little, besides
the very trivial, that can be done with it. (and most people will not take
a first look at a program that was written in Haskell)

> difficult to move a well designed system to run on multiple servers moving

From what I know, Perl supports CORBA. Did you try doing something similar
in Perl? Whatever, such distributed object-oriented programming is giving
me a little headache. I had very little experience if any with distributed
programming and ORBs.

> like windows, so they decide it isn't professional.

I did not have experience with SWING programming, so I'll take your word
for it.

> to seperate the usefull stuff.

Amen! You hit the hammer right on the nail, if you ask me. I still don't
know what Java Beans are, and all of the other Java technologies with
over-hyped names that Sun is pushing. The entire Java 2 stuff is very
confusing, considering the fact that it's just a nickname for JDK1.2 and
JDK1.3. And I am reminded of Electrical Engineering when encountering the
acronym J2EE. (It is in fact Java 2 Enterprise Edition)

JavaSoft would like people to think Java as a language is a panacea that
can be used instead of everything else. As much as I like Perl, I still
would not admit that it is better for everything than any other language.
I can bring many clear-cut case where Matlab, or Haskell, or Scheme, or
even (gasp) C would be more suitable than Perl. Much less for Java.

> Simple things that are way too dificult, like printing, and copy/paste.

A recent IBM's DeveloperWorks article compared between Java Servlets, perl
and PHP. I did not read the full article, but the summary told me that it
reached the conclusion that many simple things were difficult in Java that
in the other two alternatives.

When I registered into the Java Developers' Collection in the
java.sun.com, the script that processed the form I filled ended with a
".pl" extension. Maybe they changed it to a Java Servlet by now (or a JSP
script - %-)), but the fact is that the webmaster preferred to use perl.

As a side note I should say, that I would have much preferred writing most
Applets in Perl, and applets is what most non-techies know Java from, and
what made it what it is today.

> Doesn't sound like a good applet candidate to me :-)

I'll use a preprocessor for Java too. There's filepp which is identical to
the C's preprocessor only it does not output those "#line" thingies you
seen when running "gcc -E". And then there's chpp and friends which are
more elaborate and Turing-universal, but would make it impossible to use
my existing code. I'll probably go for filepp, unless I find a compelling
reason why not too.

I realize using a preprocessor for Java code is frowned upon. But I'll do
it anyhow.

> just switched, only later stopping to think why.

I was very impressed with OmerM's snippets, you know. I really should
re-visit C++, as it seems its state of the art today, is much more
advanced than when I learned it from the Turbo C++ 3.0 manual. (I'm not
kidding!) I'd like to take a C++ project which I can take Technion credit
for.

The problem is that on Linux C++ compiles so slowly, at least with g++
which is the de-facto compiler. There are some commercial C++ compilers
floating around, but I don't know how fast they are in comparison.

One of my instincts is to write the code in ANSI C to make sure it is
clean, compiles fast and gives me much less unexpected results. I
believe that in C++ it is very easy to write code that:

1. Does not work.
2. Is not supposed to work according to the standard.
3. You have no idea why it does not work.

I already got used to perl's minor details, so I know how to avoid
writing code that does not work (and how to write code that does - ;-)).
And C has a relatively straight-forward behaviour. But I don't think
either of those is the case for C++.

I remember reading an article in DDJ about some template trick in C++. I
remember that for every code snippet I had to think some time what the
author was trying to do. Eventually, I came to the conclusion that it was
a very cool trick. However, in Perl which is dynamically-typed this whole
thing was a non-issue.

I have this problem - I am a Perl addict, and I view every other language
in perlish eyes.

Regards,

	Shlomi Fish

>
>
>
> To unsubscribe from this group, send an email to:
> [email-masked]
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

----------------------------------------------------------------------
Shlomi Fish        [email-masked]
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       [email-masked]

"Let's suppose you have a table with 2^n cups..."
"Wait a second - is n a natural number?"