Dev @ Work

A day in the life of a developer

Asynchronous Payment Provider Implementation Pattern

March 17th, 2009 by Trilobyte

PaymentToday at Liones I started working on the integration of a payment service provider (PSP) for a web shop implementation. While I was thinking about the architecture I discovered that it is actually very straightforward and that most of the application flow is reusable in different implementations with other PSPs.

Take a look at the UML diagram below; you will notice that there are actually two flows:

  • One synchronous, which guides the user trough the payment screen
  • One asynchronous, which notifies when the payment state changed (payment is confirmed or canceled)

Read the rest of this entry »

Python, without using Python

August 26th, 2008 by Trilobyte

Today I faced a problem at work: I had to come up with a flexible, extendable architecture for a XML-RPC client service application. Both the client and server code had to be integrated into existing applications which makes the impact of introducing new message handlers painful if not designed properly.

While thinking about those requirements I quickly thought of a concept I saw in Python: Try to call find a callable method, otherwise do the default action. In Python you can use ‘getattr(…)’ to get a possible method of a class and with ‘callable(…)’ you can check if the method is actually a method.

You get something like this on your dispatcher object:

def Dispatch(self, methodName, arguments=None)
   method = getattr(self, methodName, None)
   if callable( method ): method( arguments )

I implemented this extensible architecture in exactly the same way. It was fairly easy to do, painless and it is extensible.

Learning multiple programming languages/concepts pay off!

The Onion Architecture

August 26th, 2008 by Trilobyte

One of the key problems in software development, especially framework development, is finding a flexible and future proof architecture. The architect basically needs to have a crystal ball to see the future. There are some techniques and development choices which can reduce the costs of change but it is inevitable that you will hit a limit eventually.

In this post I am going to talk about 1 architectural pattern which can extend the lifetime of a framework significantly. That pattern is the ‘Onion Architecture’.

Read the rest of this entry »