It has been a long while since my last blog post. A lot of stuff has happened in my personal life, but I have a feeling that it has calmed down significantly enough for me to enjoy my life once again.
I have been reading some books lately, all programming related:
iPhone SDK Development: this is a Beta book from the pragmatic programmers group… it is not yet finished but what I read so far is quite interesting. The book tries to easy you into iPhone development, it kind of succeeds, however since it is a beta book it has a lot of small errors…. and that makes it hard to follow along, since you are regularly trying to find out why something is not working and thinking you did not pay enought attention :S…. luckily the errata section on the website helps a lot! In the end this will be a great book to start your own development, I am sure!
Programming Erlang: a very good book to get you into Erlang programming! I would recommend this book to anyone interested in learning Erlang. The book starts with a gentle introduction into the language itself and the change of mindset needed with functional programming after which it nicely covers everything from distribution of code over several nodes, storing data in the various database possibilities and creating distributed, fault tolerant and concurrent systems using the Open Telecom Platform (OTP).
Erlang in practice: not really a book, it is a set of screencasts exploring the process of writing an erlang chat server. Takes you through all the steps; setting up, distributing, persisting and adding REST support.
Although the iPhone/Objective-C book is quite interesting I find that I am more attracted to writing server side software. I guess it is because server side software is more of an boolean logic then interfaces (either it works, or it doesn’t).
Although the Erlang package comes with a great Emacs mode for editing erlang software it misses 2 things:
The mode uses Tempo snippet support, while I have found that YA Snippet provides far superior templating.
The other is that flymake is quite a necessity I think. Flymake provides on-the-fly syntax checking of your source code.
I have added the following configuration to my emacs setup to enable it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | (add-to-list 'load-path "path-to-erlang-package-emacs-mode") (require 'erlang-start) (add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode)) (add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode)) (require 'flymake) (defun flymake-erlang-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "path-to-eflymake" (list local-file)))) (add-to-list 'flymake-allowed-file-name-masks '("\\.erl\\'" flymake-erlang-init)) |
Lines 1 and 2 setup the erlang mode, 4 and 5 associate this mode with .erl and .hrl (erlang records) files, line 7 loads up flymake and lines 9 up to and including 14 tell flymake how to check erlang files for syntax. I use the eflymake script for this job. Line 16 tells flymake to use this for .erl files.
The eflymake script mentioned is an escript script:
1 2 3 4 5 6 7 8 | #!/usr/local/bin/escript
-export([main/1]).
main([File_Name]) ->
compile:file(File_Name, [warn_obsolete_guard, warn_unused_import,
warn_shadow_vars, warn_export_vars,
strong_validation, report,
{i, "../include"}]). |
This greatly simplifies the writing of code using our favorite editor ;). During the screencasts of Erlang in Practice (mentioned above) you see the benefit of this extension. The author starts out with a clean Emacs installation it seems and over the various screencasts you see that he adds this extension. In the first couple of sessions you see him make some small mistakes and lateron you see that Emacs warns him and he fixes the code before he gets bitten by it.
While learning Erlang I found that I have a new-found love for server programming. I was kinda dumbed down by the many years of Java programming and was loosing interest in programming server-side really, now with an injection of a new language and “new” ideas I am totally excited to be in this field again… quite awesome what taking some time to learn something new can bring with it!
So, expect some Erlang posts the coming time. I am trying to think of a nice example to illustrate some of the niceties of Erlang and the OTP.