Languages & Test Driven Learning
These past couple of weeks I’ve started learning Java in order to build an HTTP server and another tic tac toe game. It’s the fifth language I’ve worked with in the past two weeks- after Clojure, JavaScript, Ruby and SQL- and I use the word “worked” very loosely since my JavaScript isn’t that great (but getting better) and my understanding of SQL is minimal. Fortunately I was paired up with Jeremy on the JavaScript and Eric on the SQL to help me along.
Although the context switching between different languages and frameworks has been a little rough, I’m getting better at it, and what’s surprising (but probably shouldn’t be) is how the barrier to learning each subsequent language gets a little lower. I’m starting to recognize pattens in new languages that I’ve already seen in others, and that goes a long way towards feeling comfortable and having an clue of what’s going on.
I feel like another big advantage for me when learning a language is that I learned the idea test driven development so early on in my exposure to writing software. When I started with both Clojure and Java I almost immediately started working with a nice, lightweight test suite— not because of any sort of discipline or principle that I had to test first, but because tests create this great sandbox where I can play around and get immediate feedback. Of course a REPL or console is a great place for basic experimentation, but a testing framework makes it easier to play around with more complex problems.
In Clojure I’ve been using Speclj, Leiningen and the lein spec -a
command for that immediate feedback loop, and in Java I’m using JUnit and the IntelliJ IDE. Getting JUnit up and running seemed way more complex than it should have been because I could never get their example tests to run (I still haven’t), but once I decided to skip the samples and just start using JUnit inside of IntelliJ everything was fine. I just download the latest version of JUnit (I could have saved it anywhere I wanted, I chose /Library/Java/Home/lib), and then updated my “Library Settings” inside of IntelliJ to point to the JUnit directory (You can get to the Library Settings in IntelliJ by hitting ‘F4’).