Questions tagged [wrapper]
20 questions
15
votes
4 answers
How can I reduce the manual effort for wrapping third party libraries with a larger object model?
Like the author of this question from 2012 and this one from 2013, I have a 3rd party library that I need to wrap in order to properly test my application. The top answer states:
You always want to wrap third party types and methods behind an
…

Tom Wright
- 401
- 2
- 12
12
votes
4 answers
How do I wrap a service so it is simpler
We have a dependency to a third-party service which exposes a gigantic interface of which we only need like 3 methods. Additionally, the interface changes frequently...
I've decided to wrap the interface in a class in our project and only expose the…

xeraphim
- 339
- 2
- 7
10
votes
5 answers
C++ "Zero Overhead Principle" in practice
As an exercise in code architecture, I was writing a C++ wrapper for a window library called GLFW3.
In this library, when a window's X button is pressed, you can register a callback that reacts to such event. The callback needs to look like…

andreasxp
- 111
- 1
- 5
5
votes
4 answers
Stick with mis-named concepts or rename them in wrapper code?
I'm writing a library which includes some wrapper code for some underlying API. In that underlying API, there are two concepts, "foo" and "bar", whose literal meaning in the English dictionary is close to the switching of their meaning in the API.…

einpoklum
- 2,478
- 1
- 13
- 30
5
votes
4 answers
Avoiding hangs when calling a native API
Background
We have a piece of programmable hardware here at work that we integrate into almost all of our systems. This piece of hardware came with a native Windows DLL (for which we do not have the source code) as well as a wrapper to said library.…

Snoop
- 2,718
- 5
- 24
- 52
3
votes
1 answer
Writing a non-monolithic database wrapper
I have a SQL database to which I store and from which I read several objects into my C++ code.
I wrote a single database wrapper which handles all the reads and writes to the DB.
Of course this class got too large. I could make a Database wrapper…

user695652
- 529
- 3
- 16
2
votes
4 answers
Wrapping 3rd party library - avoiding leaking abstraction
I'm currently developing an application using SFML. My biggest concern at the moment is making a layer of abstraction over the library, so I can easily change it to something else if needed. What I'm struggling with is designing an abstraction…

mdx
- 203
- 1
- 3
2
votes
1 answer
Should I wrap a 3rd party library?
I'm developing an application that manages many different components, including various objects in a Kubernetes cluster.
There's a nice Java library to manage K8S objects, I use it to examine objects and manipulate them, but for most of the objects,…

Volodymyr Melnyk
- 161
- 5
2
votes
2 answers
Wrapping 3rd party objects that are dependant upon each other and best practices
I'm having a bit of a moment of indecision here and I'd like some perspective on it.
I'm currently wrapping up objects from a 3rd party API (at home for my own project and at work), and I'm doing my best to adhere as closely to SOLID principles as I…

Mike
- 123
- 7
2
votes
3 answers
Design tips: how to design a wrap class
I am using C# on a pretty huge solution that user a Static Class to manage the Session on the database.
The performance are not so good because of the number of call to the database.
The company decide to introduce Redis as a very fast alternative.…

Angelo Badellino
- 704
- 4
- 13
1
vote
1 answer
Wrapper class for min/max clamping and validation
I have a lot of classes that have numeric values that are configurable by the customer during runtime and should be clamped between a min and a maximum value. The value changes should also be logged. An example of this is given below:
public class…

Cédric Moers
- 151
- 4
0
votes
1 answer
Improvements in a "data - manager - wrapper" architecture
I have programmed using the architecture below, where "client, order, piece" are just data classes, have no methods, and "managers" are the manipulators of that data, the "ClothingStore" is a wrapper where there is no logic, only calls the methods…

PerduGames
- 119
- 5
0
votes
1 answer
Can a database wrapper be implemented in Scala using Traits? Is there a better way?
I've decided to implement a database wrapper to provide data operations of a web service using postgresql dbms.
Models in my database are somelike complex and frameworks like slick do provide more problems and need of workarounds due to type…

Evhz
- 152
- 8
0
votes
2 answers
Multiple layers of abstraction and chain calls of methods (Java functional like programming)
I am creating a multiple wrappers/layers API in Java that go like this
public class Layer1
public class Layer2 extends Layer1
public class Layer3 extends Layer2
with methods like public T…

Leon
- 197
- 3
- 10
0
votes
1 answer
Should a Java wrapper around a 3rd party product's API be packaged as a Bean?
For the sake of personal use and for the educational reasons I wanna make a Java wrapper around a certain service's web API. That is, no additional software is required to use it on a client machine - just my code.
I also want to make that wrapper…

Semisonic
- 101
- 1