Re:Twitter Shifting More Code to JVM, Citing Performance and...
by Silhouette on Tuesday July 05, 2011 @04:25PM
(#2731412)
I agree with you completely on the simplicity and readability ideas. I think perhaps our difference is on where the unwarranted verbosity comes from.
I'm not advocating a very terse programming style, as tyically seen in Perl or C code.
However, Java doesn't let you compose basic data processing easily. If you have a list of Xs and you want to find those fitting a certain criterion, just compare the effort you have to go to in Haskell:
results = filter (<10) xs
and in C#:
var results = from x in xs where x < 10 select x
and in Python:
results = [x for x in xs if x < 10]
and in Java with someone's collections library on top:
results = CollectionLib.filter(xs, new CollectionLib.BooleanTest<X>()
{
public boolean test(X x)
{
return x < 10;
}
} );
That's pretty typical of the problems with pure computations, in my experience.
When you start talking about I/O and other programming with a time dimension, you find similarly clunky handling of everyday things like events/publish-subscribe/observer/whatever you want to call it, not least because everything has to be in an explicit interface before you even start. Meanwhile, other languages these days are offering tools like message passing and actor models, which both scale up with system size without compromising the basic architecture and support concurrency with relative readability and safety.
Please notice that none of this has anything to do with terseness as such. It's about whether the language provides simple, readable tools to implement widely applicable programming techniques.
I'm not advocating a very terse programming style, as tyically seen in Perl or C code.
However, Java doesn't let you compose basic data processing easily. If you have a list of Xs and you want to find those fitting a certain criterion, just compare the effort you have to go to in Haskell:
and in C#: and in Python: and in Java with someone's collections library on top: That's pretty typical of the problems with pure computations, in my experience.When you start talking about I/O and other programming with a time dimension, you find similarly clunky handling of everyday things like events/publish-subscribe/observer/whatever you want to call it, not least because everything has to be in an explicit interface before you even start. Meanwhile, other languages these days are offering tools like message passing and actor models, which both scale up with system size without compromising the basic architecture and support concurrency with relative readability and safety.
Please notice that none of this has anything to do with terseness as such. It's about whether the language provides simple, readable tools to implement widely applicable programming techniques.