3 Sep 2002 ade   » (Journeyer)

I've been aggressively refactoring the way special pages work in KwikWiki. The current code is rather embarassing as it hard-codes the names of the special pages in a chain of if...elses. I've used a technique that I also used in writing the Emacs keybindings in Moleskine. Namely a hashmap from some string to a function. Except that in Java you can't just have a dictionary literal with anonymous functions. You have to go to all the trouble of setting up an interface so that you can then use anonymous inner classes which all extend the same interface.

The annoying thing is that I've been claiming on Wiki lately that Java doesn't need blocks and now I realise that blocks or rather first class functions can simplify a large class of problems. For example most implementations of the Command pattern would be much better off using a hashmap that contains functions rather than the scaffolding that OO languages require. Henry Baker made the same point a long time ago. A lot of design patterns are really nothing more than a codification of work-arounds for the deficiencies of a particular OO language. Object-functional languages remove the need for many of these patterns. This raises the question: do we really need any pure OO languages or should they all be object-functional?

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!