Live data from Hacker News

Write Libraries, Not Frameworks

brandons.me

251–260 of 338 posts

Re: Write Libraries, Not Frameworks

#251
This is a really bad take imo.

Frameworks exist to prevent you from having to do work that has already been done, to a much greater extent than libraries. Those interfaces between libraries are the part that waste the most time for little reward. For web development in particular, reinventing the wheel will waste a huge amount of time. Looking at them as limiting rather than accelerating is an idealist dev's mistake that ignores the realities of business.

While you're busy gluing those components together, your competitors who used a framework already made it to market. While you're reinventing authentication, they've got their first customers. After launch, while you're figuring out new ways to add features that come with the framework, they are able to focus on scaling and growing their customer base.

Sure, this works out differently if you're one of the big tech companies, with tons of bodies to throw at any problem. But if you're on a small to medium sized team, use a framework. There's a reason so many successful startups and mid-sized teams (and large teams) start and grow with Rails or Django compared to non-framework paradigms - and it's not that there are more people doing it. Node-based non-framework app attempts seem to be far more popular and far less successful on average.

Re: Write Libraries, Not Frameworks

#253
post #221

Earlier quoted context omitted.

Good luck using any sort of GUI toolkit then. Virtually every single one requires you to sacrifice the very top level of your program to some sort of "MainLoop()" function. (I agree with your main point, and the above fact causes a quasi-allergic reaction in me which causes me to avoid GUI programming - despite graphics being one of my favorite topics.)

Try the "imgui" library?

Sadly even imgui cannot get around the fact that many operating systems (macOS/iOS/Android) force you to give up your main thread. Linux and, perhaps surprisingly, Windows are good guys in this regard.

Re: Write Libraries, Not Frameworks

#254
post #128

Earlier quoted context omitted.

I think you are being completely unfair here. AOP in Java (and .NET) is a metaprogramming facility that has few equivalents in other languages. The closest thing that comes to it is macros, but those are often compile time modifications. More importantly, nothing about standard Java development requires The use of AOP.

> AOP in Java (and .NET) is a metaprogramming facility that has few equivalents in other languages. The closest thing that comes to it is macros, but those are often compile time modifications. You don't need macros to achieve what grandparent was talking about - handling cross-cutting concerns like logging or transaction boundaries without being too intrusive. In a language that lets you do a half-decent monad imple…

I have done a LOT of development using Spring and have very rarely used AOP. I don't think it is a complex technology to work with though.

Re: Write Libraries, Not Frameworks

#255
post #166

Earlier quoted context omitted.

Well, the whole point of AOP is to handle these "not good examples". Now, certainly if you use the wrong tools for the wrong job, you'll shoot yourself in the foot. But there are many powerful tools that we shouldn't eschew just because we fear using them wrong. And then there are many cases where you shouldn't use these tools just because you can.

> Well, the whole point of AOP is to handle these "not good examples". I don't have a problem with AOP that doesn't change the functioning of the code. I have a problem with AOP that changes the functioning of the code, which is the overwhelming majority of AOP that I've seen in real life. > Now, certainly if you use the wrong tools for the wrong job, you'll shoot yourself in the foot. But there are many powerful too…

I mean, you can do anything you want, it's just code, but I would argue that I can get more maintainability and better results with less code by using AOP to implement application-wide profiling.

Re: Write Libraries, Not Frameworks

#256
post #58
post #26

The best distinction I've read is: When something is a library, your code calls functions on it. When something is a framework, it calls functions on your code

it's a rough rule of thumb at best though – higher-order-functions or other things that take a callback blur the line a lot (IoC, what a sibling comment said). or say a library has an event-loop, or maybe does networking and you only provide some handlers – would that make it a framework? i guess it's about frameworks being "the main thing happening". i.e. a framework controls the whole program's execution, occasiona…

The article also makes a good point that there is no hard line between library and framework, it is spectrum.

Re: Write Libraries, Not Frameworks

#257

Earlier quoted context omitted.

I hope, one day, that we look back on the "woke" over-analysis of the last few years and say "That didn't age well."

This too shall pass.

I don't have as much faith as you. I believe being "woke" is one of many things filling a void left behind by religion as more and more people find that void needing to be filled. I can't see that changing anytime soon.

Re: Write Libraries, Not Frameworks

#258
post #240

Earlier quoted context omitted.

I don't think that's ever been funny. What's that, standup comedy for psychos? It's that kind of joke that at best will make you look like a moron and ruin the mood... It's especially sad since the post is otherwise interesting.

> What's that, standup comedy for psychos? You’ve got it backwards. No “psycho” would consider it funny; they would just consider murder something normal one could conceivably do with a hammer. There is nothing funny about it, to them; it’s just normal. The murder joke was only funny to those people who consider murder something utterly unthinkable. It is its very outlandishness which creates the humor. If it is no l…

There are lots of edgy, ironic white supremacists these days. Masking aggression with humor is an age-old tactic.

Re: Write Libraries, Not Frameworks

#259
I have noticed 2 kinds of developers: Vanilla vs Frameworks

the later seems a lot more demanded by the market, but the formers are usually producing better/unique applications, and with much better perf compared to a framework based app

2 weeks ago a customer asked me to optimize a slow Angular SPA frontend for a simple CRUD app. It was taking 30 seconds to load nearly 15MB of js for the login screen!

I have simply trashed everything, 250MB of code and dependencies, ALL replaced by 15KB of Vanilla HTML/CSS/JS. The customer just could not believe how fast and efficient the new frontend was! His first question was which magical framework I used ...

Re: Write Libraries, Not Frameworks

#260

This discussion reminds me of one of my favorite quotes: "form is liberating". I always associated this with the sculptor Henry Moore, but the beauty of the idea is that it can be applied to all sorts of domains, whence it's also associated with Brook's Mythical Man Month about software development. The association here is that frameworks are "form". One might intuitively think that form/frameworks is/are constrainin…

The devil is sometimes in the large as well. Form changes — code that used to run while generating a web page now runs in a REST service. Code that used to run in a REST service now runs as a FAAS. Code that used to run in a FAAS now runs in a stream processor.

Your framework could tie you to a specific form, forcing you to implement your FAAS by posting each request to a REST service, or forcing you to implement your stream processor by posting each event to a FAAS. Or you can liberate your code from form by making sure that nothing important about it depends on a form-specific framework.

Post reply on HN