Design pattern name for an API wrapper class [closed]

I am writing a class that wraps (the parts of) an external API I am using. Let’s take the GitHub API as an example.

My imaginary GitHub class now has a fetchUser() and fetchRepository() method. When GitHub decides to host their API at github-api.com I only have to change it once. Nice. But what’s the name of this – very common – approach?

Could it be a facade as it’s a simpler interface to a more complicated one? An adapter as it links two incompatible APIs, or should I simply call it a wrapper class?

2

Adapter pattern will have the same method name.
X.DoSomething() will do different thing when it applies to different object.

Façade pattern accesses different functions in separate different classes.
Example of façade class should be when you want to create a validator class.

My guess is that it may be Observer pattern, since when the object changes, another dependent object changes automatically.
You are aware that MVC is an Observer pattern, aren’t you?

Otherwise, it can also be Mediator pattern. So when your object in internal system wants to talk to GitHub API object, it will have to go to your class to access.

Thanks,

1

Some alternative suggestions because sometimes things need to ‘sound right’

It could be considered a ClientProxy. Depends how things will be packaged. Will this become a stand-alone DLL? If so, it’s possibly a client proxy.

Perhaps it is only a convenience class of a larger application (ie. leaves the door open to more advanced usage)? If so, it could be a “Helper” (though I dislike the term) — a “Utility” is better. Better still would be a “StreamlinedClient” –“Easy” or “Simple” feel too unprofessional but when combined with “Interface” they can sound reasonable: “SimplifiedInterface

Now, if this wrapper is intended to hide the advanced implementation in such a way that your application will only use your wrapper when interfacing with the external API… it’s simply a Service or a ServiceWrapper.

Facade is overused (especially in Java): and your simplified description fits; however, I tend to think of this only when encapsulating without adding much in the way of logic (sort of a workflow that is not really related to the problem being solved).

There are two common names:

Entreprise Integration Pattern

or

Enterprise Service Bus

Here are some of the examples of EIP/ESB patterns

You are making use of delegation.
I.e. you are delegating GitHub::fetchUser() to the GitHub API. So I would call it a “Delegator”.

0

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật