java follies [was: PHP vs Perl (Put on flame proof gear)]
Levi Pearson
levi at cold.org
Mon Mar 20 13:12:35 MST 2006
On Mar 20, 2006, at 12:24 PM, Bryan Sant wrote:
>
>
> As far as java being verbose, it's about on par with object-oriented
> C++ code. You'll never have a type-safe language that's as compact as
> a dynamic language because you're always declaring types. It's a
> trade-off. However, with a modern IDE, the task is trival. And you
> make up any time that may have been lost (I don't believe that any is
> with an IDE), by avoiding many runtime errors that the compiler finds
> for you. As well as avoiding the need to write hundreds of unit tests
> that do little more than validate type-safety because your dynamic
> language of choice doesn't do so.
>
> So, actually, when you factor in the time to write type-safe-ish unit
> tests for your ruby or python project, you're actually more verbose
> than Java.
Although I agree that the amount of time that it takes to enter type
annotations is not really significant, that's not really the point.
For some tasks, working around the type system takes a significant
amount of extra logic. Witness Design Patterns, a significant number
of which are methods of doing things in statically-typed languages
that require no extra thought in dynamically-typed languages. IDEs
don't really do anything to alleviate this.
And another point: statically-typed languages in the ML and Haskell
families are often more compact than dynamically-typed languages.
Types are (mostly) inferred, so there are very few type annotations
in the code. There is also special syntax for pattern matching that
makes for very succinct code in situations where it's useful.
The verbosity of a language is not inherently tied to its type
system. It only seems that way because of the current crop of
languages in the mainstream. The choice of dynamic vs. static typing
ought to be made on its own merits, and both are appropriate in
different situations. The ability to create powerful abstractions
(and thus write succinct code) is almost always a win, though.
--Levi
More information about the PLUG
mailing list