This one for example. He proposes a simple way to make Java developers angry, by showing them some code. His example is
and throws a challenge:
Anyhoo, all you have to do now is find someone who uses a big stupid language and throw an example like above to their face and tell them to beat it. See if they can write it more elegantly using their language. The beauty of the trick is that thereâ€™s no way in this world thatâ€™s gonna happen.
My 20min Java version looks like this - more or less identical:
File.open("server.cert").readlines(1, -2).join().gsub("\n", "")
Poor blogger, another fanboy without a clue who confuses languages and API design - in this case method chaining.
Because there's a very high probability that the other person, yes, the one who's using a big stupid language, will get so angry and beat you up.
Nope, I just write the code in Java. That's all.
(Beside that, the oneliner is hard to read, hard to maintain, hard to reuse. Fine if your the sole developer in a project, bad if there are 50 others who need to maintain your code. I'd prefer a
(As a second side node, where is the fluent interface to google collections, I've needed one today)
Update: Someone wrote a comment to the linked blog post by copying parts of this post. And because someone asked: No this cannot be done with the JDK, therefor it's an API problem. You need to write some code on your own to fluently wrap JDK classes. See the mentioned fluent interface link above to see how this can be done to an existing API.