Raj Modha’s Post

Deleted 3,000 lines of Java POJOs. Replaced with Records. Immutable by default. Zero bad equals(). Thread-safe out of the box. That's not less code - that's intentional design. 🔧 #Java #Java21 #CleanCode #BackendEngineering

  • No alternative text description for this image

Can also use Lombok and that works also.

Records are nice, but I believe Java lost a chance to create something really unique by making records a simple sugar syntax. Records could have been created like structs in C++ where you pass by value (copy) instead of by reference.

At the end, you will only have a clean code base, a light weight package after compilation and at least one less dependency(Lombok) to worry about. Lombok is another option though

Ale Arias

Full Stack Developer | Java | Spring Boot | React | GCP

4d

A really good practice today, even i think this should be the standard, but pojos are still appearing for me in legacy code.

Yes, it took too much time for java to replace dto

See more comments

To view or add a comment, sign in

Explore content categories