Thursday, April 28, 2005

Developer-enhancements

I'm trying to work through the "Designing .NET Class Libraries" series, and came across this from the notes accompanying the Rich Type System episode:

"Slide 56: Did anyone happen to use a very early, pre-beta release of the .NET Framework and actually see the PrinterOnFireException? I would be interested to hear if anyone actually spotted this..."

It reminded me of something I once saw this on an internal functional requirements document: "System back door for blackmail ... in case we all get ripped off"

Monday, April 25, 2005

Enterprise Library

I realise I'm a bit slow on this one, but the patterns and practices group have released all of their application blocks in a single download - the Enterprise Library. I'm not sold on all of it (e.g. I'm a log4net man myself), but the download now includes QuickStarts and full documentation, making it more of an SDK than simply a set of useful components.

Latest BizTalk Bloggers Guide

Get it here.

Thursday, April 14, 2005

All change

I've started a new job this week, for a startup working in the Windows Media world.

As an early introduction to the music business, I spent this afternoon in a meeting with a major record company where I had to sit on a spacehopper!

Tuesday, April 12, 2005

BizTalk performance aticle

I was lucky enough to work with Wayne Clark on the BizTalk JDP a while back, and so can appreciate that he definitely knows his stuff, making anything he posts worth reading. This is an excellent article on the internals of the BizTalk engine, and how it handles high loads.

Sunday, April 10, 2005

Flickr

Apologies for the formatting - not quite sure what's going on here...




















I've started using Flickr to store my photos online. It's still in beta, and a little buggy, but it's a fantastic Flash application - a genuine rich-client experience. This is a pic of the Aiguille de Midi - the starting point of the Vallee Blanche ski run.
This is a shot from the Refuge du Requin, about half-way down the Vallee Blanche.

A shot from the top of the Grand Montets. It's hard to
see in this thumbnail, but this is the start of the Haute Route, and if you look hard, you can see a series of zig-zag tracks making their way up and out of the valley, towards Zermatt.



Finally, some moguls, for those who like that sort of thing.

Wednesday, April 06, 2005

Concurrent connections when consuming web services

Think I may have mentioned this before - but check out this post from Darren Jefford re. the low-level throttling of web requests when consuming web services from BizTalk.

Monday, April 04, 2005

Unit testing and data access

Something that has come up in conversation recently wrt unit testing is the subject of how to unit test complex code fragments that use data persistence code, without having to interfere with source databases / reset data etc. It would be great to be able to test the code with 'static' data that is known to be correct (or incorrect if testing exceptions) that passes through the DAL, but does not require 'real' data access (e.g. you might want to unit test a business component method that internally calls the GetMyObject() method).

My current DAL technique of choice turns out to have a nice side effect in making this possible. I tend to start development by creating an abstract data layer with no concrete implementation. I then use a factory class to create a specific DAL object using dynamic class loading. This way I can create multiple DALs and switch them in and out using config values, meaning that I can use a static file-based DAL for unit testing, and then switch in the real SQL DAL class during end-to-end testing.

It's served me extremely well over the past year, and I now tend to do all my development by starting off with simple Xml based DALs for proof-of-concept work, before moving across to SQL versions, without having to change the business code. (Just for reference, the reason I did this in the first place was to decouple the development of the business components from the DAL components on a project - I wanted to finish the business logic whilst I was deciding whether I wanted to try developing with MySQL rather than SQL Server.)

Of course, I don't actually do much coding these days, so this may all be a bit old-hat. I'd also favour using an O/R tool these days (e.g. Genome) for data access.

e.g.
public abstract class CustomerManager
{
public CustomerManager(){}

// this logic presents client classes with a single method
// for updating / creating records, another personal favourite.
public void SaveCustomer(Customer customer)
{
if(customer.Id == -1)
CreateCustomer(customer);
else
UpdateCustomer(customer);
}

protected abstract int CreateCustomer(Customer customer);

protected abstract void UpdateCustomer(Customer customer);

public abstract Customer GetCustomer(int id);
}

public class XmlCustomerManager: CustomerManager
{
public CustomerManager(): base(){}

protected override int CreateCustomer(Customer customer){...}

protected override void UpdateCustomer(Customer customer){...}

public override Customer GetCustomer(int id){...}
}

public class CustomerManagerFactory
{
public static CustomerManager CreateCustomerManager()
{
Assembly assembly = Assembly.Load(AssemblyName, Version, Culture, PublicKeyToken);
object o = assembly.CreateInstance("XmlCustomerManager"); return (CustomerManager)o;
}
}