Library patterns: Why frameworks are evil
tomasp.net
tomasp.net
However I work for customers, many different projects, and I'm more than happy to work with Ruby on Rails, that enforces a common structure to every project, lets me predict where files are and what they do, etc. The advantage is in all the time not spent on learning from scratch every single project. I can start working on the very first day. Even Django, which is mostly anarchy compared to Rails, is better than complete anarchy with every single project using different tools and having a different architecture.
Furthermore projects started with Sinatra and Flask and similar tools quickly evolve into something as complex as Rails and Django, with tons of home made fragile code. There is never the time to make them robust, because nobody is working full time on those projects for years. Basically frameworks allow developers to multitask among projects which is great for consultants and also for customers, because they don't have to pay for the extra developers.
Curious question, why you say Django is mostly anarchy compared to Rails? I haven't used Rails btw.
Django allows multiple subprojects inside an app and code wherever one wants to place it. Rails also allows code anywhere but in practice it's always in the same places. Maybe it's Python, inviting developers to overengineer their code.
Yeah the templating language is not so nice, I sometimes use Jinja instead. Also, I don't like the classic MVC so I have a completely different structure thus validation your point completely :P
If you ever end up in Django land (for some project), checkout Django Ninja for APIs, you'll end up avoiding having these annoying url files and just have a
@api.get("some/api") def some_api(request):
instead. Super simple and useful. I just recently discovered it and I don't know how stable it is but it seems pretty stable so far.
That you are forced (or at least strongly nudged) to code in a certain way is good because that means that all your web services are at least superificially familiar to all developers at the organization. That special service composed from many libraries? Impossible to work on without significant time investment.
I suppose though that if you are in a domain where you actually would want a library, but all that's on offer are frameworks, and you actually need to compose them, then yes, that seems problematic.
I mean I do think the original article is an exaggeration (as is this analogy), and there are lots of tradeoffs to be made. E.g. in the Java ecosystem it's much easier to find a Spring Boot developer than someone who is willing to set up a project from scratch. Maybe that's a good thing for your project, but maybe it's not.
Maybe more apt would be that the stuff you built in the workshop doesn't fit out the door so you'd need to take it all apart to rebuild it somewhere else.
Still, the article is insensible. Frameworks are not evil. They do not have malicious aims. I think the worst we can say in that direction is that people get tribal about this kind of thing and insist their framework or way is the best and lose objectivity.
To continue butchering this analogy, craftspeople use unfamiliar workshops all the time and no one is preaching about the evils of pegboards for organization.