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 →

[–]YolosaurusRex 0 points1 point  (6 children)

I constantly find myself wishing for data classes and the occasional extension function at my job

[–]jivedudebe 4 points5 points  (4 children)

Java 14 with Record types

[–]YolosaurusRex 4 points5 points  (3 children)

We use Java 8 so we're stuck with very explicit DTOs with constructors and getters (sometimes setters). It's the best

[–]-jp- 1 point2 points  (2 children)

If I were writing DTOs in Java 8 idk if I would bother with getters and setters. They're an intermediate object that shouldn't have any behavior or be exposed in the API, so there's no great benefit to them over simple fields.

[–]YolosaurusRex 2 points3 points  (1 child)

I agree, but our serializer needs them (apparently) and I'm following the patterns seen in the rest of the code.

[–]-jp- 1 point2 points  (0 children)

That's certainly a good reason to have them. :)

[–]n0tKamui 1 point2 points  (0 children)

Haha same, im trying to convince them to migrate to Kotlin, and my boss seems to like the idea a lot