For an experienced programmer, learning a new programming language can often be a frustrating experience. Most of tutorials are written with burgeoning programmer in mind while the reference documentation is generally too large to be useful while learning the basics.
One very useful form of coding exercises that teaches different language features like syntax and structure are code koans. Koans are essentially a simple problems where programmer is asked to “fill in the blanks”. They look a lot like unit tests and will be immediately familiar to those programmers that are used to writing them. There is a number of koans ready to be pulled from internet like these teaching Ruby or Clojure.
Here is an example of a Java 8 koan (https://github.com/matyb/java-koans) demonstrating the new “parse” method on a LocalTime class in java core api:
I’ve been using koans for a while now in workshops with teams that were new to a certain programming language and needed to brush up on some language features. Recently, I decided to go over new Java 8 features in a more systematic manner and thought of going through a set of koans. However, there was no ready koans to be found. Instead, I decided to write some myself. Writing koans actually proved to be a much more entertaining and overall a better learning experience then solving them. Not only do you have to think on how certain language feature works, but also on how to demonstrate it in a succinct manner. So, if you are learning a new programming language, try solving some koans and if none are available I suggest you write and publish some yourself.