Wednesday, May 28, 2014

Learning clojure

Background

In the past I have toyed around with clojure a little, but never really put in significant time to learn the language even though it has greatly appealed to me. Now I have started to really dive into it and I feel like sharing some of the resources I am using, as well as some getting started info. I will not write a clojure tutorial here, as I feel I would only be rehashing what others have done. Instead I will lay out the path I am following to gain better understanding of the language and its power for those who may wish to do the same.

My first real exposure to clojure came in the form of reading Seven Languages in Seven Weeks (Which I would very highly recommend to any non beginner programmer). While this book is wonderful in exposing people to different ways of thinking about programming, and getting a very real glimpse into different languages, it is an insufficient introduction to any of them. It is however a good starting point for what follows.

Setup


First I recommend installing Leiningen and start a REPL using lein repl in the command line. Here I would recommend exploring a basic tutorial or the material from 7 Languages, especially if you are new to Lisp in general.

Following some light exploring it is prudent to setup an IDE to work in, and here I actually turned to an interesting project called Light Table. I feel this complements my style very well, but another good alternative is Emacs for the Lisp die hards out there.


Learning through tests

I really like the Koans projects since they teach through TDD. While you are not learning about TDD in these projects, you it is helping facilitate your learning. In many ways the habit of making assertions pass in the koans sets up the habit of making them pass in a testing framework like Expectations.

So I recommend working through:

  • http://clojurekoans.com/
  • https://github.com/sritchie/core.logic-koans
  • http://clojurescriptkoans.com/

In addition, after finishing clojure koans I think working through the problem sets in 4clojure will solidify understanding and skill with the language. At this point projects are in order; my standard projects when learning a language revolve around artificial life simulations such as John Conway's game of life, and boids simulations. I recommend following your standard set of exercises, or if you haven't developed any yet start to put together some cool projects that are not too involved, but are still a full piece of software.

I will finish by saying the next step for the brave will be to dive into "The Joy of Clojure". While the basics will be covered again, the book moves at a rapid pace, and will fill in many gaps in function programming skills if you are unfamiliar with fp.

Wednesday, May 21, 2014

What is programming?

I am currently reading this article and one of the first questions that is put forth is 'what is programming'. I want to express here some of my thoughts before continuing to read, and see what some of you might think as well.

Over the years my thought of what programming is has drastically changed, from a mechanical exercise in solving puzzles to what I hope is a more mature definition. In essence I think that programming is the art of unambiguously expressing a set of problems along with a subset of the solution space to them. Our solutions are generally encoded within a programming language so that they can be exercised against real world instances of the problem.

As a beginning programmer I often missed the first part (and am still guilty of it sometimes), and I believe this is partly because of how programming is initially taught. We are often given well defined problems to solve, and this continues for a while while we learn the mechanics of writing code, however it might be the most critical part of development. If you aren't solving a specific well defined problem then the code is going to be all over the place and not very good. Maybe we need to find more ways to work this into the early stages of educating developers?