I kind of understand the idea of what a wrapper is, but I see it being used in many other scenarios. My understanding is that it encapsulates another class and provides a similar interface in order to abstract the additional processes that are happening, for example a datastore wrapper. So is this essentially what a wrapper is? or can it take other forms? or is my understanding completely incorrect.
A wrapper is a higher level api that “wraps” another api/lib.
For example, Datastore2 is a wrapper for the Roblox’s datastore api which in itself is a wrapper for a database.
It makes something easier to use while maintaining the same if not slightly lower level of functionality.
1 Like
Generally, a wrapper is a class/api/library that simplifies or adds functionality to a separate class/api/library. There are also cases where you have a class/api/library that you need for an interface, but you can’t change the source code of the class/api/library to make it correspond with it. In that case, you would write a wrapper for that class/api/library that implements the interface and makes it usable.
3 Likes