środa, 2 września 2015

Programming as Speaking

My original reason to run this blog was to promote a certain vision of programming. In particular, I want to prove that programing can and should be more like speaking than tinkering, and that more emphasis should be put on expressing ideas in a comprehendible manner, than on developing working systems. This view may seem controversial, because --in the parlance of our times -- it's "the working systems that deliver business values" -- but I think that many valuable projects may have sunk because they got to the point where there was noone available to further maintain them at their complexity level.
And the reason for that is that it is usual that programmers treat programming as tinkering. There are unimaginably many ways to solve programming problems (or -- how Larry Wall would put it -- There Is More Than One Way To Do It).
Interestingly, although Larry Wall has linguistic background, there are so many ways he got wrong in his Perl programming language.

The people focused around Python deliberately took an opposite approach to Larry's -- they say that there should only be one legitimate way to do some things. Although it is inevitable that programming languages would allow many ways to do the same thing -- just as there are many ways the same thought can be spoken -- only the most obvious solutions should be prefered in the long run, and the remaining ones should be discouraged.

This is something that programmers had to learn for a long time, and I think that it still isn't obvious to the majority of them. The reason is that initially it was common to use assembly, or perceive a computer program as a set of commands, rather than a description of itself.

The value of functional programming is not that it allows to form very abstract and difficult to comprehend notions, like Haskell's monads or lenses. (Actually I think that this is a dangerous extreme that should be discouraged in everyday practice). The functional programs are descriptions of systems, rather than sets of commands. Functions and immutable objects are like words or notions. You can do no harm with words or notions. They don't change anything in the world; only actions do. And while actons are inevitable in real-world programming, functional programming teaches to be careful with actions.

Imagine a situation that your words cause side effects. You say, for instance, "Those blue flowers in the garden are beautiful". And each of those words has a side effect associated, for example, uttering "blue" causes windows to open, uttering "flowers" causes lights to switch, and so on.

It would be weird. But this is normal for some programs, whose authors didn't internalize the notion of functional programming.

Years go by...

It seems that I don't update this blog too often. Don't know if that's going to change or not, but it still exists, so I can add in a couple of words from time to time.

While I was absent from here, I have been mostly occupied with my SLAYER project. It stalled, however, in February, after I released the pose editor (available as one of the demos of SLAYER). I even made a video-tutorial:

Also, I've been helping my dad to run his site, devoted to Nordic culture and Icelandic literature, because he came up with an idea that he will be translating Icelandic sagas to Polish and give them away as free e-books. The website (entirely in Polish) can be found at e-sagi.pl. I used a weird Python/Django framework called Mezzanine to set it up, and to be honest, I regret that I didn't choose to use Wordpress, although I much prefer Python over PHP when it comes to programming language design.

Dad also came up with the idea of reviving the old Nordic game of Tafl to be played online on the web. I wrote a prototype, but somehow the project stalled, I guess because there was no one willing to test it. You could try it out here and share some feedback with me, if you like (it requires two players, so you'd need to couple with a friend)