Comments on: Java, Ten Years Later Keepin' static like wool fabric since 2006 Wed, 08 Oct 2014 14:33:23 +0000 hourly 1 By: Kenny Leftin Fri, 18 Nov 2011 06:46:34 +0000 If you’re doing a lot more with Java, it’s worth reading Effective Java by Josh Bloch. It’s the bible for good Java idioms. (There’s a free pdf copy within Google that you can read)

Be careful with your last point. static {} is convenient for a project with only a couple classes, but it can get un-maintainable really quickly. Since the static block is executed only when the class is loaded, it can be surprising when it will or will not run. The ‘static’ keyword in Java in general can be a little hairy. See Puzzle 5 ( for class initialization craziness. Not to mention, it’s almost impossible to mock any sort of static method in a unit test. I basically only use static for two things:

1. Defining final constants
2. Writing methods that need absolutely no state

What are you working on nowadays that uses Java? You should e-mail me!

By: danvk Mon, 07 Nov 2011 15:40:32 +0000 There’s something nearly identical to Java’s foreach in C++11:

Unfortunately, we’re not allowed to use either that or boost::foreach at work yet :(

By: Craig Fratrik Mon, 07 Nov 2011 06:43:47 +0000 Boost Foreach is pretty good.