Sunday, January 27, 2013

In case of Dozer or BeanUtils are working well, you could have a design issue

Dzoer is an open source utils used to facilitate copying beans. BeanUtils is the Apache equivalent.

Both libraries are used heavily within JEE project to copy the data from the DTOs object to the domain model object(used to do the abstraction between the service layer and  the persistence layer/technology).

This kind of libraries rely on the CoC(convention over configuration). They are working correctly only if the attribute name are similar and the both DTO and business object have the same structure(name and sub elements).
In case of difference, the developer have to:
  • write configuration
  • specific mapping code.
In summary, if the mapping is working nicely with no need for configuration or specific mapping code, that is mean that we have to re think the domain model design (mean less separation if the domain model and the DTO is almost the same).


No comments:

My favorites blogs

  • import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; Path path = Paths.get("./readme.txt"); long lineCount = Files.lines(pa...
    11 hours ago
  • Les 2 et 3 avril, les sociétés Xebia et Thiga seront présentes au ScrumDay, le rendez-vous annuel des agilistes, en tant que sponsors Silver ! Cet événeme...
    20 hours ago
  • A previous post introduced some features of using Scala with Vert.x. This post covers how to publish Rest web services in an elegant and simple fashio...
    2 years ago