Stuck with bad code? Wrap it up
I recently had to work with a library that was very difficult to understand and use. The documentation was poor, there were not many samples online to help me do what I needed to do and nothing was predictable. That means I had to resort to trial-and-error for tweaks and to search online for pretty much every new feature I wanted to implement with the library. Maybe I was pushing the library to its limit of what it could do, but what I was doing should not have been this complicated.
For me, code usability is just as important for programmers as is usability of a UI. Less usability means less usage of your product/library which means less feedback and eventually less profit. But what can we do when we're stuck with a bad library? One option is to look for alternatives, but sometimes there aren't other viable options or they're just as bad or worse. The solution? Wrap up the bad code inside your own component and make it easy to use.
I spent a few days writing a wrapper library that had the API that I wanted. Then I plugged the existing library inside of it and the result was a library with an API tailored to my needs (and my organization's needs), that removed risks of errors, reduced code duplication, and really improved the quality of the applications we were building. Any bug could be fixed only once, in my library, and pushed simply by updating the library in the application. It's also a lot more fun to use since I have hidden all the complexity and smoothed out the rough edges.
So if you ever find yourself stuck with a bad piece of software, wrap it up.