Saturday, 22 September 2007

I Don't Get Jeff Atwood

I read quite a few blogs, on different topics, but there is (obviously) a whole bunch of computing ones in there. I read some of the big name ones, like Joel on Software and The Old New Thing, as well as some that could possibly be regarded as second-tier in the blagosphere like Intertwingly and Steve Yegge.

But one big name blog I don't read is Coding Horror, by Jeff Atwood.

His posts appear pretty often on or, friends (who I respect) read him and recommend his articles, but I just can't figure him out. Sometimes his articles manage to completely miss the point, and other times he reasonably succinctly describes a simple concept.

For example, the post Building a Computer the Google Way contains an historically interesting photo of Google's first server. This server is interesting because it is fairly clearly a cobbled together set of home-built servers with some custom designed hardware. These servers were built by Google from the PCB under the motherboard on up. Sure, they used commodity parts, but I can guarantee there are some unique pieces in there. Probably in the vicinity of the interconnects.

This is an interesting example of how a successful company will control everything that possibly relates to their business. You can't afford to rely on the off-the-shelf components for anything that might be technically critical. For Google, indexing and querying speed were hyper-important. So they built their own hardware. Amazon did something similar when they wrote their own web server. Always remember these example when you're railing against Not-Invented-Here syndrome.

Unfortunately, Coding Horror proceeds to use the Google example as justification for why every good programmer should build their own PC instead of just buying one from Dell. I'm sorry, but I can't see how reading specs on PCI slot counts on a motherboard are going to lead to building the kind of server that could support Google's load, or perform their proprietary indexing any faster.

However, on other occasions, Coding Horror does actually manage to explain concepts accurately and clearly. Though I'm usually left thinking, this only occurred to you now? See Everything is Fast For Small n and You're Probably Storing Passwords Incorrectly.

He does, however, write well. And there lies a real skill. If only he could be brought up to speed on some actual modern computer science and software engineering concepts, we might have something.

Monday, 3 September 2007

An Effective Use of Limited Transport Infrastructure

I wonder if I'll be arrested as a subversive for posting this?

Method Dispatch and Scheme

As I work on Shrew and attempt to learn more about Scheme, I've been doing some reading. And in one of my books I had one of those 'Aha!' moments where I really saw the benefit in the Scheme way of doing things.

In object-oriented languages there are two approaches to dispatching methods.
  • Message Passing: Objects are regarded as actors. Method call is treated as sending messages to those actors. Method dispatch is therefore determined solely based upon the type of the receiver of the method, the types of any arguments is immaterial. SmallTalk typifies this style. C++, Java and most other OO languages have adopted this style (badly.) This is also known as single-dispatch.
  • Multi-methods: Methods and the objects to which they can be applied are regarded as a cartesian product: objects don't own methods and methods don't own objects. Method dispatch is therefore determined from the type of all the arguments equally. CLOS uses this style. I am not aware of any other widely used languages that also use multi-methods.
The book I am currently reading laid out some Scheme code that showed how to implement multi-methods, and then followed it up with some code that implemented message passing. In both cases the code was extremely simple and easy to understand: the basics for two object-oriented approaches were right there on the page.

And most interestingly, there was no reason why both systems couldn't be used on different objects in the same program.

The book is about general computer science concepts, so it doesn't actually point out what it has just described, and nor does it provide a complete implementation of an object system (yet...) however it is interesting to see such a fundamental part of a object system in so few lines of code. It is the nature of Scheme that makes it possible to implement things that other languages regard as 'part of the language' in your own programs.

It is not possible to do this in Java; it is not possible in C++, not even with template meta-programming; and it isn't even in possible in Haskell*.

Now, that's not to say that having both multi-method and message passing dispatch is itself such a killer feature. But it's going to be kind of hard to beat a language to which both of these things can be added so simply.

* Of course, via differing mechanisms of varying degrees of pain, something like multi-methods could be added to all of these languages. Here I am talking about a simple, transparent at both caller and callee technique for achieving multi-methods and message passing.

Original Policy

Has a century of compulsory voting and a decade of international neo-conservatism finally killed off the last vestiges of original thought in governmental policy? It certainly feels that way.

As Australia approaches a federal election both major parties are competing based almost exclusively on policies either of cutting taxes in some form or giving money away in some other form. Is there no other mechanism of directing society? Surely there must be.

Look at the first home buyers grant. Instead of just cutting the price of a home, how about some other means of encouraging saving that isn't giving away the beginning of bank account? Where is the inspirational leadership and original thinking that gave us the Industrial Relations Commission; the Truth and Reconciliation Commission; the Marshall Plan?

That's the sort of thing I'd like to vote for.

In my other world of software development, this 'just give money away' approach is known informally as Econ 101 Management; as in it follows an economic model informed by only an introductory understanding of macro-economics.

I'd like to hope that our elected leaders knew a little more. Now please go away and demonstrate that.