Monday, January 23, 2006

Consideration of Time Zone in new Logging Application block

While working on a project around 3 months back, it was once a requirement for me to correlate logging timestamps across timezones and to deal appropriately with the transition in and out of daylight savings time.

I just came to know from Tom Hollanders blog that the new Logging Application block of the Enterprise Library changes the LogEntry.TimeStamp property from being a local time to a UTC (aka GMT) time, which i think is great.
Check it out in the new Enterprise Library 2006 for .NET Framework 2.0.

Essence Pattern

My Blog readers would know that for past 4 months I have been working as a professional Software Developer.
Recently we came across a tricky situation. Let me explain the scenario first.

We make use of IBM’s Insurance Application Architecture (IAA). Not many people have heard of IAA. Briefly, IBM Insurance Application Architecture includes a business model; a design model of components, interfaces and messages; a generic design framework for product definition and agreement administration; and design models for the creation of data warehouses. Integrates with legacy systems from different platforms to leverage your previous investments and is compatible with widely-used design tools and methodologies, supporting open standards-based technologies.
In our project, the Business Process Components make call to business components which are part of the IAA solution.
Problem:
The parameters required on individual BPC/BC are passed in main calling BPC operation. This results in the calling BPC operation becoming too parameter specific.
Design Requirement:
Cannot View one BPC operation requirement from another.
Need to populate required parameters independently.

In simple terms, we cannot change the IAA method signature, so we need to pass in the parameters in some other way.
Here in comes the Essence Pattern: The Required parameters at various component levels need to be pushed as attributes on calling BPC. i.e. using Essence Pattern.

Essentially the Essence Pattern provides a way to enforce users of an object to enter valid properties for that object. We can use for our purpose by tweaking it a bit and verifying that only the appropriate parameters are passed to the Business Components and the other parameters are pushed as attributes.

There are some advantages and disadvantages to be had from this:
Advantages
1) Main BPC operation will not be parameter specific
2) Can expose multiple output parameters
Limitation
1) Client Creation of object out of design control
2) Cannot Enforce Compulsory/Optional attributes on class
3) Also order of attribute execution

In the present scenario it solves our purpose and provides an elegant solution. This was my first design pattern implementation at the company. I have done quite a few for my personal projects, but never before at the company level. And tell you what I enjoyed every bit of it.

For your reference:
Essence Pattern Paper:
http://jerry.cs.uiuc.edu/~plop/plop98/final_submissions/P10.pdf

Essence Pattern C# Implementation:
http://www.codeproject.com/csharp/essencepattern.asp