Reputation: 1601
What is the name of the pattern that used Retrofit 2.0 and some other libraries?
The old version
some manager can load data sync and async by two different methods
SomeClass obj = someManager.getDataSync();
SomeClass2 obj = otherManager.getBigDataSync()
SomeClass3 obj = otherManager2.getMyDataSync()
or
someManager.loadData(callback)
otherManager.loadData(callback2)
otherManager2.loadData(callbak3)
Now istead uses a helper class
New version
Performer<T> performer = someManager.getSomeData(...);
then we can execute this action sync or asyc with listener
T data = performer.performSync();
or
performer.performAsync(callback);
Upvotes: 0
Views: 237
Reputation: 1803
This looks like Event-based Asynchronous pattern, as described here https://msdn.microsoft.com/en-us/library/wewwczdw(v=vs.110).aspx
It is basically a concurrency pattern allowing easy use of both synchronous and asynchronous versions of methods.
Upvotes: 1