Since finishing up my Java tic tac toe last week I’ve moved on to building my HTTP server that will serve up my game. It also needs to pass 8th Light’s cob_spec suite of test for a web server.

Although I’m still getting comfortable with Java, at this point I’m pretty familiar with the tic-tac-toe problem domain- so getting that app going wasn’t bad after the initial Java hurdles. However, my knowledge of a server up until now has been limited to starting one with ‘rails s’, ‘lein joodo server’ or ‘rackup’ - and then stopping it with control-C.

My lack of server knowledge coupled with my limited knowledge of Java has made for a challenging past week. More often than not I’ve had to set TDD aside because I realize I don’t even fully understand what I’m testing, or I can’t build a mock because I don’t know understand the behavior of the object I’m building a mock for. Usually when I find myself in that position I can take a step back and make the test simpler, but in order to do that I need to understand what the simpler step is. So there’s been a lot of reading.

  • HTTP Made Really Easy. In the weeks before I started the project I read up on as much as I could about how a server works. 8th Light’s newest Craftsman, Adam Gooch had mentioned this article in one of his blogs and it’s a great place to start. Don’t let the name fool you either, it’s actually a pretty in depth resource with lots of great links.

  • I also spent a lot of time at the Princeton Introduction to Java site section on Networking. This is where I got my start with building the echo server.

  • I always have tabs open to Oracle’s Java Docs on Sockets, ServerSockets, BufferedReaders, StringReaders, InputStreamReaders and all their corresponding “outputers”.

  • Most importantly, almost all of the 8th Light’ers have built a server at some point so there are lots of examples for me to read. Over the past couple of months I’ve really started to enjoy reading code and just as with any author or literature, the more of the craftsmen’s code I read the more I’m recognizing their styles.

  • And a special shout out goes to craftsman Patrick Gombert’s HTTPSReport repo and his extremely thorough and entertaining README. He cleverly named all of his classes so that they are positions in a company, but also describe very well what they do.

Back to wiring things up…