Timeline for Wrapping 3rd party objects that are dependant upon each other and best practices
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 10, 2018 at 14:08 | comment | added | Mike | I've read your update. The reason I wrap it up is so I can control the state information (sampler, blend, etc...). My framework may expose some direct methods, but how it renders is way different than how an end user would have to do it if they used D3D directly. If I just made a thing that did only certain operations, then the state is at the user's mercy and thus I could not make the same guarantees. Anyway, your final bit there is what I figured would be the case, so I've marked yours as the answer. Thank you. | |
| Apr 10, 2018 at 14:04 | vote | accept | Mike | ||
| Apr 10, 2018 at 7:19 | history | edited | David Arno | CC BY-SA 3.0 |
added 2305 characters in body
|
| Apr 9, 2018 at 16:42 | comment | added | Mike | I apologize, my source code example was incorrect, I've since updated it. As for the constructor parameter passing, I said "I have a factory method to create wrapper B so it can pass in nA to the constructor of nB". The API I'm wrapping is full of stuff like this. | |
| Apr 9, 2018 at 16:18 | comment | added | David Arno |
@Mike, I started updating my answer, but realised I'm confused over the details. You appear to be saying that nB is passed a nA via the constructor. But nA references nB instances via eg the M1() method. Is that correct? Is that multiple instances of nB, or is there a one to one relationship between them?
|
|
| Apr 9, 2018 at 15:21 | comment | added | Mike | I've updated the question with some code to illustrate what I'm after here. | |
| Apr 9, 2018 at 15:14 | comment | added | Mike | OK, I understand that interfaces are important for mocking and unit testing. But I have an additional problem here, and maybe I've misread your answer, but I have to pass in wrapper B to wrapper M1 to call nA.M1(), if wrapper B is an interface, how do I get the internal reference to nB? | |
| Apr 9, 2018 at 15:06 | history | answered | David Arno | CC BY-SA 3.0 |