July 9, 2011
A few weeks ago I attended a great Geek night at Trifork. The speaker was @drkrab, and he was talking about “Actor oriented programming”.
Knowing Kresten’s work in recent years, it is obvious that this talk was very inspired by Erlang. In fact, much of it was about Erlang, but he only briefly touched on his Erjang project (which was nice for those of us who saw his Erjang talk at last year’s GOTOcon).
Erlang is “designed for reliability in the presence of errors”. Others (notably @drkrab) can explain what this means better than me, but the following is a quick tour of some of the highlights as I understood them from the talk.
An actor is an “active object” (ie. an object containing its own thread) plus a state machine. In Erlang, actors are implemented as processes which are designed to be very lightweight. Kresten mentioned that the size of a process in Erlang is comparable to that of a Hashtable in Java, so literally millions of processes can coexist in the same Erlang VM. Processes can be hooked up to monitor each other, so that if one process dies, it can be restarted by its monitor process. Error handling is done very differently than in other languages: In general, don’t try to cover all possible error cases by coding defensively. Instead, let stuff crash and make sure that the system as a whole is resilient.
Processes communicate with each other by passing messages in the form of immutable data structures. Often, communication will simply be one-way, or it may be indirect in the sense that process A receives a message from process C in response to a message it sent to process B. In this scenario, process B will typically have spawned process C as a worker for handling that particular request. The interface of an actor is called a protocol. It can be thought of as an API except that it may change with the internal state of the actor.
The basic premise of Kresten’s talk was that we as developers are headed towards a revolution. Just like object orientation was a revolution about 15 years ago, the internet age will be forcing to change horses again soon.
This is a very interesting theory which sounds very plausible to me. I’ve heard the topic mentioned many times before in different forms, but this was the first time I had heard anyone systematically explore what may be going on right now, and I found that really interesting.
Kresten started by exploring the anatomy of a scientific revolution, using the classic example of the geocentric vs. the heliocentric model of our solar system. Assuming that the earth is at the centre of the universe obviously made the orbits of our neighboring planets look very strange. Also, I’m sure there was a multitude of other problems I know nothing about.
So there were a lot of observations that were hard to fit into the model, and this is a sign that a revolution is needed. And indeed, a very painful revolution was needed in which lots of scientific effort was suddenly rendered obsolete, and lots of frustration had to be endured.
Software professionals saw the same thing happen with the advent of object orientation. There were lots of misconceptions and resistance initially, but as history has shown, OO turned out to be a very useful paradigm.
However, we may be on the verge of the next revolution. The internet age is profoundly changing the way we build software – everything is now much more decoupled than is used to be. We often build new systems by integrating lots of existing services, each of which is outside our control. So increasingly, we need to design for reliability in the presence of errors. Sounds familiar?
I have thought about this talk a couple of times over the last few weeks, and I am pretty convinced that Kresten is on to something. And when I try to put these ideas in the context of my day to day work, there’s at least a partial match.
Much of what I do is Ruby on Rails programming, and in that community we do a lot of integration work. Not integration in the SOA sense, but integration in the form of consuming services provided by other parties. More and more frequently, we use web services to supply functionality that is just easier to buy than to develop from scratch. A good example is mailing lists. I don’t know anyone who would still opt for a DIY mailing list system when we have services like Mailchimp which are feature-rich, affordable and very solid. It has just become cheaper to buy services like this. Error reporting is another good example. I pay $5 per month for my Hoptoad account – this is so cheap that I wouldn’t dream of rolling my own solution. It just wouldn’t be cost effective because my time is much better spent working for clients.
These external services may be down from time to time, and we need to be prepared for that. Were we to implement them in our own software, they would be down from time to time as well, but that downtime would often coincide with the downtime of the client software (which is especially scary in the case of error reporting – related, check Avdi Grimm’s war story on the latest PragProg podcast).
Apart from RoR I do a lot of Android programming, and some of the ideas apply here as well, but I think putting them into practice is further off into the future. Mobile devices certainly need to handle errors well (loss of network connectivity is a very real issue), but changing the programming paradigm to something like Erlang doesn’t seem to be right around the corner.
However, the Android app I’m working on right now is written in Scala, so maybe I should try to sneak in a few actors ;-)
May 31, 2011
Today, after reading Zed Shaws latest blog post, I did something really stupid.
Of all internet phenomena I’ve come in contact with, trolling is probably the worst. And although I think Zed is not helping the situation by being so harsh, I can understand why he is really, really pissed off.
In response to this, I started a repo on Github of known trolls. I tweeted about it and Mentalizer correctly pointed out that my repo was more or less an act of trolling in itself. Such a list is worthless without some kind of public criteria for who goes on there, or at least some sensible definition of “trolling”. I offered neither, and I wasn’t prepared to put in the effort, making my initiative decidedly half-assed.
So my public repo of trolls was a bad idea. What do we need instead?
Another bad idea
Here is another well intended but probably really bad idea. I’ll build a site that allows you to propose trolls and allows registered users to vote up their troll-ranking. It will be complete with an API to retrieve someone’s troll-score and automatically blacklist them from your site.
Why is this a bad idea? Well obviously, if I actually built such a site, I would be the first name on the list, voted up by hundreds of actual trolls. So by my own definition, I’d be a troll. If this became popular (which it would have to in order to fullfill its goal), it would become a warzone of mudslinging and attempts to destroy people’s reputation.
This is not the first time I have thought about how to help the internet getting rid of trolls, but hopefully it will be the last, because I feel like I’m wasting my time. I think it would be a huge accomplishment to reduce the amount of trolling to a tolerable level, on the same scale as what Google is doing to fight spam or what Stack Overflow is doing to fight ignorance.
But it all comes back to the old advice: Don’t feed the trolls. By creating any public list, voting based system or whatever, I would be feeding the trolls. My problem is that I don’t really understand the psychology of trolls, so I keep thinking up all kinds of elaborate systems which all fail in the same way: By acknowledging the trolls, feeding them.
Fighting something by ignoring it is really hard.
May 30, 2011
Have a look at this page:
OMG, it includes the word “participle”, WHAT DOES IT MEAN?!?
Well, what you have no way of knowing is that you can double-click this or any other word and go to the entry for that word. Not a bad feature at all, but not very obvious either
January 14, 2011
Although I basically agree with the Pragmatic Programmers’ old advice about learning a new programming language each year, the time has come for me to slow down.
Why? Very simple. I still have so much to learn from Clojure. I could write at length about the virtues of functional programming or about how Clojure takes advantage of the JVM. I could go on and on about the REPL, Java libraries, infinite lazy sequences (list of all primes, anyone?), the exceptionally smart community members and so on. But others have already done this much better than I could. For a great introduction to the language itself, go watch the intro videos by Clojure creator Rich Hickey. For all the surrounding stuff, there are lots of interesting blogs to read.
Likewise, although I have a lot of experience with both Ruby and Rails, I’m not done learning here either. Especially, I need to tune my Emacs to achieve better code navigation and debugging support.
Two languages that I really like. This year, I’m going to focus, not diversify.
May 7, 2010
Here’s a surprisingly insightful blog post from Matt Aimonetti. Yes, the guy with the “Perform like a pr0n star” CouchDB presentation.
I really hated this guy when the heated debate about his talk was running (when was this…some time last year?). He responded to the comments he got with such arrogance and lack of respect for other people’s emotions that a lot of us were appalled. I really felt (and still feel, actually) that he did damage to the reputation of the entire Ruby community. The fact that DDH stood behind him obviously just made everything worse.
Now all this seems to be forgotten, and that’s certainly a good thing. I had personally forgotten all about the issue until I came across this blog post. And it completely changed my feelings about him. It’s really great to see that a lot of people do change when they get a chance to sit back and reflect on the stupid things they’ve done. Everybody should get a second chance if they want it, even a guy like Zed Shaw if he comes to realize some day that he’s being an asshole.
Well done, Matt. Looking forward to following your work in the future.
April 20, 2010
I’m often surprised by the amount of effort people put into getting things done. Reading books, blogging about it (I realize that this is what I’m doing right now, but I’ll keep it brief), using all kinds of fancy software etc.
Sometimes, you really just need to keep it simple. One example is email. Most of us get a lot of email, and it can be hard to keep up.
Here’s my solution: Whenever I get an email that I need to respond to, I either respond to it immediately or “star” it in GMail. Every time I have a few minutes to spare, I go over my folder of starred messages and respond to them.
Keeping it very simple, and this works perfectly for me.
January 16, 2010
I have come to realize that I talk a lot about Clojure, but I don’t really use it.
I am very excited about functional programming in general and Clojure in particular, so I spend a lot of time catching up on the news on this front. Lots of stuff going on, always.
The other day I sat back for a moment and looked over the hundreds of blog entries piled up in my reading list. Suddenly I realized that most of these would be conveying actual experiences with some language or framework. Be it Ruby, Clojure, Erlang or what have you, these authors have actually tried something out and written about it.
This is more than I can say for myself, unfortunately. I do have several pet projects underway, but I’m not making nearly as much progress as I would like to. Why? Because I spend way too much time reading about new stuff. Reading about what everybody else have been making progress on.
So I have decided that I need to code more and read less. Pretty much the opposite decision from the one I made a few years ago, but hey, times change. It’s a tough balance to strike properly, but I guess we all do the best we can.
Right now I’m splitting my spare time between two areas: Functional programming and dynamic languages. More specifically Clojure and Rails. I have a lot of ideas for projects in both camps, but like I said I’m spending way too much time catching up. I have seriously considered ditching one of these areas completely, but I just can’t do it. Both are extremely interesting from different points of view.
And since I need be both places at once, I must be very careful about how I spend my time. If I want to move forward with my projects, I can’t afford to spend entire evenings reading up on almost a hundred technical blogs. Even worse, almost every single entry is tempting me to go on out on a tangent. So much interesting stuff to learn, so little time. But I’m not really in it for the learning. What I really love about being a geek is the part where I create new stuff. And I think that is what I’m good at, too.
I really need to start walking the walk. It’s OK that I’ll fall a little behind the newsstream, because I’ll gain a much deeper understanding of the areas I choose to focus on. And before long, I should be able to contribute interesting new stuff on my blog as well.