Just another (occasional) brain dump on technology and the technology industry...

About Me

My photo
I enjoy wine, laptops, walks, bicycling with the kids and long drives. I am constanly reading. In my heart I am a teacher a salesman and a technologist.

Friday, September 19, 2008

Rolodex - Interface Based Programming

What is an interface?

An interface is a promise. A naked interface cannot do anything. It states, in black and white, what it will do for you. Don't count on it to remember anything, it suffers from acute memory loss. It knows nothing about "the state of affairs".

What is it not?

An interface does not have any way of telling you how it will come good on its promise - for that you need an implementation. It is just a promise. For example, if you go to an insurance company and sign up to be a customer they promise to replace or repair the stuff you insured. You need to pay up every month of course. The promise does not state HOW they will replace or repair your stuff. Once you need the insurance company to deliver on its promise you will probably call them up and they will tell you what to do - the how bit becomes clear... The company has rules and regulations to deliver on their promise. You don't care what those are, you know that they will deliver on their promise because of your interface (or contract).

Why use interfaces?

Interface based programming has become very popular because of Inversion of Control (AKA Dependency Injection) frameworks. There are may. Google it. There are some frameworks that sucked at appropriate use of interfaces, like J2EE, thankfully we have been rescued by JEE5. The nice thing about interfaces(IoC/DI frameworks) is that you get to split the promise and the delivery mechanism (the implementation). You get to pick the implementation that suits you best, just as long as it delivers on the promise made by the interface.

If you encounter an interface that says it will make the moon disappear and David Copperfield and the US Military decided to implement it you can know for certain that the implementation will be very different!

Monday, September 15, 2008

The KreditInform "Web Service" and I

I did a little work with the KreditInform "web service" during the last month or so. How did I find working with it? Here is a short list:
  • Ease of use - not very easy, documentation sucks.
  • Standards compliant - they call it a web service, which it is in the loosest terms. It is not WS-I compliant. I went to see a developer. There are no plans to change the current implementation to be WS-I compliant.
  • Did I get it to work? Yes.
  • Was it easy and intuitive. No way - be prepared to suffer!