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

Levi Pearson levi at cold.org
Mon Mar 20 14:35:55 MST 2006


On Mar 20, 2006, at 1:52 PM, Bryan Sant wrote:
>
> Not that I don't believe you, but please supply and example.  How
> would a dynamic language make a singleton, prototype, strategy,
> flyweight, facade, or adapter pattern unneeded?  I can see how some of
> these patterns would require fewer charaters to be typed (not need to
> cast a value frome one type to another or create
> super-classes/interfaces in some cases).  But again, we'er back to my
> original point that A) with an IDE, I'm just as fast and B)
> sacraficing type-safety costs in unit tests.
>

Well, take Strategy (and the other patterns that differ from Strategy  
only in intent).  For most uses, you can replace the strategy object  
with a higher-order function or code block or something of that  
nature, depending on what language you're using.  Peter Norvig has an  
interesting slide show about patterns in dynamic languages here:  
http://norvig.com/design-patterns/

I'm not trying to insult Java or Java users, just to point out that  
static typing does add conceptual overhead in some (but certainly not  
all) tasks.

In the real world, static typing does not alleviate the need for unit  
tests, and few unit tests need to be written specifically to catch  
type errors, since they will usually show up in the sort of test that  
you'd write for a statically-typed language, too.  So, that cost for  
dynamic languages is just about as bogus as the extra keyboard  
overhead people try to place on Java.

>
> I learn something new ever day.  I'm switching to Haskell on my  
> next project.
>

I certainly wouldn't recommend that, unless your next project is  
simply aimed at learning Haskell.  It's an interesting language, with  
the potential to be both concise and efficient, but it's not going to  
make you more productive in writing typical business applications as  
it stands today.  I brought it up merely as an example of a  
statically-typed language that is more concise than many dynamically- 
typed languages, and I thought you'd welcome the example since you  
seem to be a fan of static typing.  If you are simply a fan of static- 
typing because Java is statically-typed and  you don't really care  
about it in other languages, well, I'm sorry I pegged you wrong.

>
> Untill you have to write the documentation that explains what your
> code does.  Not that you don't have to do this with Java, but the
> language is far more self-documententing than most other languages.
> I'm not saying that smaller code isn't better.  I do think so.  But in
> the totallity of what a good developer is expected to do (write unit
> tests, and document your code) Java (or C#) isn't nearly as bad off as
> some try to paint it.

I'm not trying to paint Java in a bad light here; it's a pretty  
decent tool for writing software, and definitely made some steps  
forward from C++.   I don't think it's the final answer in software  
development, though, and I think keeping up-to-date with what's going  
on in the programming language field and having multiple languages  
with different properties available to work with is more important  
than trying to make a specific language look like the best tool for  
every job.

I think you interpreted my response to your earlier post as anti- 
Java, while I didn't mean it that way at all.  I was just trying to  
broaden the discussion a bit.  Maybe I'm overly optimistic, but I  
think that features of Lisp, Smalltalk, Ruby, Haskell, ML, etc. will  
be working their way into mainstream languages over the next few years.

		--Levi



More information about the PLUG mailing list