4 ms·
I guess I should weigh in with my experience in this area, as author of both libraries and frameworks, in a lot of different domains, over a number of years. I
by ChrisMarshallNY 7y ago
I guess I should weigh in with my experience in this area, as author of both libraries and frameworks, in a lot of different domains, over a number of years.
I feel that it depends on what needs to be done.
For the most part, I prefer writing fairly atomic libraries. I like to use a “LEGO Block” approach, and [relatively] small, focused, modules are ideal for this.
I like each module to have an independent project identity and lifecycle. Makes for much higher quality and usefulness.
Sometimes, though, I need a really fundamental infrastructure. In that scenario, a framework is the best approach. In a lot of cases, we may have considerable control over the implementation of the framework, so that resolves a number of the downsides (like prediction of how it will be employed).
I’ve written a number of frameworks. It’s a huge PItA, and I avoid it, if at all possible. It is my experience that the biggest pain point is quality. I find that proper testing of a large infrastructure is damn near impossible.
If anyone has ever looked at my library (and framework) projects, they will see that my testing code (often harness, as opposed to unit - https://medium.com/chrismarshallny/testing-harness-vs-unit-498766c499aa https://medium.com/chrismarshallny/testing-harness-vs-unit-4...) tends to dwarf the actual CoT.
I consider writing a framework to be the “nuclear option,” to be only employed when nothing else will do. Even then, my frameworks tend to be layered affairs, with coupling between layers as loose as possible.
Writing any reusable software module is like having a child. I can’t just walk away from it when I get bored.
A framework is a huge responsibility. Once it is written and out there, I need to take care of it, in all its contexts, and for all its life. It is a lot easier to deprecate a small module, than a large infrastructure.
The same goes for libraries, but the scope of a library is a great deal more manageable and flexible than a framework. I find flexibility to be a crucial aspect of long-term software (I have written software that has lasted decades).
When I design software, I am constantly looking to the future. It’s become force of habit, and, as Niels Bohr once said: ”Prediction is very difficult, especially about the future.” The less control I exert on the future, the better.
If I can accomplish the same job as a framework with a set of independent modules, even if it is more work to do the modules, that’s what I do. A framework is a big, fat atomic blob that tends to age badly (in my experience).
However, I am obsessed with quality; which is not always an acceptable posture in today’s fast-paced, competitive workplace.
Engineering, at its most fundamental level, is always about finding the most practical approach.
http://www.solipsys.co.uk/new/TheParableOfTheToaster.html http://www.solipsys.co.uk/new/TheParableOfTheToaster.html