4 ms·
Writing libraries is a never ending grind of: 1. trying hard to do one thing and do it well (and failing usually), but ... 2. there are many dependencies that
by DmitryOlshansky 6y ago
Writing libraries is a never ending grind of:
1. trying hard to do one thing and do it well (and failing usually), but ...
2. there are many dependencies that you should allow your user to pass explicitly ...
3. and that’s the problem - you have 0% control on how the library is integrated but receive full responsibility for how well does it work. Even libc could be very different and will not behave the way you’d expect it to.
The big problem of making everything a small well thought-out library is large integration surface + having to be flexible and accommodate for all potential cases of integration.
That’s why we mostly have hundreds of overlapping “fat” libraries - too much trouble and too much integration complexity to split them up.
- atoav 6y agoThis is why I love writing libraries in Rust: the language provides so many ways of protecting users of your library to shoot themselves into the foot. Combine this with the built in and easy to use testing and I find myself often to break out core functionality of my applications into libraries just because it is a sane way to keep things decoupled. This is far harder in languages without a strict type system: you can do everything right and your users still abuse it.
- DmitryOlshansky 6y agoWell I’m long time D language user and we had unit-tests built-in from 2005+ (if not earlier - I started in 2010). It all helps but never eliminates the problem completely.
- DmitryOlshansky 6y agoAlso to destroy your point on Rust making it safe for your end users. Library that doesn’t have stable C API is next to useless outside of its original language/community/etc. and I have been bitten by this a few times already myself (my great libraries in D’s std cannot be easily exported outside of D). Do not repeat my mistakes - provide stable C API (and ABI by extension) as soon as you can. You cannot make it safe though it’s simply not accounted for in the land of linker “technology”.