News for hackers. Stuff that matters.
Re:Write Libraries, Not Frameworks by userbinator on Friday May 08, 2020 @09:41PM (#23121425)
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, but the memories live on...)

Addendum: to see this in practice, one needs to look no farther than Spring, the famous Java framework:

https://docs.spring.io/spring-framework/docs/current/javadoc...

https://docs.spring.io/spring-framework/docs/current/javadoc...

https://docs.spring.io/spring-framework/docs/current/javadoc...

Re:Write Libraries, Not Frameworks by niftich on Saturday May 09, 2020 @12:39AM (#23122369)
Spring class names are the stuff of legend, but most of those classes you wouldn't deliberately use in your application. They're there so Spring can layer up its own functionality feature by feature. The only problematic part about this is when these class names leak into error messages, and the level of indirection becomes difficult to follow.

The way you use the core inversion-of-control framework people often just call "Spring" is you take your homegrown, doesn't-depend-on-Spring business logic, you make a config file, and if you're not executing it a servlet container, you make one entry-point class to start it all up [1].

There other projects under the Spring umbrella, and some of them are meant to be called from your code. Like Spring JDBC for database access, whose framework-like nature is apparent, yet in terms of its usage pattern, it resembles a library [2].

[1] https://docs.spring.io/spring/docs/current/spring-framework-... [2] https://docs.spring.io/spring/docs/current/spring-framework-...

Re:Write Libraries, Not Frameworks by pscanf on Saturday May 09, 2020 @05:37AM (#23123326)
I agree in theory, but in practice I've found it very hard to keep Spring (Boot) out of my code.

Part of the blame I think falls on Spring's DI container, which is "too good". It makes it easy to pull in any bean, even the wrong one, which means developers have to be disciplined managing how beans depend on each other, and you end up with controllers returning entities. Of course, any codebase turns into a mess if you're not disciplined, but my impression is that developers tend to be less careful when working within the confines of a framework like Spring because it gives them the false sense that they can do no wrong.

Recently I started a side project with Spring Boot (after all I like the framework), trying to organise it following Uncle Bob's Clean Architecture approach, which aims to isolate the core business logic of an app from its implementation details like database code and external interfaces. The core turned out pretty well isolated, but the rest is all Spring. Database access? Spring Data. External interface? Spring MVC. Communication with external services? Spring RestTemplate. I'm not saying it's bad, it's actually awfully convenient, but it's not so easy to swap out - say - Spring MVC for http4k, so you end up with Spring being everywhere. Which again, not a bad thing, just something to consider.

Re:Write Libraries, Not Frameworks by rumanator on Saturday May 09, 2020 @08:04AM (#23124049)
> The core turned out pretty well isolated, but the rest is all Spring. Database access? Spring Data. External interface? Spring MVC. Communication with external services? Spring RestTemplate. I'm not saying it's bad, it's actually awfully convenient, but it's not so easy to swap out

External interfaces are just isolated interfaces, which end up being tied to a framework as frameworks do most if not all of the heavy lifting.

Just because you picked Spring Database to implement your persistence layer it doesn't mean you are bound to Spring to add a webapi or a web app, though.

If for some reason your frameworks are leaking out of any of your external interfaces then that's an issue with how you designed your app, not the frameworks you used.

As an example, some Clean Architecture examples using ASP.NET Core decide to implement their persistence layer passing around Entity Framework classes as their interface. That, obviously, tightly couples the whole app to Entity Framework in particular and ASP.NET Core in general. This coupling in turn is completely eliminated by passing a generic repository interface, but using Entity Framework's convenience often forces us to ignore that.

Re:Write Libraries, Not Frameworks by pscanf on Saturday May 09, 2020 @10:25AM (#23124933)
> Just because you picked Spring Database to implement your persistence layer it doesn't mean you are bound to Spring to add a webapi or a web app, though.

I agree, you're definitely not bound to, but again, in theory. For what I've observed in practice, factors like convenience and friction in going off the beaten path mean that when you pick Spring your app ends up being 90% Spring stuff. Which is not necessarily bad, there are certainly many good things about using the well supported, robust, and predictable set of Spring components. But I wouldn't say that Spring is the kind of framework that merely helps you tie together your app, that otherwise stays out of the way, and that you can swap out at any time.

Re:Write Libraries, Not Frameworks by niftich on Saturday May 09, 2020 @01:38PM (#23126678)
With Spring Core (the DI container) the only parts of your code that have to depend on Spring are the config and your entry-point.

You can choose to import facade-style Spring libraries, and write your code against them -- like Spring JDBC, Spring JMS, TaskScheduler -- if you want something that does some heavy lifting for you, but doesn't tie you to a vendor implementation directly.

Meanwhile, Spring Boot is a fully-opinionated framework based around the combination of defaults and on-the-fly auto-configuration, and giving you a single runnable uber-JAR at the end. And you're right about it: if you're using Spring Boot, it makes sense to depend on other Spring libraries, because (1) the docs guide you into them, and (2) the two will interact to auto-configure. For example, you can just run your DB code, and it can auto-configure an in-memory instance as you're developing [1]. Then, when you've gotten the real database, just specify the real config.

Spring Boot really shines in bootstrapping a greenfield project to get going quickly, especially if you're willing to compile its annotations into your code. You can then go back and incrementally override behavior and configs once you realize you want them a certain way.

[1] https://docs.spring.io/spring-boot/docs/2.2.7.RELEASE/refere...

Re:Write Libraries, Not Frameworks by nickbauman on Saturday May 09, 2020 @08:25AM (#23124164)
DI/IoC is just another way of expressing global variables. The global variables exist because of the constraint of class-orientation getting in the way, among other things. Spring exists because of the relative weakness of the Java language. You won't see this kind of technology emerging in more powerful languages.
Re:Write Libraries, Not Frameworks by delusional on Saturday May 09, 2020 @10:04AM (#23124770)
This is very often the case. So often you see these stateless "service" classes injected everywhere. It's not an object at all, it just free functions packaged in a namespace with a vtable in front of it that now need to be allocated. A language with free function support alleviates that problem.
Re:Write Libraries, Not Frameworks by ljm on Saturday May 09, 2020 @12:38PM (#23126156)
I'm having to do a lot of this now and I cannot imagine having to write any code, in any language, this way without depending on a magic IDE and other magic libaries.

To be fair, at least Spring and Lombok don't require me to maintain loads of yaml/XML files to describe the DI stuff, but annotations in java aren't always the most intuitive thing.

Requiring a class representation of literally everything is a huge limitation, and I wish there were other alternatives to this style of DDD that abstracts everything to an absurd degree.

Re:Write Libraries, Not Frameworks by therealdrag0 on Sunday May 10, 2020 @12:14PM (#23133729)
If they were JUST functions they could be static utils and wouldn't need to be beens. But these service classes themselves have their own fields/dependencies.

The Service class holds an instance of the Caching class and the Database class, each of those hold an instance of clients with connections, for example.

Can you explain how language support would remove this pattern?

I'm currently working on Scala services, and we don't have any DI, which is actually kinda nice, but it just means we "new-up" all these classes manually in our Main class and pass them through as arguments one to the next.

So far I like how there is no "spring magic"; however, in the end the pattern of dependencies is the same.

Re:Write Libraries, Not Frameworks by zests on Friday May 08, 2020 @10:53PM (#23121801)
Most of those crazy looking Spring classes aren't used by users and are just used internally by the framework developers. Of all the complaints people have about Spring, I've never heard "these classes are too abstract" or "these names are too obtuse."

There was maybe one instance where I had to deal with obtuseness like that. Definitely not the norm.

Re:Write Libraries, Not Frameworks by inopinatus on Friday May 08, 2020 @11:54PM (#23122162)
After X11 and Spring, the Maximum Abstraction Task Force shifted to focus on infrastructure, which is why your Java Virtual Machine processes are now running as a uniquely allocated user ID in a container scheduled by a control plane on a pool of OS instances separated by the hypervisor service of a dynamically sized cloud placement group.
Re:Write Libraries, Not Frameworks by infogulch on Saturday May 09, 2020 @01:34AM (#23122563)
All of which end up getting allocated to a single 56 core cpu.
Re:Write Libraries, Not Frameworks by keanebean86 on Saturday May 09, 2020 @02:39AM (#23122779)
Even the CPU adds at least one layer of abstraction.

Spring

JVM

Container

OS

hypervisor

x86

Real CPU instructions

Electrons

Unknown

EDIT: formatting

Re:Write Libraries, Not Frameworks by dmitriid on Saturday May 09, 2020 @06:03AM (#23123451)
And "EDIT: formatting" is now an additional layer, too :)
Re:Write Libraries, Not Frameworks by majewsky on Saturday May 09, 2020 @10:09AM (#23124810)
That's the layer that's argued about the most. :)
Re:Write Libraries, Not Frameworks by inopinatus on Saturday May 09, 2020 @07:05PM (#23128965)
This process is called “Devops”
Re:Write Libraries, Not Frameworks by gruez on Saturday May 09, 2020 @09:04AM (#23124388)
Are hypervisors and containers really abstractions though? All they do is manage access to the underlying resource.
Re:Write Libraries, Not Frameworks by catern on Saturday May 09, 2020 @09:35AM (#23124573)
A hypervisor definitely is; the "hardware" interface for a kernel running as a (performant) VM is different from the hardware interface for real hardware.

I think one could argue that containers aren't much of an abstraction for the running program itself, though, as you say. The place where containers provide an abstraction is at deployment time/process management time; the program itself has (essentially) the same API whether it's running in a container or not.

Re:Write Libraries, Not Frameworks by tasogare on Saturday May 09, 2020 @12:36AM (#23122360)
It still shows up in 2000 lines of stack traces when an exception occurs. For comparison a similar stack traces in Asp.net Core is 20 lines...
Re:Write Libraries, Not Frameworks by sidpatil on Friday May 08, 2020 @11:55PM (#23122169)
"If you wish to make an apple pie from scratch, you must first invent the universe." —Carl Sagan
Re:Write Libraries, Not Frameworks by stiray on Saturday May 09, 2020 @03:30AM (#23122940)
... but at the end you get perfect apple pie that is exactly tailored to the ecosystem, doesnt suffer from overdesign, bloat, is baked to perfection and its taste is from heaven.

The only question is if you can afford hiring a few gods for the task or you are rather satisfied with whatever falls off a truck and in reality is completely uncapable of inveting universe (or even capable of baking).

At the end the customers digestive problems are those that do matter. And you can get sued for food poisoning.

I personally love apple pies and am just not satisfied with plastic taste of supermarket frozen, microwave oven heated "products".

“When you want to hurry something, that means you no longer care about it and want to get on to other things.”

― Robert M. Pirsig, Zen and the Art of Motorcycle Maintenance

Re:Write Libraries, Not Frameworks by Kye on Saturday May 09, 2020 @10:02AM (#23124759)
All you have to do is run the simulation forward enough until sentient life develops and becomes the universe. Then you can bake any pie you like.
Re:Write Libraries, Not Frameworks by arethuza on Saturday May 09, 2020 @07:52AM (#23123971)
My comment in that discussion from ~15 years ago was based on experiences with a project that I "inherited" - 30,000 Java classes and interfaces, 20+ layers of abstraction, team of 30+ people working for a long time. And most importantly, it didn't actually work!

I actually "finished" it to the point of a working system for the customer with real customers in about 5 weeks by ignoring most of what they had done - required a handful of classes and JSPs. Probably distinctly under-architected but it worked and was built on for a number of years after.

Re:Write Libraries, Not Frameworks by gombosg on Saturday May 09, 2020 @09:50AM (#23124672)
The problem with over-engineered projects... our team inherited a project that was designed by some architects in an ivory tower and implemented by some other engineers.

It was quite complex (message queues, multi-threading, async etc.) so that it would be 'scalable' yet crushed under the slightest load, customers were experiencing delays during peak hours.

We removed about a quarter of the code (some intermittent queues & components), nothing changed in terms of functionality. Now we're removing more code and switching over to less complex data structures to fix the delays.

Maybe a complete rewrite would have been better after all, who knows.

I'm not a very experienced developer. I like to ship stuff and get projects done in reasonable time and a "YAGNI" attitude. Let's just rewrite stuff and introduce more abstractions when it actually hurts and a refactor is in scope.

On the other hand, I see a tendency that if you give projects (it could be a greenfield project or some maintenance) to a team of, say, 6 developers, then they will just 'create work' for themselves, filling up the todo list with items which may lead to an over-engineered project that could have been easily be done by 3 people within the same timeframe.

If you have some good reads/stories on this topic, patterns to watch for, I'd appreciate if you shared them.

Re:Write Libraries, Not Frameworks by majewsky on Saturday May 09, 2020 @10:07AM (#23124796)
> Let's just rewrite stuff and introduce more abstractions when it actually hurts and a refactor is in scope.

This is a very good attitude, but I would like to tack on a second part to it: Instead of designing your code to be infinitely extensible in all directions, make it easily replaceable instead.

It's impossible to anticipate every future requirement, but certain choices will make it easier to deal with a new requirement as it pops up. One of these things is unit tests. If you have some gnarly business logic with tons of edge cases, you really really want a good test suite because it enables you to add new edge cases with confidence.

Re:Write Libraries, Not Frameworks by ljm on Saturday May 09, 2020 @12:46PM (#23126219)
I'm a strong proponent of this attitude. The most maintainable code is that you can easily delete.

It does require a lot more thought and discipline, because it's not just a case of constructing an epic hierarchy of abstractions, or stubbing/mocking the hell out of your code in the tests to swap things around.

Re:Write Libraries, Not Frameworks by suzzer99 on Saturday May 09, 2020 @02:03PM (#23126951)
Couldn't agree more. A little redundancy early on in a product's lifecycle, when requirements are still in their infancy, can be a very valuable thing. It's much easier to add a layer of abstraction later as requirements became clear, vs. remove an unneeded layer of abstraction (which is often impossible).

I've been on too many projects which tried to build the perfect abstraction right out of the box - as if the problem domain fully known.

Re:Write Libraries, Not Frameworks by tomtomtom1 on Sunday May 10, 2020 @11:54AM (#23133559)
I genuinely hate the software architect title. It's like when we were in school and the teacher told us to write an outline before writing. No problem ! the majority wrote the text first and then the outline.

That's because people in general write to think.* The level of deep thought achieved through writing is harder to achieve beforehand.

In the same sense, the level of deep thought achieved through writing code, is hard to achieve beforehand. It's actually worse because your engineers, dangled in this web of classes, won't be able to think about the big picture for themselves.

An Architect thinks in terms of what sounds good, what is beautiful in OOP-land not in terms of what is easy to write, and what's performant to implement.

One poignant example is the interviewer who wants you to implement chess pieces as classes. which sounds good in the architects' world but is blatantly insane if you think about the actual code and the actual challenges you're facing.

* writing to think and writing to be read are conflicting goals that why editors exist.

Re:Write Libraries, Not Frameworks by thechao on Saturday May 09, 2020 @10:25AM (#23124927)
I was where you’re at 15 years ago; my language of choice was C++/Boost. I was advised to try C, not because it is a good language, but because it’s so hard to use, it helps you focus on the exact problem you need to solve. To this day I always “do one in C; do one in X”. I think Python (substitute any ‘batteries included’ language) can be good for this, too, as there’s no need to Yak shave with them.
Re:Write Libraries, Not Frameworks by bane on Saturday May 09, 2020 @01:21PM (#23126554)
Similar experience here. About 6 months ago I inherited a team of 30 that had spent 4 years building some monstrous microservice "thing" that didn't work and never seemed to build reliably and barely worked even if it could be deployed. Lots and lots of late nights trying to "deploy to testing" and wasted weekends restarting things.

I stopped the work, broke the team up (and let a few of them go), re-assigned the goals of the project to 3 people who, working half-time, from scratch, and in Python, rebuilt the entire thing in 3 months, delivered it and it worked (and continues to work). "Builds" are now an scp to a VM, and a restart of a flask application.

My wife recalls a similar experience where a complex application she worked on (and ran reliably on very little infrastructure and with an entire team of 4), and serviced thousands of simultaneous users, was replaced (when a new CTO came in) by a giant, consultant driven Java project that required approximately 6x the infrastructure, 3x the staff to keep it going, and at launch could only serve 9 to 12 users at once. It was a debacle. But sunk cost fallacy forced her company to throw millions of dollars of consultants at it until it achieved some minimal level of barely available service. She and her boss left around that time.

She heard that a couple years later the CTO was let go, the consultants fired and it was all replaced by a team of 5 rewriting it all again from scratch (in Java) but like you also without all the architecture barf dropped in from orbit, and immediately went back to servicing the thousands of users again.

I'm convinced that this is the fault of some kind of consultant industry that seems to infest enterprise software circles that is really only good at inventing ways of designing systems that require more of their services, but never seem to actually deliver working systems.

Re:Write Libraries, Not Frameworks by nurettin on Saturday May 09, 2020 @02:18PM (#23127112)
As someone who fell into a similar situation just last year, I can say that it helps a lot when you have previous work that had been done before you were involved. Perhaps the existing project doesn't show you how things should have been done, but it certainly shows you some of the challenges that were faced and what not to do about them so you don't fall into the same traps as they did.

So it's not always "those architecture astronaut guys used the company's resources to study their webscale fantasies and I came to save the day", but rather, "they did as well as they could using the choices and resources they stuck with and I happened upon the project with 20/20 hindsight".

Re:Write Libraries, Not Frameworks by bane on Saturday May 09, 2020 @04:38PM (#23128119)
I agree with what you say here to a large degree. We were able to reuse things like external service connections, accounts, contracts, some of the requirements documentation and some of the already provisioned hardware, VMs and so on. Those things are not trivial to put together and easily saved us several months of work.

Where I think I part ways with you is with this "they did as well as they could using the choices and resources they stuck with and I happened upon the project with 20/20 hindsight". One of the big lessons we've learned as an industry involved in software development is to start small, iterate often, get feedback from users. What I see time and again with these types of overblown space elevator projects is a kind of fundamental...immaturity -- the people who run these don't seem to understand how to achieve results with the minimum required to do it.

They've never started small and iterated to large. The projects they've worked on have all been so enormous, and have taken so long, that they have very few data points to draw lessons from. Each iteration and growth cycle in a mature project creates lots of information that can be reapplied elsewhere. But for people who've only ever grown up in large enterprise software projects, that's the only approach they know, and there's only a handful of lessons they've learned.

It's not only architecture astronauts, but the entire ecosystem that supports "enterprise" software engineering: vendors, consultants, scaled agile experts, design tools -- even university programs that churn out enterprise ready engineers. The appearance of these things, and how widespread they are in certain circles, demonstrates how those circles have regressed and tossed into the rubbish bin the lessons that we've learned. The penalty that's being paid is that these same lessons have to be continuously relearned again and again, but instead of pushing against outside models of how to do things (e.g. trying to adopt physical engineering approaches to software), we have to push against our own industry.

When you go against billion dollar enterprise software industries, you end up sounding like a heretic. It's really only when you get a long portfolio of success stories can you succeed. But that's very hard to get in today's climate where people spend their entire careers trying to kill ants with nuclear weapons dropped from the orbit of Mars.

Re:Write Libraries, Not Frameworks by nurettin on Saturday May 09, 2020 @10:02PM (#23129755)
This was very well put and definitely agreed with many of the sentiments you've put forth about bottom-up (get up and running with as little rpc as possible) vs sideways development (copy the entire netflix architecture and try to make it work)

I just didn't put the blame on the previous team, maybe I should have for sticking with it for two entire iterations, still not entirely convinced. I think they couldn't help it and the decisions were already made for them by large faceless corporations. I guess what's the point of calling themselves engineers if they don't feel like they are in a cockpit pressing lots of buttons right from the start?

By profession, I call myself a computer programmer, not an engineer or architect in order to remind myself that I should weigh problems by starting from fundamentals such as a state machine, an integer constraint system or a breadth first search, before setting up service discovery or training neural networks.

Re:Write Libraries, Not Frameworks by chiph on Saturday May 09, 2020 @09:50PM (#23129710)
We had a similar debacle back during the dot-com boom. We were a Microsoft shop and we got a new CTO who despised our monoculture and demanded a shootout against Java. A large team of consultants and employees labored for almost 10 months to produce a system that scaled to .. 2 simultaneous users while running on the latest Compaq servers with tons of memory. Meanwhile our legacy VB6 app was serving 1600+ users on mid-tier hardware.
Re:Write Libraries, Not Frameworks by Koshkin on Friday May 08, 2020 @10:53PM (#23121800)

  getInstrumentableClassLoader()

    Return a ClassLoader that supports instrumentation
    through AspectJ-style load-time weaving based on 
    user-defined ClassFileTransformers.
Oh man... I admire the people who have invented this. But at the same time I feel sorry for those who have to use this in order to earn their living.
Re:Write Libraries, Not Frameworks by chii on Saturday May 09, 2020 @01:03AM (#23122458)
It does have it's place. Aspect oriented programming will allow you to write, for example, logging code that are very configurable. It allows you to remove the concern of logging from your classes completely.

In fact, any cross-cutting concerns - like transactions, can be done this way. So you can write code that don't care about transactions, but behind the scenes, it is all within a single transaction, and transaction errors are handled centrally.

It adds runtime costs of course. And the more you add this way, the more complicated it becomes. And certainly can be abused.

Re:Write Libraries, Not Frameworks by lmm on Saturday May 09, 2020 @02:09AM (#23122679)
Just use a language where it's possible to implement those things in plain old code. When you have higher-kinded types you don't need any bytecode manipulation, you can just have a type that wraps anything that needs to happen in a transaction, and compose together transactional operations in a visible but type-safe way - and you don't even need the runtime cost.

How anyone can look at Java as it's actually used and say Scala is too complex is beyond me.

Re:Write Libraries, Not Frameworks by quelltext on Saturday May 09, 2020 @02:39AM (#23122780)
You can also do it visibly in Java without too much noise IMO. The point of AspectJ is to hide this stuff completely from application code (but it's still visible in its definitions). Whether that makes sense or not I'm not going to debate (I personally don't think AspectJ is particularly great) but arguing that other languages allow you to do that in a more or less visible way is besides the point.

AspectJ is a language, these aspects are visible and have their own language abstractions, just separate from the application code. Just like you have monad implementations separate from their uses. So writing aspects is also "plain code". How the weaving happens (at compile time/load time, on source code or on bytecode, etc.) is an implementation artifact

Also, AspectJ isn't Java and the problems AspectJ tries to solve and the approach apply to a bunch of languages and variants for functional languages also exist.

Re:Write Libraries, Not Frameworks by lmm on Saturday May 09, 2020 @03:35AM (#23122953)
> AspectJ is a language, these aspects are visible and have their own language abstractions, just separate from the application code. Just like you have monad implementations separate from their uses. So writing aspects is also "plain code".

Code containing aspects is certainly not plain Java code, because the aspect annotations (or, worse, invisible string-name based pointcuts) change the behaviour of the code they're on, breaking the normal rules of the language. You'll see "impossible" behaviour at runtime: call a method and the call stack jumps to a completely different method. A method throws an exception that's thrown nowhere in its body. If you want to say that AspectJ is a language in its own right, then it's a language that breaks all the rules of good language design: it essentially contains COMEFROM as a core language feature. Whereas monad implementations are (generally) plain old code that follows the normal rules of the language.

> Also, AspectJ isn't Java

It (or other libraries that do much the same thing) is the vast majority of Java as it actually exists in the real world. I've yet to see a substantial Java codebase that wasn't using some form of AOP or reflection (even if only indirectly via these big frameworks).

Re:Write Libraries, Not Frameworks by quelltext on Monday May 18, 2020 @11:34AM (#23223677)
> Code containing aspects is certainly not plain Java code,

I didn't say it was. AspectJ is AspectJ, as you surmised correctly "a language in its own right", and so when you define an `aspect` that's it's own thing, not a `class`. You seem to demand that the language is Java, but that's not really a criticism of AspectJ, the language, then, rather denying that it is a language.

It's like saying a C++ class and some implicit behaviors that change behaviour of user code (via a custom assignment operator override) is crap because it's not C. Maybe it's crap because you don't like it and like C better but it's still not quite fair to demand it be "plain code" when it is plain code.

Please look more deeply into https://en.m.wikipedia.org/wiki/AspectJ. It has its own syntax and is not just some annotations plus a framework you have to run.

FWIW, your arguments against AspectJ work just as well against any language with macros or metaprogramming in general (although you probably don't like those either, and that's fair!).

> If you want to say that AspectJ is a language in its own right, then it's a language that breaks all the rules of good language design

Frankly, the kind of things that AspectJ offers or proposes to use are IMO no less sane than some of the things languages like Ruby (e.g. monkey patching, middleware decorating/nesting calls via including a module, defining methods is a dynamic call that can be intercepted and customized, etc.), Python (e.g. decorators), JS (e.g. messing with prototype behaviors), or even Prolog (e.g. metainterpreters that metalogical predicates to implement different resolutiom strategies) typically encourage.

People have called monads the "programmable semicolon", and so you can do all kinds of things that don't at all represent what a user of the monad would anticipate unless they read the docs/implementation. It could enforce some form of order of evaluation, or store additional state that is hidden, etc. Sure, this is not the same thing as aspects or metaprogramming/macros, but what they have in common is that some external definition defines the exact semantics of a application/user piece of code and has potentially a whole lot of freedom to stray from what may look like it's "obvious".

The goal of AOP is to find a solution to challenges were modularization by typical means hasn't worked. And the typical examples are usually valid. Is it great? Is it needed? I'm not sure either, but your criticism sounds a lot like you only look at it from a lense of a pure statically typed functional programmer. From that POV a lot of language designs probably look impure and crap, whether justified or not.

> It (or other libraries that do much the same thing) is the vast majority of Java as it actually exists in the real world.

Are you specifically talking about AOP or AspectJ? I believe the former. And I don't think it's AOP, you are talking about various frameworks implementing a wild set of changes to the core language via reflection, code generation, or other such things tailored to their specific use cases.

Say what you will but that, while it might fall into the AOP class of doing things, is quite different from AspectJ's goals. The idea is/was that you don't need all these different frameworks with their own conflicting custom implementations. Rather, that using AspectJ should be the common language in which these metaprogrammatic aspect-oriented concerns are defined (for instance by such a framework that's currently using it's owm custom implementation with no common set of rules), which can be analyzed and provide static tool support (e.g. "who"'s amending, wrapping, early aborting behavior for this particular method).

So, again I don't think the criticism of AspectJ is fair (abd that's what I addressed, not the modern state of Java and frameworks in general). If at all, the problem is that AspectJ itself isn't actually used but instead that its superficial ideas have been coopted and turned into a metaprogramming wild west. Maybe it's AspectJ's fault but I think it's just a coincidence. That state of affairs is not unique to Java at all, either.

Re:Write Libraries, Not Frameworks by lmm on Thursday May 21, 2020 @09:16AM (#23257945)
> I didn't say it was. AspectJ is AspectJ, as you surmised correctly "a language in its own right", and so when you define an `aspect` that's it's own thing, not a `class`. You seem to demand that the language is Java, but that's not really a criticism of AspectJ, the language, then, rather denying that it is a language.

By building on Java AspectJ tries to have it both ways, which I think is a mistake. It's normal, and I'd even say semi-encouraged, to use non-AspectJ-aware tools when working on an AspectJ codebase - and of course an upstream library maintainer may not even know their library is being used in an AspectJ codebase. Which causes real problems because they will refactor according to a different set of rules.

> FWIW, your arguments against AspectJ work just as well against any language with macros or metaprogramming in general (although you probably don't like those either, and that's fair!).

> Frankly, the kind of things that AspectJ offers or proposes to use are IMO no less sane than some of the things languages like Ruby (e.g. monkey patching, middleware decorating/nesting calls via including a module, defining methods is a dynamic call that can be intercepted and customized, etc.), Python (e.g. decorators), JS (e.g. messing with prototype behaviors), or even Prolog (e.g. metainterpreters that metalogical predicates to implement different resolutiom strategies) typically encourage.

Yes and no. You list a bunch of things that are bad to a lesser or greater extent, but the method-name-pattern-based stuff I've seen done with AspectJ is the most cryptic form I've ever encountered. Not only is nothing visible at the declaration site or the call site (not only no decorator but no magic import either), you can't even grep for the method name to find the thing that's messing with that method.

> People have called monads the "programmable semicolon", and so you can do all kinds of things that don't at all represent what a user of the monad would anticipate unless they read the docs/implementation. It could enforce some form of order of evaluation, or store additional state that is hidden, etc. Sure, this is not the same thing as aspects or metaprogramming/macros, but what they have in common is that some external definition defines the exact semantics of a application/user piece of code and has potentially a whole lot of freedom to stray from what may look like it's "obvious".

That's not really true in my experience; monadic composition is programmable only in the sense that an abstract method in an interface is programmable (indeed monad usually literally is an interface with abstract methods, or the closest equivalent in the language you're working in). Syntactically you can see that monadic composition isn't regular composition and so you know that some effect is being invoked, and as with any abstract method you might be able to click through to a specific implementation or you might have to accept that it's just "some unknown implementor of this interface". But in an important sense there's no magic: all your values are just values, all your functions are just functions, all the normal rules of the language still apply. I do object to things like thoughtworks each where a seemingly normal assignment gets magically rewritten into something monadic.

> The goal of AOP is to find a solution to challenges were modularization by typical means hasn't worked. And the typical examples are usually valid. Is it great? Is it needed? I'm not sure either, but your criticism sounds a lot like you only look at it from a lense of a pure statically typed functional programmer. From that POV a lot of language designs probably look impure and crap, whether justified or not.

Well I came to that precisely because of experience with that problem. It was seeing the bugs introduced by AOP that made me look for a better way to do things, and that was how I got into functional programming.

> The idea is/was that you don't need all these different frameworks with their own conflicting custom implementations. Rather, that using AspectJ should be the common language in which these metaprogrammatic aspect-oriented concerns are defined (for instance by such a framework that's currently using it's owm custom implementation with no common set of rules), which can be analyzed and provide static tool support (e.g. "who"'s amending, wrapping, early aborting behavior for this particular method).

That's fair. But in that case you have to see at AspectJ as a failure in terms of today's Java ecosystem. Even codebases that use AspectJ don't manage to avoid using all those other metaprogramming frameworks as well, and I don't think I've ever heard of a framework deciding to move away from a custom AOP implementation into doing something via standard AspectJ. (And I do think that AspectJ offers too much flexibility to ever make for a comprehensible codebase, even with the help of better tooling support).

> That state of affairs is not unique to Java at all, either.

It's not unique, but it's embraced to an unusually high extent in Java (Ruby would be another example). And I can't help thinking it's because of Java's deliberate, advertised simplicity, because a lot of the aspect-based stuff seems to be there to paper over missing language features (or, even more tragically, to paper over language features that are now there as of newer versions of Java, but that Java programmers have got used to having to step out of the language for).

Re:Write Libraries, Not Frameworks by rclayton on Saturday May 09, 2020 @02:54AM (#23122824)
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.

Re:Write Libraries, Not Frameworks by lmm on Saturday May 09, 2020 @03:28AM (#23122934)
> 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 implementation (which is pretty much any language that has higher-kinded types and first-class functions, although do notation can be a useful enhancement), you can comfortably write this kind of thing in plain old code. (I do those very things - transaction boundaries and logging - in Scala all the time).

> More importantly, nothing about standard Java development requires The use of AOP.

And yet, in real-world Java development, people feel the need to use AOP. In my 10+ years of JVM work in companies large and small, I don't think I saw a single one that didn't use some form of AOP. That should tell you something.

Re:Write Libraries, Not Frameworks by mping on Saturday May 09, 2020 @04:40AM (#23123135)
If I give you a jar (or equivalent) of my compiled app, can you still apply cross cutting concerns (over compiled code you may not own)? Because that's what AOP and bytecode transformation can do.
Re:Write Libraries, Not Frameworks by lmm on Saturday May 09, 2020 @05:05AM (#23123215)
You can't insert them at completely arbitrary points in third-party code. But libraries can be written generically (in terms of e.g. a general monad) so as to propagate cross cutting concerns from your callbacks to the right place, even when those concerns are implemented later on and the library doesn't know about them. Look at e.g. fs2 and http4s: everything's written generically in terms of some F[_] type which the user supplies when they use the library, and it will all be plumbed through correctly. So if you want logging, you use something like treelog as your F[_] type; if you want transactions, you include a transaction type in there. And so on.

In my experience that covers almost all the use cases, while it means that library code can still behave predictably and be understood and tested (e.g. you don't have to worry that a library upgrade is going to break your application, which you do if you've used AOP to define pointcuts deep in its internals).

Re:Write Libraries, Not Frameworks by mping on Saturday May 09, 2020 @05:39AM (#23123331)
I'm not familiar with scala but will take a look. Completely agree over your last point. I very much prefer libraries over frameworks, and as you said pointcuts are a bit fragile, but my main point is that they behave differently because of bytecode transforms.
Re:Write Libraries, Not Frameworks by pkphilip on Saturday May 09, 2020 @11:18AM (#23125380)
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 by vidarh on Saturday May 09, 2020 @09:46AM (#23124648)
AOP is doable in most languages that allows very basic levels of runtime instrospection and manipulation of objects and types, and is easy in a large number of them.

In Ruby, for example, "alias_method", "define_method" and "send" is sufficient to implement cross-cutting in a handful lines of code, and at least one generic gem exists that provides basic cross-cutting in a generic way.

But it's very rarely done because it's generally cleaner to pass down code for the library to explicitly call.

I used to be very excited about AOP, but in effect while AOP can be great as a debugging facility (e.g. ability to inject logging at any point for example), when you have control over the design it tends to be better to explicitly build code so that it is designed to accommodate user provided functionality. In Ruby that tends to involve e.g. the ability to pass in blocks a lot of places.

Re:Write Libraries, Not Frameworks by therealdrag0 on Sunday May 10, 2020 @12:26PM (#23133843)
> Java .. Scala

To be fair, there's something to be said about a seasoned/documented library versus the cooked up micro-framework/function that a random coworker invented in Scala to do the same thing, and which might be implemented differently in each project in your company!

Source: I'm about a year into Scala after many years of Java. I like a lot about Scala, but 4/5 places where we have "plain old code" where in Java we'd have used an open source library, the "plain old code" is painful to read/reason about.

Re:Write Libraries, Not Frameworks by lmm on Monday May 11, 2020 @08:52AM (#23141537)
I'm all for using standard and documented libraries provided they follow the rules of the language, and I don't think Scala goes against that - if anything "microlibraries" that do one thing and do it well seem to be more common in Scala than in Java. What I'm objecting to is frameworks that violate the rules of the language and require their own special understanding, even if those frameworks are well documented.
Re:Write Libraries, Not Frameworks by jmchuster on Saturday May 09, 2020 @04:25AM (#23123094)
How would you then, say, do a profiled run of the application, to help find the choke points in your application? You'd have to make sure that you apply the exact same "trace the runtime of this function" wrapper around every single function call, then make sure you haven't missed anything anywhere, then have to maintain such usage, and then mentally ignore it everywhere when you're trying to read through the code.
Re:Write Libraries, Not Frameworks by lmm on Saturday May 09, 2020 @04:56AM (#23123185)
Profiling isn't really a good example; I don't actually mind doing it via language-level magic, since it doesn't affect the actual behaviour of the application - every function still executes the same and still returns the same thing, we just observe it in more detail from the outside.

But to answer the question, I'd use a monad, something akin to treelog ( https://github.com/lancewalton/treelog ). Apply the wrappers at the points where you want them (and they'll be visible in the type), and then the tracing is naturally threaded through in a way that's visible but not intrusive (basically just the difference between <- and =, so when you're reading the code you can see it but it doesn't get in the way of reading the business logic). Maintaining it is easy because it's just part of the type of everything, so automated refactoring in you IDE will do the right thing; testing is easy because everything's still just a function and a profiled computation is still just a value, but you have access to the profiling trace in a normal way as a first-class value in the language.

Re:Write Libraries, Not Frameworks by jmchuster on Saturday May 09, 2020 @05:10AM (#23123237)
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.
Re:Write Libraries, Not Frameworks by lmm on Saturday May 09, 2020 @05:25AM (#23123287)
> 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 tools that we shouldn't eschew just because we fear using them wrong.

But you don't need any of the dangerous functionality to do profiling. So that's not a valid argument.

Re:Write Libraries, Not Frameworks by jmchuster on Saturday May 09, 2020 @11:20AM (#23125403)
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 by lmm on Saturday May 09, 2020 @11:59PM (#23130181)
For cases where you need to change the behaviour of the function, you get more maintainability and better results by doing it in a way that's visible in the code. For profiling, you get more maintainability and better results by using something less powerful than full AOP (e.g. stack sampling or tracing). There is certainly no case on the JVM where AOP leaves you better off than not having AOP, and I'd be surprised if there were such a case anywhere else.
Re:Write Libraries, Not Frameworks by fulafel on Saturday May 09, 2020 @02:47AM (#23122803)
For those of us hazy on the AOP concept... Is it an artifact stemming from restrictions of static languages, or would it be a valid concept with dynamic languages too?
Re:Write Libraries, Not Frameworks by brabel on Saturday May 09, 2020 @03:04AM (#23122856)
In the dynamic languages world this is done with monkey patching. If you invent a declarative way to monkey patch your code, you've got AOP as done in Spring.
Re:Write Libraries, Not Frameworks by sgrove on Saturday May 09, 2020 @03:32AM (#23122943)
I believe emacs lisp's advice system is an AOP system in a highly dynamic language, and doesn't make much use of monkey-patching.

Advice/AOP is a pattern that can fit (if you want it) in dynamic language as well.

Re:Write Libraries, Not Frameworks by fulafel on Saturday May 09, 2020 @03:47AM (#23122993)
What about this Clojure library?

https://github.com/technomancy/robert-hooke

Re:Write Libraries, Not Frameworks by mping on Saturday May 09, 2020 @04:41AM (#23123139)
Don't forget AOP can work on top of compiled classes, not sure I'd there is an equivalent in python or ruby.
Re:Write Libraries, Not Frameworks by rclayton on Saturday May 09, 2020 @02:58AM (#23122841)
I don’t thin AOP is specific to static languages. From my understanding, the “aspect” part implies the ability to “hook into” and extend an application at specific “cut points”, which are typically pre/post function/method calls. This is done in Java by modifying byte code to insert proxies. I imagine something similar could be developed with other languages. It might just be easier to do in Java because the type signatures are static.
Re:Write Libraries, Not Frameworks by louiskottmann on Saturday May 09, 2020 @03:30AM (#23122939)
It is very close to python's @ syntax on top of methods definitions.

Like:

@get('/posts')

mymethod

  ...
Re:Write Libraries, Not Frameworks by _ZeD_ on Saturday May 09, 2020 @04:13AM (#23123053)
? no, it's not.

look at https://python-aspectlib.readthedocs.io/en/latest/ for an example of using aspect with python

Re:Write Libraries, Not Frameworks by lmm on Sunday May 10, 2020 @12:06AM (#23130199)
Python decorators are a (limited) form of AOP: they let you transform functions in-place to implement cross-cutting concerns. Aspectlib allows you to do a more intrusive form of AOP.
Re:Write Libraries, Not Frameworks by louiskottmann on Saturday May 09, 2020 @06:55AM (#23123681)
Decorators and AOP are very similar concepts in my opinion then, if you prefer.
Re:Write Libraries, Not Frameworks by flukus on Saturday May 09, 2020 @03:25AM (#23122926)
> It allows you to remove the concern of logging from your classes completely.

You say that like it's a good thing. When there's a bug to look into grepping strings from the log is one of the first steps, the first step if you don't have a stack trace, I want that string to be where the problem is. Having the logging in with the rest of the code is an inevitability anyway and unless you only want logging at function boundaries.

> In fact, any cross-cutting concerns - like transactions, can be done this way.

That's another thing I want to be explicit, if I have some code that is going to to do a bunch of updates I want it to demand a transaction as part of it's interface. I don't want it hoping it gets executed in the scope of a magic layer that will handle the transaction.

The common theme with AOP is that it takes stupid simple code into an opaque mess spread across a dozen classes that's far harder to maintain.

Re:Write Libraries, Not Frameworks by Nursie on Saturday May 09, 2020 @07:02AM (#23123710)
I agree, things should be straightforward, readable and logical.

The Java people are describing here is alien to me, and I code Java for a living at the moment.

Re:Write Libraries, Not Frameworks by chii on Saturday May 09, 2020 @08:06AM (#23124053)
> The Java people are describing here is alien to me, and I code Java for a living at the moment.

you're looking at enterprise java, not regular java

Re:Write Libraries, Not Frameworks by Nursie on Saturday May 09, 2020 @09:54AM (#23124697)
I'm certainly not! You take that back! Yuck!

I'm writing microservices using a relatively lightweight, straightforward and explicit web framework (sparkjava, which is more of a library than a framework really), modern language features and no AOP...

Enterprise... pah!

(Oh, unless you mean the Spring crowd are enterprisey, in which case I take that all back.)

Re:Write Libraries, Not Frameworks by iso947 on Saturday May 09, 2020 @05:53AM (#23123397)
Modern OSes don’t log to simple text files you can grep, tail, watch, open in a text editor, etc.
Re:Write Libraries, Not Frameworks by Nursie on Saturday May 09, 2020 @07:00AM (#23123696)
The requirement was the other way around, that the source can be grepped for an error message and the result be meaningful.
Re:Write Libraries, Not Frameworks by wbl on Saturday May 09, 2020 @07:01AM (#23123708)
Unix was an improvement on all its successors.
Re:Write Libraries, Not Frameworks by iso947 on Saturday May 09, 2020 @06:37PM (#23128837)
And then it went downhill about 5 years ago as logs started being stored in binary and hidden by default
Re:Write Libraries, Not Frameworks by zerkten on Friday May 08, 2020 @11:22PM (#23121976)
The people that use Spring love it, well, at least they did when I was last working with them. They also loved talking about patterns, often didn't have enough traffic to stress the systems built on these relatively heavy object hierarchies, and were relatively comfortable (the only competition was the other half of the company using .NET.)
Re:Write Libraries, Not Frameworks by therealdrag0 on Sunday May 10, 2020 @12:30PM (#23133880)
lol. In my experience, in the enterprise world, yes people liked Java/spring, but also where comfortable giving it a ribbing. Everyone loved python but didn't get to use it for main-business code, and the Go and Scala projects have been very conflicted with both lovers and haters. In my ~20 person division, 1 person quit and another transferred with the main reason being their dislike of Scala!
Re:Write Libraries, Not Frameworks by thomk on Friday May 08, 2020 @11:22PM (#23121975)
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.
Re:Write Libraries, Not Frameworks by smitty1e on Friday May 08, 2020 @11:33PM (#23122051)
I always figured that Java folks were

- paid per class

- sought to reduce the number of executable lines per class to 1.

Re:Write Libraries, Not Frameworks by overgard on Saturday May 09, 2020 @10:49AM (#23125126)
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 by UK-Al05 on Saturday May 09, 2020 @05:30AM (#23123302)
Tbh that was Alan Kay's vision of object oriented programming. Lots of tiny objects collaborating via messages.
Re:Write Libraries, Not Frameworks by goatlover on Sunday May 10, 2020 @02:21AM (#23130681)
Was it tiny objects or tiny messages, or both? And I wonder how much of the Smalltalk system was made that way. I think at some point your class needs to handle some complexity that isn't easily broken into smaller classes.
Re:Write Libraries, Not Frameworks by AmericanChopper on Saturday May 09, 2020 @12:20AM (#23122285)
But that’s just OOP in general. You can choose a language that defaults to not using OOP-style abstractions, but then people will question why you choose python/node/ruby over a proper language like Go (or whatever else)
Re:Write Libraries, Not Frameworks by oreally on Saturday May 09, 2020 @04:25AM (#23123095)
> But that’s just OOP in general.

Nope, that's OOP taken to extremes rather. Java does that with enforcing things to be classes.

Re:Write Libraries, Not Frameworks by AmericanChopper on Saturday May 09, 2020 @05:14AM (#23123252)
The OOP paradigm itself requires rather heavy use of abstraction. You can deviate from those patterns to an extent, you can add more polymorphism if you want to, you can be selective in using some design patterns like DTOs. But most of the complaints I hear about Java would apply equally to most of the C# projects I’ve worked on, because those are just the annoying bits of OOP. I’d agree the Java is a bit more inflexible, but it’s not like the other OOP languages aren’t also full of boilerplate and layer upon layer of abstractions.
Re:Write Libraries, Not Frameworks by mewpmewp2 on Saturday May 09, 2020 @01:58AM (#23122643)
I will be honest and tell them it is because these are more productive and I enjoy being productive
Re:Write Libraries, Not Frameworks by AmericanChopper on Saturday May 09, 2020 @02:08AM (#23122672)
How productive you are with any particular tool really depends on what you’re trying to do with it.
Re:Write Libraries, Not Frameworks by danielscrubs on Saturday May 09, 2020 @02:13AM (#23122693)
Exactly! Almost nothing in the naming based on something with a very precise definition.

It's the unruly mind coming up with generalised words.

Re:Write Libraries, Not Frameworks by einpoklum on Saturday May 09, 2020 @03:19AM (#23122901)
Am I a weird person if that one doesn't seem very egregious to me?

The class loader is an important entity for a Java app. And you can have more than one (although this is advanced voodoo already). So, an instrumented class loader.

Re:Write Libraries, Not Frameworks by watwut on Saturday May 09, 2020 @02:23AM (#23122728)
Spring is not hard to use. It is popular because it is comfortable.
Re:Write Libraries, Not Frameworks by blackrock on Saturday May 09, 2020 @04:04AM (#23123033)
This reads like a circular definition.
Re:Write Libraries, Not Frameworks by jonathanstrange on Saturday May 09, 2020 @09:07AM (#23124401)
I wouldn't mind frameworks if they actually had what they claim to offer. Nowadays so many frameworks don't even deliver, they have those nicely looking webpages and come with advertisement after advertisement of their features (even if they aren't sold!), and then when you look closely at the source code or API docs, half of those features are vaporware.

This is more than infuriating, it can actually cost you a lot of time if you're not careful about evaluating the framework.

Re:Write Libraries, Not Frameworks by commandlinefan on Saturday May 09, 2020 @05:01PM (#23128289)
I can’t even figure out what Spring is claiming to offer. The only benefit of Spring is that you can move what ought to be compile-time exceptions into the runtime.
Re:Write Libraries, Not Frameworks by a1369209993 on Saturday May 09, 2020 @03:09PM (#23127496)
> http://web.archive.org/web/20141018110445/http://discuss.joe...

"Right. Fuck you. Fuck your lack of hammers. Fuck your factory factory factories. And fuck your store. If you decide to pull your head out of your ass, I'll be over here, duct-taping a rock to a stick so I can actually hammer a actual nail into a actual piece of wood."

I'm reminded of the HGttG scene regarding the display department.

Re:Write Libraries, Not Frameworks by a1369209993 on Saturday May 09, 2020 @05:29PM (#23128450)
> duct-taping a rock to a stick so I can actually hammer a actual nail into a actual piece of wood.

Note to anyone actually trying this: if you have a drill, drilling a hole in a piece of wood and sticking the stick (preferably dowel) through works better; if you need more weight, attach the rock to one side of the head, and a coin or other patch of metal to the other.

Also (if you have the space for it): adopt a lathe/smelter/set of chemical-refining glassware/etc today!

Re:Write Libraries, Not Frameworks by diehunde on Saturday May 09, 2020 @12:45AM (#23122387)
I prefer to read articles like the one you linked. They feel honest. If you don't like something you don't have to say "but yeah for this specific case it's fine, or if google is behind then it's alright..." just to be more correct and avoid comments from haters. I don't mind if you are a junior dev or Joel Spolsky. You should always write with confidence, especially when it's an article about an opinion.
Re:Write Libraries, Not Frameworks by mping on Saturday May 09, 2020 @04:36AM (#23123126)
I remember the Rails people making fun of the Spring stacktraces vs the Rails one (being much shorter). Guess what, a couple of years later Rails has the same layers of abstraction
Re:Write Libraries, Not Frameworks by finnthehuman on Saturday May 09, 2020 @09:48AM (#23124663)
It was always an argument about fashion. It just wasn't in fashion to admit that out loud at the time.

The conclusion was "the rails-not-java club is best" and then everyone worked backwards to find believable reasons why. At the impromptu pitch meetings "minimalism vs. complexity" took off.

Now that the rails club is out of fashion and the k8 club is in. Well, we'll invent reasons that over-engineering is better than deployment automation that "just" sticks a .jar in a .deb and apt-get upgrades a handful of non-virtualized servers colocated at a local datacenter.

Re:Write Libraries, Not Frameworks by edem on Saturday May 09, 2020 @04:01AM (#23123025)
Spring is not a good example. If you're a seasoned Java developer you look at an `AbstractDestinationResolvingMessageTemplate` and you just know what it does. I'm not kidding.

Spring used to be a bad example yes, but not anymore. They really put the thought and work into fixing its design. Right now I can write an app __completely__ independent of Spring. In fact that's what I'm usually doing. You can do Clean Architecture with Spring now. Please keep your facts straight.

Re:Write Libraries, Not Frameworks by oreally on Saturday May 09, 2020 @05:02AM (#23123205)
> If you're a seasoned Java developer you look at an `AbstractDestinationResolvingMessageTemplate` and you just know what it does. I'm not kidding.

This claim is so bad.

You could look at the name AbstractDestinationResolvingMessageTemplate and the useful information they would be gaining is that it's a message template. They would still not know how to use it; they'd still have to do an additional step like checking the documentation on its usage etc. The amount of useful information to text is small and it doesnt help.

Re:Write Libraries, Not Frameworks by edem on Saturday May 09, 2020 @07:50AM (#23123965)
I didn't say that you would know how to use it. You don't need to know, the framework uses it. What I said is that you would know _what_ it is if you ever get an exception from that class.

I'm 95% sure that all those people complaining about Spring never read the reference documentation. I did, and whenever I bump into a problem I have an idea about how to solve it. Besides reading it only takes a few days and you're set for years.

Why do anybody expect to be able to work with a technology if they don't bother reading the documentation? This is like complaining about not being able to drive a car when you sit down in the seat without training.

Re:Write Libraries, Not Frameworks by oreally on Sunday May 10, 2020 @12:18AM (#23130243)
What's your definition of 'know'? It's very common to have surface level knowledge of the class only to dive in and see that it does something else. So do you 'know' the code as well as you thought so? Probably not. Fact of the matter is you can't magically 'know' everything about a class based off a class name. And this includes your 'seasoned Java developers'.

You're throwing out some very large assumptions as well.

Re:Write Libraries, Not Frameworks by phkahler on Friday May 08, 2020 @09:54PM (#23121495)
That was good. I still use the Joel Test to evaluate companies.
Re:Write Libraries, Not Frameworks by thomk on Friday May 08, 2020 @10:51PM (#23121793)
Did you ever see his YouTube channel? It has exactly one video and it is awesome: https://www.youtube.com/channel/UC65NUFfqjWn3y02kYYl9nSQ
Re:Write Libraries, Not Frameworks by euoia on Saturday May 09, 2020 @03:58AM (#23123015)
That’s amazing, thank you. Is Google Sheets still missing the table functionality from Excel? It’s the first time I’ve seen this and it looks great. Normally I’d be forced to create a new “sheet”. On a side note, Joel is using Excel for Mac and I was wondering at what point it would beachball, which it does around 42 minutes.
Re:Write Libraries, Not Frameworks by d0m on Saturday May 09, 2020 @05:20PM (#23128408)
IMHO, the framework vs library debate is similar to the inheritance vs composition.

Inheritance: You must predict how people will use your class. Make a mistake and they're screwed and need to resort to all kinds of hack. (Like frameworks)

Composition: People will use your class if it fits their needs. They can easily wrap the code, tweak or simply discard it. (Like libraries)

Re:Write Libraries, Not Frameworks by leeoniya on Friday May 08, 2020 @10:49PM (#23121781)
Re:Write Libraries, Not Frameworks by sixhobbits on Saturday May 09, 2020 @06:35AM (#23123594)
I have a vague memory of a similar parody article which I've never been able to find again. IIRC it was in Ruby and he imported all libraries into a "god" object that could do absolutely anything.

Anyone know what I mean?

Re:Write Libraries, Not Frameworks by juped on Saturday May 09, 2020 @01:00AM (#23122436)
I kinda want to make a Spring class name generator now.
Re:Write Libraries, Not Frameworks by Qerub on Saturday May 09, 2020 @04:53AM (#23123178)
Somebody already did that for us others to enjoy: https://github.com/achin/boss-work-manager-configuration, running at http://java.metagno.me/
Re:Write Libraries, Not Frameworks by wetmore on Friday May 08, 2020 @09:49PM (#23121468)
The repeated joke about killing your ex-girlfriend did not age well.
Re:Write Libraries, Not Frameworks by overgard on Saturday May 09, 2020 @11:01AM (#23125211)
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 by ngngngng on Saturday May 09, 2020 @12:56AM (#23122420)
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."
Re:Write Libraries, Not Frameworks by DougBTX on Saturday May 09, 2020 @10:46AM (#23125102)
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 by suzzer99 on Saturday May 09, 2020 @02:26PM (#23127179)
You mean like the Honeymooners where Ralph Kramden's running joke was that he was going to cold-cock his wife? Or do we not want to go back that far?
Re:Write Libraries, Not Frameworks by GuiA on Sunday May 10, 2020 @02:20AM (#23130678)
Dark humor is just not professional, and many people expect the content they interact with on HN to be professional in tone.
Re:Write Libraries, Not Frameworks by finnthehuman on Saturday May 09, 2020 @09:54AM (#23124692)
This too shall pass.
Re:Write Libraries, Not Frameworks by ngngngng on Saturday May 09, 2020 @11:39AM (#23125613)
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 by ianmcgowan on Friday May 08, 2020 @11:51PM (#23122143)
I think the same thing every time reading this otherwise-excellent post. I don't think we should attempt to erase history, but it is super jarring, at least for me. Was it ever actually funny?
Re:Write Libraries, Not Frameworks by mrweasel on Saturday May 09, 2020 @03:36AM (#23122955)
I still think it’s funny and I’m sure that many people still do, even if they won’t admit it.

You don’t have to be a bad person to have a dark sense of humor and you don’t have hate women to find the joke in the hammer factory story funny.

Re:Write Libraries, Not Frameworks by epr on Saturday May 09, 2020 @07:14AM (#23123762)
Just read this to my non-programmer girlfriend and she could barely stop laughing, especially at the ex-girlfriend jokes. I really feel sorry for all the people over-analyzing these things. Like, do you think the author ever killed his ex-girlfriend? Do you think he even knows anyone who killed their ex-girlfriend? It's a joke!
Re:Write Libraries, Not Frameworks by danielscrubs on Saturday May 09, 2020 @02:27AM (#23122739)
I think it depends on how absurd you think it is. But it is in line with the absurdity of a factory factory and adds to the setting of "why would a developer ever extend the tool to that?" that is at least a common thought for me.

But I recently saw "Dont Fck With Cats" on Netflix and if had been a joke about animals I'd also been jared (because in my mind it would no longer be absurd).

So I guess it depends on what media makes us fearful off right now.

Re:Write Libraries, Not Frameworks by stormdennis on Saturday May 09, 2020 @01:23AM (#23122525)
Is there somewhere you can check what is or isn't funny?
Re:Write Libraries, Not Frameworks by newsbinator on Saturday May 09, 2020 @07:23AM (#23123798)
There is, but the spec changes every 3 ~ 12 months, so you have to keep rechecking and going back to edit.
Re:Write Libraries, Not Frameworks by pfarrell on Saturday May 09, 2020 @03:09AM (#23122876)
Everybody nowadays is inplementing HumorSensorFactoryFactory to define their own rules for what’s inbounds.
Re:Write Libraries, Not Frameworks by ivalm on Saturday May 09, 2020 @04:29AM (#23123105)
No, real people use EmotionSensorFactoryFactoryFactory. Why limit yourself only to HumorSensorFactory objects?
Re:Write Libraries, Not Frameworks by ljm on Saturday May 09, 2020 @01:04PM (#23126395)
You really need the MaybeEmotionSensorFactoryFactoryFactory to avoid getting NullPointerExceptions when applying to psychopaths.

An AbstractEmotionSensorSensorFactory would be required to unwrap that.

Re:Write Libraries, Not Frameworks by goatlover on Sunday May 10, 2020 @02:25AM (#23130695)
Java really did a number on the respectability of OOP, but at least it's good for learning and laughs.
Re:Write Libraries, Not Frameworks by gherig4 on Friday May 08, 2020 @10:29PM (#23121695)
What's wrong with it?
Re:Write Libraries, Not Frameworks by umvi on Saturday May 09, 2020 @12:23AM (#23122302)
It's no longer vogue to joke about murdering women
Re:Write Libraries, Not Frameworks by mewpmewp2 on Saturday May 09, 2020 @02:00AM (#23122654)
Joking about murdering men on the other hand is cool, so we can just direct our humor sense a bit.
Re:Write Libraries, Not Frameworks by stormdennis on Saturday May 09, 2020 @01:25AM (#23122530)
It's practically suicidal.
Re:Write Libraries, Not Frameworks by avl999 on Saturday May 09, 2020 @09:39PM (#23129659)
The interesting thing is that Joel is actually gay so he probably specifically went out of his way to not offend the sensibilities of his readers and the culture at large at that time by using "girlfried" as opposed to "partner".

Moreover dark humor has its place. Indeed 2 of the biggest comedies of the last 20 years used exactly this kind of humor (Seinfeld and The Office). Even to this day some of the most acclaimed comedies have humor in this vein (Veep and Curb Your Enthusiasm for eg).

Re:Write Libraries, Not Frameworks by setzer22 on Saturday May 09, 2020 @02:28AM (#23122745)
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.

Re:Write Libraries, Not Frameworks by teddyh on Saturday May 09, 2020 @10:26AM (#23124937)
> 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 longer considered funny today, it can mean a few things: Either more people now believe that there are more “psychos” than they thought previously, or an extraordinary number of people have turned into “psychos”. Or possibly both.

Re:Write Libraries, Not Frameworks by mperham on Saturday May 09, 2020 @11:50AM (#23125708)
There are lots of edgy, ironic white supremacists these days. Masking aggression with humor is an age-old tactic.
Re:Write Libraries, Not Frameworks by teddyh on Saturday May 09, 2020 @01:25PM (#23126589)
You can only mask outrageous things as humor if they are so utterly outrageous as to be virtually unthinkable. If they become only slightly plausible, they become no longer funny. Therefore, if jokes about murder are no longer funny, it’s because people no longer believe that murder is as likely to be unthinkable as it used to be.

This is why I think that masking outrageous things as humor is a losing strategy. Either it is funny, in which case the thing being masked with humor is so outrageous as to be completely niche, making the secret signal irrelevant, since so few people recieve it. Or, the thing is such a relatively common stance to make it no longer absolutely unthinkable, which makes it no longer funny, which removes the mask.

(Also, how do “white supremacists” fit into this? The original joke was about murdering an ex-girlfriend. This might possibly be generalized into misogyny, but I fail to see the connection to white supremacy. Please don’t fall into thinking that all people who hold opinions which you don’t like also hold all other opinions which you don’t like.)

Re:Write Libraries, Not Frameworks by oh_sigh on Friday May 08, 2020 @10:04PM (#23121551)
I doubt it landed well in the early 2000s either
Re:Write Libraries, Not Frameworks by monadic2 on Friday May 08, 2020 @11:49PM (#23122133)
You might as well say “i don’t believe sledgehammers make good hammers”.