pondělí 2. června 2008

Brave New World to Explore

Programming in C-like languages for some time (not very long compared to others, I admit), I have recently "discovered" new programming world that filled me with excitement and joy of programming again.

For some time, I am trying to improve my programming skills by learning not only about new language features of mainstream languages but also by looking at other, not so common ones.

Last year I was coping with Common Lisp and, after wading through Practical Common Lisp, I was able to even solve some minor problems on Project Euler. However, although the language is certainly interesting, I had to force myself to play with it (partially due to strange syntax, or lack of thereof and partially due to my search for usable free IDE). Even so, the experience gave me some new insights to the craft of programming and my trip to the lisp world was very interesting :)

This year I was planning to venture even further to the world of functional programming and began with Haskell. But my choice of introductory material was an unhappy one. Write yourself a Scheme in 48 hours is interesting book, but very hard without previous knowledge of Haskell and I didn't make it far. I played with Haskell without access to the Internet and it really didn't work. But I will certainly return to this book after I digest some easier Haskell book (maybe A Gentle Introduction to Haskell).
So, what is this new exciting world, you ask? Well, it's new just for me, but this new world is world of Python. The language is somewhat familiar and does not contain so foreign concepts as lisp or Haskell, IDE is just about quick install and you can begin to work. And the vast array of libraries! No wonder Python is being called to come "with batteries included." Great benefit to studying and embracing Python is also Mark Pilgrim's awesome book Dive Into Python, which is very readable and funny too.

After learning languages with not so big practical use and less advanced "infrastructure", it's refreshing not to be forced to look for long hours how to solve trivialities.

So, what's there to like? First and foremost, the readability. Python was designed with readability in mind and (from the little knowledge I have acquired so far) this design was quite successful. One thing that seems to add to this readability is the fact that whitespace is significant. Thus, the programmer is not only advised, but even forced to behave according to the standard.

Being dynamically typed language, the pythonistas are required to maintain greater discipline then Java or C# programmers. Again a good thing - writing unit tests becomes a necessity and thus further increases the quality of the code. And dynamic typing seems to result in a lot less code than is necessary in C# (and company).

One thing I am a little concerned about is the fact, that a lot of things are just a matter of convention (i.e. naming first argument of instance methods 'self', not-so-private private methods and a few others). But even in C# it's possible to change private variables of classes via reflection, so Python maybe just makes this easier. However, in both languages this practice is despicable :)
All in all, Python once again ignited my desire to learn new things about programming. Well, my queue of languages to learn is still quite big (and it seems that it will never reduce to zero). In the future I hope to dwell a little into Erlang or once again try my luck with Haskell.

So, if you are yet living in Java/C# world only and want try to look a little further, I think Python is a safe bet - it's a language not that drastically different (or outright hostile) from the others you know ;)

- Note: Virtually everything I am writing about Python is just my feeling I got from playing with it for a while and reading about it on the web. So beware, I am not speaking out of personal practical experience (that will hopefully come later ;)).