The amazing adventures of Doug Hughes

In my last posting, the question was indirectly raised as to what I was talking about when I said “dynamic programming”. With our approach here at Alagad, dynamic programming means taking a very generic set of constructs and then applying metadata to them to make them useful.

For example, in our generic object management system, there is the concept of a “object” service layer and business object as well as a generic object data tier. By itself, all of this code is fairly useless. The key is the metadata that describes the “objects” within the current application. Thus, we take a very generic set of code, apply application specific metadata, and voila! we have application specific coding without really doing any new coding that needs testing etc.

For an example that more people would be familiar with, take your favorite ColdFusion framework … Model Glue, Mach-II, Fusebox, etc. By themselves, all of the code within these frameworks is useless until you add a configuration file describing the different events, controllers, and views that your application will handle. With the addition of this configuration file, you now have a very application specific code base without really writing much code.

So now that we have this generic set of code, how do we describe the intent of our current application metadata? There are quite a few possibilities out there, but the two that I have seen used most often are XML and actual code. Other options could include simple configuration files (csv, ini, etc), larger scale content management systems and a variety of other custom solutions that could go as far as writing your own language and associated parser.

One example of using code to describe your metadata is the FarCry content management system. It has been a while since I looked at FarCry, so excuse me if some of my terminology is not up to date. With FarCry, when you want to add a new property or data element to your content management system, you create an empty ColdFusion cfc which contains a series of tags. The FarCry core will then read these cfc files, interpret the tags and make the new data type available within the content management system. Now does not have the necessary attributes available out of the box, so FarCry makes use of a whole series of custom attributes on the tag. I believe you can also add custom functionality using <cffunctions within the cfc, but it has been a while.

On the plus side, this method of providing metadata to the FarCry core is easy for ColdFusion developers to understand as it is written in ColdFusion which we are all used to. At the same time though, this can be a minus if you were to have your business analyst drawing up the requirements for the system instead of using your development team.

When we developed our internal object management system, we made the choice to go with XML for the metadata. By going with XML, you literally have unlimited possibilities in what information you want to collect and how you want to represent it. As long as you stay within the syntax rules of XML, you can write your own language and through the use of a DTD or Schema, validate that whomever created a given XML document followed your language. By going this route, business users or analysts can easily create and provide for you the metadata needed for your system by just knowing the syntax of your language rather than requiring them to know about cfcs and tags. How much of a benefit to you this is obviously depends upon your situation.

So, are there other examples of metadata formatting and structure out there that you have seen or prefer?

Comments on: "Dynamic Programming and Metadata" (4)

  1. I have a contact management app I’ve written that uses a series of flyweight objects for individual contact media. So as an example, the default contact media are phone, fax, postal and email. Adding IM or maybe an internal contact method like “internal extension” would be fairly easy.

    That system also works on XML files for configuring the individual media, so “phone” for example has a handful of 3-4 XML files indicating how to create an appropriate form to receive it, how to format its XML packet for storage and then finally how to display it in various formats like HTML vs. text.

    After having created that system I remember reading it described as an “external polymorphism” design pattern… and I’m pretty sure I found that on Wikipedia although now I can’t find any reference to the article where I first saw it. There is a fair amount about external polymorphism on google though.


  2. Peter Bell said:

    @Jeff, First point is to distinguish between internal and external DSL’s – such as the XMl vs. code options you suggested above. Internal DSLs are flexible, fit in to a limited extent with existing tooling and are popular amongst developers wedded to a single language and merging the DSLs with a lot of custom code. Prototypical example these days would be RoR.

    Personally I prefer external DSLs for many use cases as they are languag eindependent and you can perform many more transformations on them to generate docs, pretty pictures, to upgrade automatically betweren versions, to gen SQL, to deliver apps in multiple programming languages, etc. Once you’ve chosen external DSL, XL is easiest to get started with, but you could doa textual DSL using either ANTLR to create the parser or openArchitectureWare to gen an eclipse plugin that gives you code completion, error checking and error highlighting for your DSL – it’s very smooth. You could also go graphical with Microsoft DSL tools (not very good) or MetaEdit (much better – but very different approach).


  3. Marcuski said:
    Check out this cool mini fighting game


  4. i know alot of the diff. like ones verizon and ones at&t but what are some others? i dont know what one to get.i have verizon but i can always get an unlocked iphone

    unlock iphone 3g


Comments are closed.

Tag Cloud

%d bloggers like this: