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
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
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
Can also use Lombok and that works also.