DEV Community

Discussion on: When Builder is anti-pattern

 
siy profile image
Sergiy Yevtushenko

Such a DB design is also smell. But sometimes it's hard to change. There is no universal recipe what to do, but you can try following things:

  • group linked fields into more complex objects (like extract all user details into user object + contact info object)
  • use projections - narrower POJO's for specific use cases
  • kinda inverse version of projections - create core POJO which contains most often used fields and several specific POJO's for various use cases (and use core POJO as single field) The goal of all these approaches is the same - reduce number of fields. This simplifies use of such a big POJO and in the same time reduces risk of error.