resthub / resthub-spring-stack

RESThub Spring stack
http://resthub.org/spring-stack.html
Other
121 stars 66 forks source link

Check out modelmapper #121

Closed bclozel closed 12 years ago

bclozel commented 12 years ago

For Model<->DTOs conversion, we should check out https://github.com/jhalterman/modelmapper .

We don't have to include it in RESThub - maybe a short chapter in the documentation could be enough.

sdeleuze commented 12 years ago

I have not a clear view of why is it better than a simple DTO + copy contructor, could you explain ?

bclozel commented 12 years ago

A copy constructor in the DTO class? For that, we have to create a project-contract -> project-core dependency (thus killing our separation of concerns).

Another solution would be to create Converter classes in the project-core module - exactly what model mappers do (with a better approach).

Did I miss something?

sdeleuze commented 12 years ago

No you don't ;-)

If modelmapper is available from central, feel free to add the dependency in resthub-web-common pom.xml and add documentation to resthub.org.

If it is not available from central, please only add the documentation.

sdeleuze commented 12 years ago

There is also a Spring integration ! http://modelmapper.org/user-manual/extensions/

bclozel commented 12 years ago

Yes, its simple design and the spring integration made me reconsider using https://github.com/DozerMapper/dozer (which is still a good option).

Anyway we should really think this through, and question why many developers think DTOs are a bad practice because it requires maintaining to parallel (often similar) hierarchies.

sdeleuze commented 12 years ago

I think I prefer modelmapper too (very simple to use). And it is in Central (http://search.maven.org/#search%7Cga%7C1%7Cmodelmapper) !