4 ms·
The problem with libraries is that they might not match. For example, what if one library you use uses another String class from another library you use. You'd
by amelius 12y ago
The problem with libraries is that they might not match. For example, what if one library you use uses another String class from another library you use. You'd have to write a lot of glue-code to let these libraries talk to eachother. It gets especially tricky if one library uses a garbage collector, and another library uses a different one. You could get cycles between objects managed by different libraries, which would never get collected (ouch!)
But in any case, I prefer that over working with a framework. Frameworks pretend to have everything figured out, but in reality they have not, and they are a pain to work with if you deviate the slightest from the "master plan".
Also, libraries are more easily replaced than frameworks, which is a huge advantage. And they invite you to think modularly, rather than monolithically, which helps to keep complexity down.
- Chris_Newton 12y agoThe problem with libraries is that they might not match. For example, what if one library you use uses another String class from another library you use. You'd have to write a lot of glue-code to let these libraries talk to eachother. This is a real problem, certainly. In very bad cases (anyone remember programming COM from C++?) the burden of making a simple function call from one part of your code to another can be soul-destroying. This is why I think the modern kitchen-sink standard libraries might be missing a trick. Instead of trying to provide everything out of the box, often to an acceptable but not best-in-class standard, what if our programming languages concentrated on just establishing conventions and providing universal tools with relatively small standard libraries, and then emphasized tools to connect different libraries from other sources together? That is, could they make it easier not just to import modules from different libraries but also to convert data types and match calling conventions and initialize/close down run-time systems? Plenty of ideas have already started down this path, from implicit type conversions or coercion to full-blown lens libraries, simple calling convention annotations to full-blown FFIs and wrappers, and so on. However, to my knowledge, no mainstream language today has an explicit design goal to make integration of multiple modules that have related functionality but different conventions as easy as possible. I wonder how far we could run with that strategy.
- mattgreenrocks 12y agoThis is the idea of my current language I'm brainstorming: modules as the central unit of design. I want to figure out how to encourage developers to write software as a collection of loosely coupled modules, rather than monolithic blobs. I hope that a module-centric design would let us make assertions about types, purity, and other FP-esque things. Right now it's just in the "I'd like this and this" stage, but I hope to work on it more this year.
- Chris_Newton 12y agoSounds interesting, and I wish you luck. I think if we had more and better options for gluing together good quality modules, some of the related arguments that push towards frameworks over libraries today would also be diminished. Then we could make decisions based on the fundamental frameworks vs. libraries question of you-call-us or we-call-you, without any bias from what should ideally be independent questions of consistency and interoperability.