https://docs.spring.io/spring-framework/docs/current/javadoc...
https://docs.spring.io/spring-framework/docs/current/javadoc...
I think I still have a copy of the book that Johnson wrote to accompany the creation of Spring (which someone wants $300 bucks for on Amazon, I didn't know it was a collector's item). The last time I used Spring, I had the distinct thought that I should go through his book as if it were a bingo card, comparing it with the latest version. It seems like it has reacquired all of the bits of J2EE that it set out to avoid.
If, outside of Spring, there is anything in the Java world that more perfectly embodies Nietzsche's warning about fighting with monsters, I don't know what it is.
This comes across as an old fashioned view (bordering on extremely old-fashioned).
int id;
public int Id
{
get {
return id;
}
set(val) {
id = val;
}
}
They're now one liners, and obviously necessary public int Id { get; set; }
I don't keep up with Java any more, but C# has super short shortcuts for assignment like: public int Id { get; set; } => generateId();
If you, or your company, are misusing a completely optional documentation feature, which you definitely should not be using to annote obvious stuff like IDs, that's your problem, not OOPs.Switching to a functional language won't save your monitor, you'll still be forced to write bad code if doing stupid things like that are in your style guide.
private int id;
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}I honestly believe we're in a dire need for a more up-to-date metaphor that lets us better express our anger at a computer, due to monitors becoming paper thin and lightweight in the past decade or so.
> I honestly believe we're in a dire need for a more up-to-date metaphor that lets us express our anger at a computer, due to monitors becoming paper thin and lightweight in the past decade or so.
My experience may not be representative, but I believe I have encountered variants of "hurl the keyboard at the monitor" more often than "monitor out the window".
OTOH, that phrase doesn't account for laptops.
It is also not anger-ready for people working on tablets with rubber keyboards attached.
> As more operations are demanded, it is more likely that the existing partitioning of the world into the nice distinct cases won’t suit that operation anymore. Then, as a fix, we can introduce more specific cases, or make existing ones more general - leading to ambiguity, bloat and mental load for the existing operations.
Just an aspect.
It’s the kind of reasonable discussion that I crave in this field.
This was just an example of a behaviour that, if taken too far, could eventually lead to those 'hundreds of lines of abstract code'. Of course a single fold in itself is nothing to be concerned about. But an API that accepts a type 'm a' instead of '[Order]' has lost some of its connection with the business domain already.
Again, this might not be bad, it can even be good, but the problem is that many FP enthusiasts overdo it.
> In fact, I’ve seen a lot more unnecessarily abstracted garbage (usually “design pattern” workarounds to limitations in the object model) in just about every oop based web framework I’ve worked with.
Yes, this is the same problem which pops up in the OOP world as well. I guess it is a human thing to want to use your latest powerful language tool wherever you see a possibility for it.
Yeah, I’ve spent way to much time digging into “hundreds of thousands” of lines of abstract OOP code. And it’s sadly, largely ceremonial, mostly due to limitations in the language. The less fanatic about OOP the language is, the more useful it is, is a good rule.
But it’s absolutely not exclusive to either paradigm.
> But an API that accepts a type 'm a' instead of '[Order]' has lost some of its connection with the business domain already.
I completely agree, but I’m also curious how any API interface like that would pass code review. Since it’s so obviously too general.
But I guess the perceived upside is that the equivalent oop-construction would not get caught in code review.
> Yes, this is the same problem which pops up in the OOP world as well.
I know. I’ve spent more time working within oop than without. The type based FP-world just have orders of magnitude better tools.
> I guess it is a human thing to want to use your latest powerful language tool wherever you see a possibility for it.
This is kind of a sad way to dismiss people, as if they’re some kind of ephemeral fireflies...
The reality is that trying to force reality into in an inheritance-based, tree-structured taxonomy, is not only stupid, it also creates endless maintenance headaches.
Some problems fit that model better sure, but most things fit a much simpler ADT-based model since it’s much closer to how we think logically. (In terms of logical primitives and implicit recursion)
Do you have a code example? It would be interesting to see what this kind of code looks like.
Personally, I find complaining about a ”fold over a monad” to be equivalent to complaining about an ”integer indexed loop over an array”. It’s a pretty straightforward implementation detail that have very little to do with your business logic.
And business logic is far, far easier to model using ADTs (it’s literally just AND and OR, applied to data structures) than confounding object inheritance hierarchies.
In fact, I’ve seen a lot more unnecessarily abstracted garbage (usually “design pattern” workarounds to limitations in the object model) in just about every oop based web framework I’ve worked with.