Need help improving tightly coupled designs

I have my own enterprise application (EJB2) that works with a specific BPM provider. The current implementation of the internal application involves pulling an object that is accessible only to the provider API and making changes to it through public methods in the API.

I think I need to somehow map the internal object to this external, but it seems too simple, and I'm not quite sure of a better strategy for this. Can someone shed light on how they dealt with this situation in the past?

I want a black box for this software vendor, so I can easily replace it if necessary. What would be the best design approach to somehow map an internal object to this open API object? Keep in mind that my internal application needs to talk to the API yet, so there will be some kind of dependency between them, but I want to reduce it so that I can also test in isolation from this software using junit.

Thanks Jason

+3
source share
3 answers

Create an interface for the service level, inside which all your code can work with it. Then create a class that uses this interface and will call third-party api methods and as an api-facade.

i.e.

interface IAPIEndpoint {
    MyDomainDataEntity getData();
}

class MyAPIEndpoint : IAPIEndpoint {

    public MyDomainDataEntity getData() {
        MyDomainDataEntity dataEntity = new MyDomainDataEntity();
        // Call the third party api and fill it
        return dataEntity;
    }
}

apis, funk , . , .

,

IAPIEndpoint endpoint = new MyAPIEndpoint(); // or get it specific to the lang you are using.

, , - . TDD, , api.

+3

; DAL, .

, , , ; , , .

0

YAGNI. , , API, . , API , , , , , .

, - API, BPM. , API - . , .

0
source

Source: https://habr.com/ru/post/1783703/


All Articles