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

Bryan Sant bryan.sant at gmail.com
Mon Mar 20 16:38:53 MST 2006


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.  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.

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.

The solution in a dynamic lang is simple.  Just comment your code to
explain that you only intend to operate on UnimportantObjects (or
subclasses thereof).  Oh wait!!  You're trying to communicate EXACTLY
what a typed language does, only less effectively, and not enforced by
a compiler.

If you're working on your own little script and your calling the
methods you just authored, then this is no big deal.  You can keep it
straight in your head.  If you're working on a project of any
significant size, you're API will quickly melt down into goo that no
one understands except for the guy who wrote the method and maybe his
cubicle neighbor.

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

-Bryan



More information about the PLUG mailing list