Month: March 2006

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.

The Wandering Glitch is Moving

The Wandering Glitch is moving to wordpress.com.

I finally grew irritated with not being able to categorise my blog entries. So I’ve moved over to WordPress, which in some ways is not as good as Blogger (esp the WYSIWYG editing) but blogger broke down the other day, and precipitated this fickle blogger to jump ship. Doubtless I’ll be back, but in the meantime I’ll be found at http://aabs.wordpress.com/ and if you are Web2.0 savvy (and lets face it – who isn’t these days, I mean, HELLO-O?) my RSS feed will be at http://aabs.wordpress.com/feed/. Of course if you are only interested in one category (like photography) then you can access its feed on http://aabs.wordpress.com/tag/photography/feed. Cool Huh? Yeah, that’s why I changed.

Of course flickr can still publish to wordpress, so you’ll still be able to check out selected blogged photos. If you want the photo-firehose just connect to the feed on my flickr account: http://www.flickr.com/services/feeds/photos_public.gne?id=81359372@N00&format=rss_200 And beware – several hundred new photos are gonna be uploaded any day now. I shall have braodband by the end of the day (with any luck up to 1MB/s) so I may decide to archive the entire 3GB of photos to a private set on flickr…

Podcast rant – the Dilbert Principle as revealed by the signal to noise ratio of IT podcasts

There are many press releases on the web discussing the wonderful (or terrible, depending on your point of view) development of academic lectures being distributed to the world at large as podcasts. I fall firmly in the camp of those who think such a development is a mark of progress and a step towards realising the dream of free access to high quality ideas and well-thought-out commentary that will support the growth of civilisation in this increasingly dark age that we inhabit. So, you will not be surprised to learn, I went in search of the aforementioned podcasts to feed my yearnings for something substantial from my web trawling. Imagine my disappointment when I went to several podcast directories to find those golden podcasts [that are worth listening to] only to discover that there are literally millions of the blasted things that purport to cover science (or whatever discipline you want) but which are actually low-bandwidth channels for the diseased ramblings and insane imaginings of their loopy hosts. For example, under Philosophy one is more likely to find fundamentalist born-again christian, muslim, buddhist or fruitarian podcasts than rational argument on the nature of reality. My personal favourite is “MessiahCast“. As with academic journals, moderators and peer reviews are essential for the medium to be of any worth. After all, why would I be interested in exposing myself to mongrel strains of the virulent memes of total strangers? Anyway, I did find offerings from Stanford, Harvard and Bath universities. That is a pretty poor showing considering that Apple cliams to have a whole branch of iTunes devoted to university podcast hosting.

WHERE IS IT?