I am wanting to build a generic middleware software for my company that can access various vendors API's to pull out orders and then import then into our ERP through its API.

I want to make this as generic as possible whereby in theory, to connect another vendor, I just have to build out their implementation to conform to the common interface and perhaps through reflection or something, dynamically load that library.

I was told this pattern is called the Adapter pattern, however from reading other posts, the Adapter pattern is to adapt a previously built class to conform to your Interface (and possibly code that you can't modify).

What is the name of this pattern? Is it the provider pattern or the adapter pattern? I want to put these in their own classes but I'm not sure what to name these.~

  • 3
    Adapting a previously built class, such as the vendor's implementation? – user253751 Apr 30 '17 at 23:12
  • 1
    As @immibis said: if you "adapt" an existing implementation for a vendors API to your interface, you are writing Adapter classes, maybe some Facades. If you entirely implement a client for the vendors API that conforms to your Interface then you are simply implementing an interface – marstato Apr 30 '17 at 23:36
  • Thanks.. so there's no special name for what I'm doing here..just writing methods that conform to an interface. What would I call the classes that the implementations sit in then? Providers? For example, we deal with The Iconic.. would the class that implements these interfaces be called Providers.TheIconic? Or similar? – Lock May 1 '17 at 1:57
  • I think what you are looking for is Dependency Inversion which is also a Principle. en.m.wikipedia.org/wiki/Dependency_inversion_principle – Laiv May 1 '17 at 19:54
  • 1
    Dependency Inversion is often an error, not a principle. But in this case, you need plug-ins, which are a type of dependency inversion. – Frank Hileman May 1 '17 at 21:36

I just have to build out their implementation to conform to the common interface and perhaps through reflection or something, dynamically load that library.

It sounds like you're trying to build a Plug-In Architecture.

enter image description here

  • Yeah. I don't understand the DV. Implementing an interface and having that implementation loaded dynamically at runtime sounds an awful lot like a plug in to me. – RubberDuck May 1 '17 at 22:48
  • At one of my previous jobs, one of the software requirements for a particular piece of software was "Software shall have a plugin architecture." Aside from the fact that it's a hopelessly vague requirement, I interpreted it to mean "allowing a choice of modules that add additional functionality to be loaded at runtime based on a configuration" which, it turns out, is exactly how Fowler interprets it. – Robert Harvey May 2 '17 at 0:20

I think I'd call it an 'abstraction layer'

In computing, an abstraction layer or abstraction level is a way of hiding the implementation details of a particular set of functionality, allowing the separation of concerns to facilitate interoperability and platform independence.

  • 1
    No. "Abstraction layer" is too broad; everything in P of EAA and Fowler are essentially abstraction layers, as are many other things. – Robert Harvey May 2 '17 at 0:21
  • Maybe.. but i think in terms of formal pattern names it's as close as you're likely to get. Certainly thats what we call it. – Richard May 2 '17 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.