|
|
|
|
|
by barrkel
6076 days ago
|
|
Often - actually, almost always - third-party code is too general for the task at hand. If the job you're doing is simple, it can cost less in cognitive complexity to implement it directly, particularly if it's a problem domain you're expert in. But when integrating, I do prefer to wrap the integrated thing within a simple layer or wrapper, if feasible, that only exposes what I need. That buys me several things: it makes the interface very simple; I can create tests that verify my expectations; I can replace it later without having to clone someone else's API; and the API of the wrapper is almost a bullet-point list for what I'm expecting the third-party code to provide, and as I dispatch from the wrapper to the third-party code, I can verify that it's going to meet my requirements, before having to readjust architecture etc. if I find out it doesn't fit further down the road. |
|