Discussions

EJB design: Best way to decouple external library from the application

  1. We are planning to use an open source library in our App. What is the best way to decouple this external library from our application, so that in future we can use another library.


    Thanks,

    -Ramesh
  2. Interfaces

    create an interface that defines all the methods you want then create an implementaion of that interface and wrap the library methods in the implementation

    and in your app use the interface instead of implementation and then you can add another implementation wrapping another libaray later , maybe then to control the types of implemenations use and framework like Spring / Hivemind