Saturday, March 22, 2014

Conflicted about new programming language releases

I've been meaning to blog more, and post more code, so here's killing two birds with one stone :-)

I'm always deeply conflicted whenever there's a new version of a programming language I like around. On the one hand, I get to play with new and interesting features, but on the other hand, aimlessly using new features tends to lead to pretty messy code that uses them for the sake of them existing, rather than them adding something to the code.

I think a lesson I learned with C++11 is that less is definitely more with closures, but for those rare instances they are legitimately called for, they can really improve the code. It's sort of about letting applications find you, rather than going out actively looking for ways to cram lambdas into your code.

Today it happened in Java though. I legitimately produced cleaner code by using a Java 8 lambda function that I possibly could otherwise. Great success! Here is the outcome (function delegation is at line 52, in processDocument()).

No comments:

Post a Comment