A Nice Example of Interactive Programming

I’ve written previously about interactive or exploratory coding. It’s the sort of thing that Emacs and Emacs Lisp make easy and attractive. You sort of feel your way along writing little snippets of code and then stitch them together into larger pieces such as functions. The approach is brilliantly illustrated at the beginning of Magnar Sveen’s Web Rebels talk where he builds a slide show function right before our eyes.

Now Kris Jenkins has posted a video that also demonstrates the technique. In just 16 minutes, Jenkins builds a Spotify client while we watch. This isn’t 16 minutes of watching him type though. Starting with a shell call to Apple Script telling it to ask the Spotify application to play a Pink Floyd track, he builds up a function to play any track. Then he builds up some functions to retrieve track data from Spotify. Finally he ties it all together with helm to provide a reasonably functional Spotify client runable from Emacs.

I love this way of programming; It’s one of the reasons I prefer Lisp to C for almost all projects. Even in C, I tended to write a function and then try it out but with lisp you can try out individual expressions and add more parts until you get what you want. If you’re an Emacs user or a Lisper you must watch this video. It will, I promise you, be worth your time. It’s just a bit over 16 minutes so it will fit nicely into one of your breaks.

This entry was posted in Programming and tagged , . Bookmark the permalink.