Design Patterns · Junior · Question 10 of 75

When do you need an Adapter?

Explanation

Example: the API returns { user_name, created_at }, while the UI expects { name, createdAt: Date }. An adapter function at the boundary transforms the data, and when the API changes only it needs editing. Third-party SDKs are adapted to your own interface the same way.

Further reading

Problem with a question

Design Patterns · Junior · question 10

Test yourself

Take the Design Patterns · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz