Dev @ Work

A day in the life of a developer

Designing an Online Shopping Cart, an Architects Tale

February 16th, 2009 by

Webshop Cart

For my work at Liones I am writing a technical design for a shopping cart. The requirements are fairly basic, except for one: the shopping cart must be generic to support any payment service provider (psp) and customer relationship management (CRM) system. Also there might be several different product types in the future, like: subscriptions, downloads, pay per use, etc.. These requirements make the shop very complex and a great challenge.

I started with an investigation on the internet about this subject and I quickly found out that there aren’t much articles on this topic around, but I found a few very interesting ones though. Next I started to draw some UML diagrams; I added some best practices like the Money class.

Read the rest of this entry »

About Interface Driven Design

July 29th, 2007 by

Interface Driven Design is a development methodology where you first create an interface for your object and later implement the object itself. The interface acts as a contract between the object you are developing and its consumers.

There are several advantages:

  • Flexibility, you can change the underlying implementation of an object without updating its consumers
  • Easier to refactor
  • Easier to use in combination with Dependency Injection and Inversion of Control, which allows you to swap implementations
  • Easier to test. Interfaces can be mocked more easily than concrete objects

I use IDD in one of my current projects and I must admit that I like it very much. It allows me to make decisions, like how to instantiate the object, later on in the development cycle when I am ready for it

For example: I was working a Unit of Work class which consumed a validation service. I had no idea how to implement the validation service and I did not want to think about it yet. However I knew what the contract between them was, so I could write that interface and use Rhino Mocks to mock the validation service which allowed me to finish the implementation of the Unit of Work class.

Rhino Mocks, by the way, is a fantastic framework for mocking objects written by Ayende Rahien. I started using it today and I loved right away. It is incredible easy to use and very user friendly. You can find the website of the product here. Expected more posts about it in the future!

Of course you can combine IDD with other development methodologies like Test Driven Development, which is my current way of working.

Hello NHibernate

June 26th, 2007 by

I have spend the two past days getting to know NHibernate, which is an .NET port of Hibernate: an object-relational mapping framework (ORM) for java and I am really excited about it. The framework allows you to create POCO’s (Plain Old CLR Objects) and store them in a relational database and this is where it gets exciting: it is incredible easy to do so.

NHibernate consists out of three parts: The first part are the POCO’s which interact with other .NET code. The second part is the mapping file, which describes how the POCO’s are mapped to the relational database schema. The third part is the configuration of NHibernate itself, which contains the database server and the connection string.

NHibernate contains a lot more like: querying and caching, but that is beyond the scope of this post.

Read the rest of this entry »