After having more exposure to both Smalltalk and (Common) Lisp, I realized that their why of doing things just didn't feel natural. I worked more because I set the goal to learn the language, not because I was passionate about them. It was well worth it and I'm sure I'll have a look at them at some later moment again.
SmalltalkWhat a well engineered language! I said "engineered and I meant it. The structure is very logical, the syntax easy and code is well readable.
But everything is foreign. It lives in its own world separated from the rest of my computer and this world is strange. I feel I would have to live in this world, too, if I wanted to use Smalltalk more extensively. It's not for me.
Nonetheless, I recommend everyone to learn a bit about Smalltalk. It helped me a lot to improve my understanding of
good object-oriented design, people should look at Smalltalk instead of Java or (like in my case) C++ to learn about OO.
A good starting point is
Squeak by example. It helps the user getting started and navigating around in this strange, yet fascinating world that is Smalltalk (Squeak).
Common LispTalking about fascinating, I continue to CL. I've worked with CL from time to time, learning a lot of concepts on the way. Now I finally got hold of a copy of Paul Graham's
ANSI Common Lisp, after having read parts of
Practical Common Lisp and
On Lisp in the past.
While in the past, I was more interested in understanding the possibilities of these concepts the language offers, I actually wrote code this time.
It was surprisingly hard to solve many problems, because I couldn't express my ideas like I wanted. Like in the past, I could describe the solution with words. But translating these words into working code was not as straight-forward as I exprected it to be.
A simple example: Take a string and return a list with the number of occurences for each character, sorted by the number of occurences.
The solution is easy: The solution will be stored in a list of cons-cells with the character and the number of occurences (i.e. an assoc list). To fill this list, look at each character of the string and see if it's already in the list. If it is, increase the number value by one, if not add it to the list with count 1. In the end sort the list by the number of occurences.
Nonetheless it took me quite some time to write the solution in Lisp. A big part was that I had to learn about functions the standard library offers and how exactly they work. The standard library is huge and good documentation seems to be rather sparse, making this more difficult than it should be.
In the end I had two main complaints:
a) Writing these wonderfully concise functions is a lot of work and trial and error. I'm sure it's different for people who think in Lisp, but I found myself to be unproductive. My first steps with Perl, for instance, resulted very fast in something usable. With CL not so much.
b) The library seems to include functions for everything and the function names are very long. This makes code unpleasent to read and actually harder to understand. At this point I would have loved some syntactical sugar for common operations instead of calling a function for everything.
Now what?About a week ago, I read about a
Django tutorial experience and decided to try it out. I was amazed by the ease of use and conciseness and decided to learn Python.
So I started a new
project and I continue to be amazed. Python is certainly not perfect, but I find it easy to express ideas and the documentation is very good.
What I like most, is how little work is necessary to do things which are difficult in other languages. I started unit testing, because it is so easy with
nose, and it really helped to improve my code.
Functions are generally only few lines with short operators. So far the only thing I missed is pattern matching, which would have made my code easier.
I'm looking forward to doing more with Python, let's see what other things I encounter.