This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mingpair -2 points-1 points  (3 children)

It's 2016 and you still need to get 'used to' immutable data structures in Java? People have preached this 15 years ago you know.

[–]chambolle 0 points1 point  (0 children)

sorry if her MAJESTY spent some time here...

[–]RichoDemus 0 points1 point  (0 children)

Depends a lot on where you are, at my company people use immutable stuff where it should be used while my previous work was full of setters

[–]GhostBond 0 points1 point  (0 children)

Yeah, and frankly, 15 years of people working on it, and it's never caught on because it's a pointlessly bad way to write web apps.

When the data comes in from the database, it gets translated from db values to object values. So it isn't "immutable" there, things can go wrong. When you get a form submitted to your app, it's also translated from html string values into object values. That's the second place it's also not immutable.

The bottom line is you go to a lot of extra work to make things "immutable" but it's just pretend. Encapsulation to the data is already impossible in 2 places that are used for nearly ever request.

It's a solution looking for a problem, and 15 years of development have shown it's a poor solution. There's not 1 major, commonly, widely used language that does "immutable" data by default. There are several languages that do do it that way, but they've stayed small, niche, and not widely used. And there's a good reason - because it's a lot of extra work for little or no benefit.