Live data from Hacker News

Write Libraries, Not Frameworks

brandons.me

241–250 of 338 posts

Re: Write Libraries, Not Frameworks

#242
post #156

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 exp…

This 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 c…

Well 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.

Re: Write Libraries, Not Frameworks

#243
This makes no sense, both have their place and limits are good! Ossification has a purpose!

I often use the metaphor of a tree:

  leaf = library
  stem = framework
  root = platform
Write platforms so you can hot-deploy everything including the database and change the turnaround of the iteration to as close to zero as you can!

In my MMO engine client I have a couple of hundred of milliseconds turnaround from saved source to running in the engine (platform + framework + library) without any reloading of assets.

Same thing on the Server.

Only use OS + language (C+ (only string/stream and classes for structure only) for client and JavaSE for server) and build everything else yourself except if there are libraries built by one person (personally I use JSON and DNS4J for Java and GLEW + SoftAL for C, all of those are at the edges!). Everything else is a recipe for long-term disaster!

Re: Write Libraries, Not Frameworks

#244
post #12

Earlier quoted context omitted.

The repeated joke about killing your ex-girlfriend did not age well.

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."

It feels increasingly odd to work in exclusively male teams when there is no obvious biological reason why that would be. Possibly the casual “kill the ex-girlfriend” jokes contribute to that. I mean, some people really think like that, so it isn’t a purely innocent joke.

Re: Write Libraries, Not Frameworks

#245
post #56

Earlier quoted context omitted.

Stuff like that always makes me feel like someone has turned off their logical reasoning and they are just basically creating code that fills in some personal mental gap that somehow 'completes the set' of the things they are working on at the moment.

I always figured that Java folks were - paid per class - sought to reduce the number of executable lines per class to 1.

I actually knew a guy that argued that one method per class is ideal. He never quite got that at that point you're really just writing a function with a manual closure (the constructor).

Re: Write Libraries, Not Frameworks

#246
post #212

Earlier quoted context omitted.

What are you talking about? Every Clojure library does not get abandoned. It's just a process of survival of the fittest, like with any language. The popular libraries in Clojure are (mostly) actively maintained like with any other language.

It's great that this has been your experience, but I'm on my fourth SQL library at this point. I've been through several HTML rendering libraries, same with authentication, same with config management. The zipper and component libraries I used are abandoned. The data science story is sad compared to the R or Python ecosystems: Incanter dying, clj-ml unmaintained, Fastmath is good for some random stuff but not compreh…

Well, let's agree to disagree then.

Re: Write Libraries, Not Frameworks

#248
Could this also be stated that a DSL or code that seeks to abstract away most code in the real language is more overhead to maintain, grow, and build on top of than building stuff mostly on top of real language?

In which case, are we merely saying adding code abstraction layers are at the extremes - where you need to add a lot of custom code - more overhead than working on top of the bare language.

Re: Write Libraries, Not Frameworks

#249
post #12

A framework, usually, must predict ahead of time every kind of thing a user of it might need to do within its walls. The one thing not mentioned in the article is that the above line of thinking is almost guaranteed to lead to an insane level of abstraction, which was parodied in this classic article from nearly 15 years ago: http://web.archive.org/web/20141018110445/http://discuss.joe... (Sadly, that site is gone, b…

The repeated joke about killing your ex-girlfriend did not age well.

Pretty sure murder was taboo back then also. The only difference is people are much more eager to virtue signal these days by finding offence wherever they can..

Edit: to explain my position a bit, what I observe with people that are easily offended is that they can't seem to separate what the character is saying from what the overall piece is saying.

Just for example, think of The Office. Michael Scott says a lot of horribly sexist and homophobic stuff right? And we as the audience frequently laugh at it. But I don't think anyone in their right mind would say that The Office is sexist or that the audience that watches it is. Because we understand that the humor is that Michael Scott is saying something really inappropriate but he's also clueless and naive.

In this piece, the salesman character makes a dark joke. That is part of the character of the salesman, along with other aspects that are revealed. If you personally don't find it funny -- maybe you just don't like dark humor -- hey, I won't tell you you're wrong, humor is always subjective, but I don't see anything offensive about this. It's not advocating for violence it's simply adding a weird dark personality quirk to an already very weird character.

What I find with the easily offended crowd is all they look for is "bad thing involving a protected group in here? OFFENSIVE!" and completely ignore the actual context of everything else. It'd be like if you took a "that's what she said!" joke from The Office and completely ignored the context of Michael Scott's character.

Re: Write Libraries, Not Frameworks

#250

It's primarly a matter of taste, but I suppose that if you use only libraries instead of a framework: you will end up copy/pasting the same boilerplate to tie each library from one another over every project. You could make a library that standardizes a library format and take care of that boilerplate, then you can focus on what makes your project different, but that's not very different from a framework is it ?

I find that this type of duplication is incidental: I happen to need to do the same thing, but if one project has special requirements the other projects don’t need to change. Hence the boilerplate is fine and doesn’t need to be dragged into a library.
Post reply on HN