Questions tagged [adapter]
The adapter tag has no usage guidance.
25
questions
0
votes
4
answers
474
views
Adapter or pure interfaces?
I got a bit strange 'future ready' scenario. And I'm not sure if I got it right in regards to C# adapter design pattern.
The scenario is that to be future ready, 'to use the adapter pattern' to easily ...
8
votes
2
answers
15k
views
To which Clean Architecture layer should repositories implementations belong?
It's very common to see this use of repository in projects using clean architecture:
interface Hero { }
interface HeroRepository {
findById(id: number): Hero;
}
class FetchHeroUseCase {
...
1
vote
1
answer
102
views
Adapt very different adapters to an Interface
I'm building a service to send push notifications to the user.
At first, I designed an Interface for the push notification adapters, something like this:
interface PushNotificationAdapterInterface
{
...
7
votes
1
answer
2k
views
DDD: Viable approaches to integrating with external systems (Adapters, ACLs, Bounded Contexts)
Our team have been debating approaches to integrating external or third party systems when using DDD. The literature is extensive, but sometimes contradictory. Just like a UL helps us better ...
2
votes
1
answer
166
views
Is this a valid GoF Adapter example?
After visit dozens of pages searching a "non-sockets-or-iphone-conceptual-example" of Adapter Pattern, I have found this one:
Lloyds bank is an international bank offers services worldwide. For
...
0
votes
0
answers
105
views
Instantiating adapters in onion architecture
GitHub and NuGet
Do you use connection strings to instantiate your adapter services or just always configure it through IoC? I think that connection strings could provide a way more flexibility, ...
0
votes
1
answer
154
views
Is a JSON wrapper an adapter?
Please let me illustrate with a simple example. Suppose we have a Weather object:
class Weather:
def get_forecast(self, day, place):
forecast = "code that calculates forecast"
...
2
votes
0
answers
36
views
Manage web service with different version
My vendor can log in to a master management system (System A) which manage multiple subscriptions of a SaaS (System B). Each System B is hosted separately on an isolated server. System A and system B ...
2
votes
1
answer
559
views
Is an Adapter pattern a Proxy pattern? If not, why not?
A common use of the adapter pattern is to support functionality that isn't actually supported in an underlying class. For example, if I use an API to interact with a Samsung Smart TV, I might want to ...
7
votes
3
answers
2k
views
How to use 'Adapter' without any changes in the existing code in c++
Here we have TV class and DVD class as example:
class TV
{
public:
TV();
virtual ~TV();
void on() const;
void off() const;
};
class DVDPlayer
{
public:
DVDPlayer();
~...
1
vote
1
answer
4k
views
How to name different components in adapter pattern?
(example code in PHP, but this can apply to more languages)
I have a scenario with an adapter pattern, where I have classes, interfaces and objects with different roles, like so:
An original object ...
3
votes
2
answers
292
views
C# Adapter pattern - Condition based execution
I am building a solution for the recruitment division of an organization. The requirement is to create new employee records in the organization's database for the applicants who have cleared the ...
7
votes
1
answer
749
views
I need to be able to adapt my type to theirs, and theirs to mine
I have a situation where I have an external library. In short, I need to be able to adapt my type to theirs, and theirs to mine. The library has a collection like so:
interface IExternalCollection
{
...
16
votes
1
answer
6k
views
Unit testing an API client and wrappers
I've been going round in circles trying to figure out the best way to unit test an API client library I'm developing. The library has a Client class which basically has a 1:1 mapping with the API, and ...
2
votes
1
answer
5k
views
What is the difference between Adapter and Delegation design pattern?
I am very confused about Adapter and Delegation design pattern. In Adapter pattern we bring an intermediate class to interact with another class. And in Delegation pattern we also bring an ...