I've been working with a library for my recent project and have ran into a few issues. I believe the issues have arisen because I'm programming everything else from a pretty low level and this library obviously abstracts some of the low level stuff from me for which I now realize I need to get to and integrate with other aspects of my project. This requires me to know more about how that library works and more about the problem space for which that library works in. This got me thinking about the usefulness of libraries and how/when you should really consider to use them for a project, and really what the main purpose of them is.
I saw a clip of Casey discussing exactly this and in that clip he talks about how it's important to understand the problem space the library is working in before using the library. If you're not sufficiently versed in the problem space then you won't be sure if a particular library is good or bad for your project because you won't know if that particular library will integrate well with your project or if you are even using it correctly.
While I tend to agree with his sediments I'm a bit confused now on how I should approach libraries. I know for myself, in order to really sufficiently understand a problem space for a programming project I find it's best to try and program a solution myself from scratch. This way, I gather intimate knowledge that would otherwise elude me and this knowledge is what proves useful for properly understanding what it is I need. Of course, if this is the case then why even use a library if I'm just going to go through the work of implementing and learning everything I need to know myself.
Before hearing Casey I thought the main purpose of a library was to avoid having to go through the work of properly understanding everything in order to use some functionality. Or is it that you just need to be able to find the right balance between understanding yourself and letting a library handle some of that understanding for your? Or is it like Casey says and, at least right now, most libraries aren't developed well enough yet that we can generally use what we need and forget the rest given poorly designed abstractions and bugs? Under what circumstances to you choose a library for a project and what was your thinking behind that choice?