java follies [was: PHP vs Perl (Put on flame proof gear)]

Jonathan Ellis jonathan at carnageblender.com
Mon Mar 20 17:00:21 MST 2006


On Mon, 20 Mar 2006 16:38:53 -0700, "Bryan Sant" <bryan.sant at gmail.com>
said:
> On 3/20/06, Jonathan Ellis <jonathan at carnageblender.com> wrote:
> > Victor Laszlo had a good post on this:
> >
> > http://secretartofscience.com/blog/?p=23
> >
> > "It seems obvious to me that the strict typing basically catches errors
> > in code that you only have to write because of the strict typing."
> 
> Holly cow.  I am embarrassed for you that you used that blog entry as
> an example for your point.  It's obvious that the guy who wrote that
> entry has never actually used java.  The evil bloated java code (tm)
> snippet he supplies is both artificially inflated and it isn't valid
> java code.

Because your pseudocode is always syntactically correct, right? :P

>  This is exactly what I'm talking about with the "non-java"
> type of people who sight non-factual information as evidence that java
> is naughty.
> 
> By all means, disagree with java all you want.  All I ask is that you
> stick to the facts rather than emotion.

Dude, you're so emotionally involved that you're grasping at straws
here.  Only you can't see it.

> To address the quote you included, I totally disagree.  Strict typing
> is very helpful for preventing real errors.  You have to look beyond
> strings and numbers to get it though.  Not being able to communicate
> type in a method declaration for example is harmful.  If my method
> will accept ANYTHING you put in it (as dynamic langs allow), and I
> call the "delete" method off the object you pass in -- half the time
> it will try to call "delete" and that method doesn't even exist on the
> parameter you passed in (runtime error), or it will call "delete" off
> the HardDisk object you passed in instead of the UnimportantObject the
> method was designed for.

Sounds nice in theory.  And probably has the desired effect, on newbies.
 Use java or you'll wipe your hard disk!  Oh noooooooooooooeeeees!

Now who's exaggerating for effect? :P

As long as we're hand-waving, it's just as easy for me to picture a Java
HardDisk class implementing a Deletable interface, and because layers of
abstraction is always a Good Thing, our hypothetical method will of
course take a Deletable interface instead of a concrete class type, and
happily wipe the disk anyway.

In practice this sort of thing just isn't a problem you find in the
wild, dynamic language or no.

Back when Java was new, the C++ old guard's knee-jerk reaction that
garbage collection Will Never Work.  Now the java developers are the old
guard, and they're just as afraid of change as the C++ developers they
replaced.

> Do you declare every column in your database as a BLOB or varchar?  Why
> not?

Now you're confusing "dynamic typing" with "no typing," but I still
can't resist pointing out that to sqlite, everything IS a string,
internally.  And...  it works just fine.

-Jonathan
-- 
C++ is history repeated as tragedy. Java is history repeated as farce.  --Scott McKay




More information about the PLUG mailing list