Interfaces and thier uses

Hello,

Comming from a java background, I know interfaces as a contract which a class of objects fulfill in order to be considered to be of a particular type. basically polymorphism and late binding

Looking at flow it seems that an interface should provide the same sortbenefits as there doesn’t seem to be anyway of calling a service implementation without knowing at compile time which implementation is to be used.

Am I missing something?

Review the docs for “service specifications” which are very similar to Java interfaces.

There is a technique that can be used. I’ve used it on several projects. Assume you have a process that applies to a number of trading partners and/or applications. The process is the same but the mappings required might be different for each app or partner.

You can have your main processing service determine dynamically which mapping service to call based on data within the document being processed (Trading Networks does this very thing). Typically, there is an identifier of some sort that identifies the target of the message. Using this info, you lookup (there are various ways to do this–properties file, XML file, DB table, Trading Networks extended profile fields, etc.) which mapping service to call. Each mapping service simply needs to implement the same service signature (similar to a Java interface spec). The types of the parameters don’t need to all match, just the names.

Of course there are a few details to take care of but this is the gist of the basics. You may find this article to be helpful, though there is a current problem with the forum software that has the page navigation busted on this. The keeper of the site is working on fixing it.

eZine article second page.

Mark