Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good practice? Dummy object

Tags:

java

For a project I have to process a lot of information from a database and link it together. The information from the database is processed into Objects with attributes represented by information from the columns.
So far so good, but when I want to display this information to the user, I need to link the information from several objects together.
Now my question is, is it a good practice to make a new (dummy) Object with a few attributes from the other objects? A new Object that contains exactly the information I need at that moment? The information is difficult to fit into an ArrayList or Map, which was my first approach. The object can be discarded when no longer needed.
I try to make use of MVC Design Pattern, and I'm not really sure if this way of thinking fits MVC.

like image 657
Century Avatar asked Sep 21 '26 15:09

Century


1 Answers

Sure it is. It is a design pattern known as Data Transfer Object. For more info, see this question : What is Data Transfer Object?

like image 166
jeroen_de_schutter Avatar answered Sep 23 '26 06:09

jeroen_de_schutter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!