Functional Programming Spacewar

Clean Code, Episode 55

By Robert C. Martin

87 minDec 2018

Spacewar! How cool is this? Did you ever think that you would be combing through the innards of a real-time, interactive video game written in Clojure? Well, you are now!

This game is thousands of lines of Clojure code. It has Klingons, Romulans, Starbases, and The Enterprise. You must save the Federation.

This episode and the two that follow will lead you through the design and implementation of a functional and interactive GUI program. It is 100% functional: no cheating, no mutated variables, and not even any Transactional Memory; just plain old functional programming.


You should probably follow along and grab the code. If you want to play the game, you can find the ClojureScript version in your web browser here.