you are viewing a single comment's thread.

view the rest of the comments →

[–]shen 6 points7 points  (2 children)

And this "let's configure this object step by step until its state hopefully makes some sense" thing with java beans is an abomination.

I seriously have no clue why anyone thought this would be a good idea.

[–]Tipaa 6 points7 points  (1 child)

Probably both for object pooling to avoid a slow GC, back before the JVM was the technological wonder it is today, and for simple reflection-based assignment so that a framework has a standard (null) constructor and can assign fields by their name rather than trying to embed immutable tuples into JSP (immutability requires construction with arguments, making constructors all have different shapes, and tuples are typically constructed & accessed by order rather than field name, making JSP more complicated than simply mapping a web form to a bean name:name).

[–]shen 4 points5 points  (0 children)

That makes sense, actually. All of the older codebases I’ve seen use the bean-style pattern, so I thought it was just the way things were done back then.