misc

del.icio.us links not a good idea for a blog

I am getting rid of these damn delicious links. They are making my blogging output seem a little sparse. Besides, why not just subscribe to the RSS link at delicious if you want to know what I'm finding? Or better still, send me your delicious id and what you are interested in, and I will send them to you as I find them?

Daft fortunism of the day

Here is a simple experiment that will teach you an important electrical
lesson: On a cool, dry day, scuff your feet along a carpet, then reach your
hand into a friend's mouth and touch one of his dental fillings.  Did you
notice how your friend twitched violently and cried out in pain?  This
teaches us that electricity can be a very powerful force, but we must never
use it to hurt others unless we need to learn an important electrical lesson.
        It also teaches us how an electrical circuit works.  When you scuffed
your feet, you picked up batches of "electrons", which are very small objects
that carpet manufacturers weave into carpets so they will attract dirt.
The electrons travel through your bloodstream and collect in your finger,
where they form a spark that leaps to your friend's filling, then travels
down to his feet and back into the carpet, thus completing the circuit.
        Amazing Electronic Fact: If you scuffed your feet long enough without
touching anything, you would build up so many electrons that your finger
would explode!  But this is nothing to worry about unless you have
carpeting.
                — Dave Barry, "What is Electricity?"

A new end/beginning

Well, LinkMe is coming to an end. Not literally – just my involvement in it. Yes, I am off again to a new place. This time it is Readify – a smallish consultancy that specialises in emerging .NET technologies. They were recommended to me by Frank Arrigo, the group manager of the Microsoft Australian Evangelists, who rated them as an 'elite team'. Hopefully, now I will get an opportunity to indulge my secret fetish. I am an EARLY-ADOPTER! There, it's said, I'm out of the closet now.

Microsoft Australian Evangelists – sounds like a good name for a gospel-rock group…

Gorgeous Work

This sculpture is entirely handmade, by Mark Ho. The sculpture reminds me so much of the 50s illustrations by Chris Foss for Isaac Asimov's robots books.

Animatronic Human Sculpture

I love the organic look of it. It looks less a machine contorted into human form than the reverse. 

Some new themes.

No, not display themes in my blog. I'm going to start some new themes on design and development issues. There's a few things that I felt I ought to give a systematic treatment to.  I've had a few conversations lately that brought my mind back to the issues of code generation and its related patterns. I've also been playing with generic algorithms in C# 2.0 for type introspection in my DBC system. It seemed natural for me to explore the idea of using generic algorithms at the heart of code generation frameworks since a generic algorithm would allow me to reuse my code generator regardless of the metadata format or the output stream.

Consider this:

public class CodeGenerator<DataSource, TemplateSource, CodeGenerationPolicy>{ 
// ... 
}   

 
using CodeGenerator<DatabaseModel, 
	DatabaseSqlCreationTemplate, 
	SingleFilePerTopLevelElementPolicy> SqlCreateTpl; 
SqlCreateTpl tpl = new SqlCreateTpl(GetModel(), 
Factory.GetTemplate(typeof(DatabaseSqlCreationTemplate)), 
	Factory.GetCodeGenPolicy()); 
tpl.Run(); 

Neat huh? I'd prefer to write code like that than write code that must explicitly acknowledge where the data comes from, what it's format is, and how it is to be disposed of in the code generator. Up until now, I have achieved design-reuse, but never code-reuse. From looking at other code generators, the problem abounds. Most systems I have worked with provide the code expansion part, and the template language part, but tend to stick to a single metadata source when it comes to generating code or other artifacts.  A case in point are the persistence-tier code generators that purport to be general purpose code generators but that only take data from a specific database API. These don't provide the degree of genericity required to share code between wildly different systems such as a DBC proxy class generator and an Object to Relational mapping system. In the first example our data comes from reflecting the metadata of a .NET assembly in the later it comes from reflecting the schema of a relational database (or both). We need a code generator that will work regardless of where it's data comes from, and how and where its output gets generated. We need to separate the algorithm of the code generation process from the structure of the metadata source, and they both need to be isolated from what happens to the stuff that the template system outputs.

The solution of these problems was the grail of the beautiful C++ Standard Template Library of Alex Stepanov. It is still a matter of debate whether something like the STL is possible in C#, but early work  is yielding possibilities that hold out hope. I propose to give code generation the STL treatment. In the process I will explore many related ideas that have been bugging me about my ORM and DBC systems. Chief amongst those is the matter of policy vs configuration and how you store them.

There's my manifesto for the weeks/months ahead! I have some holiday coming up, so I may even deliver on the promise. ;-)

Another Source of British Pride?

In a conversation I had with a colleague, it came to light that the British have another reason to be proud of their national heritage. As you may know, they were the nation that invented the queue. they take to the queue as ducks take to water, and queueticette is installed in their youth from the cradle. Not content with that, the British graduated in the 70s from simple linear queues to more complicated non-linear arrangements. It is arguable that modern operating systems would never had reached their current degree of multi-processing capabilities were it not for the British obsession for queueing.

We’re talking about the magic roundabout in Swindon. I have gone through the magic roundabout twice. Both times I went in accidentally and with trepidation, and came out elated and enthused. Perhaps that is the essence of many pieces of post-war British town planning. East Dumbarton is another example – I went in thinking I would get knifed and came out overjoyed about the fact that I didn’t.

I’m not sure such roundabouts would get built these days. The 70s in Britain were a time of regrowth and increased confidence, when we ‘never had it so good’. Filled with confidence, people knew it was OK to experiment and try new things – drugs, free-sex, rock-n-roll, roundabouts, whatever! Nowadays, such experimentation would never get off of the drawing-board. Not because of traffic flow analysis but because of the weaselly bean-counting tossers who are the secret police enforcing the modern day tyranny of the nanny-state. These people enforce a Maoist level of austerity on the British public in the name of ‘Health and Safety’, they are insurance brokers and health and safety officers.

FACT:You can’t have hanging baskets in public spaces any more, because they might fall on people’s heads!
FACT: A hanging basket has never actually fallen on anyones head in the UK. The premium increase is not founded on any actuarial analysis, therefore it must be based on a desire to remove hanging baskets from town centres.
CONCLUSION: Insurance Brokers and H&SE officers are effecting social change in a way that is gradual and hidden from view, and in a way that is profoundly negative.

In Britain we like to criticise the American’s for their litigious culture that turns ordinary professionals into timid cowards for fear of punitive legal measures. We have no reason to be conceited though – we are equally held to ransom by the insurance profession. They don’t take us to court, they raise our premiums. It deadens the spirit to even think about what levels of crawleyage have been perpetrated in the name of H&S.

Anyway, rant over. Hats off to the town planners of Swindon who had the courage to strike out against the lowest common denominator, to forge a path to the non-linear via the nirvana of roundabout confusion! The Swindon magic roundabout is a mandala, a traffic koan, a map charting the path to enlightenment and heaven on the highway of life.