from http://www.martinfowler.com/bliki/LocalDTO.html
DTOs are called Data Transfer Objects because their whole purpose is to shift data in expensive remote calls. They are part of implementing a coarse grained interface which a remote interface needs for performance. Not just do you not need them in a local context, they are actually harmful both because a coarse-grained API is more difficult to use and because you have to do all the work moving data from your domain or data source layer into the DTOs.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
SCJP, SCJD, SCWCD, SCBCD
Kishore
SCJP, blog
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Kishore Dandu:
Simple is different from the load on the system. If the system you are hosting as web-app is accessed extensively; i would have both business objects & the lean version of them for remote transfer purposes to save some bandwidth for other needs.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Darya Akbari:
I would say that it depends on the underlaying framework you use. If it is J2EE's EJB 2 technology and whether your Business Objects (BO) are remote objects or not.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
Well, I wouldn't call anything that uses EJBs or remote objects "simple"...
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Darya Akbari:
It always depends for whom something is simple .
On the other hand, since he talks about TO and BO I think he has already entered the J2EE arena including EJB.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Mr. C Lamont Gilbert:
I disagree. TO shows a clear seperation of behavior from a BO. I can't see anyreason to conflate these two.
I find it hard to believe the data that is transferred in the DTO is the same data and form that would be transferred in and out of a BO.
If I conflated these two it would force me to expose the internal state of my BO in a format conducive to persistence. Currently my BOs don't care about persistence.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Stan James:
Now the client is not another system being developed by strangers, but your own component. Even so, take a moment to see if the client component is getting more than it needs or can use.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
I'm not sure how you come to that conclusion. Almost every system has BOs, and TOs could well be used with simple RMI or something...
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Darya Akbari:
I said, I think he has entered the J2EE arena.
It's the wording he uses to describe Business Object (BO) and Transfer Object (TO) why I guess :roll: that he already entered the J2EE arena. Both BO and TO belong into J2EE's terminology.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Mr. C Lamont Gilbert:
I won't give a concrete example of what bad could happen.
Thats like asking to give an example of what bad happens if you violate OO principles.
Therefore, my BOs expose data in a format that would not be saveable by any DAO. If I were forced to conflate them I would have to alter the way my BOs expose data.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
Uh, no, not at all. Both the terms BO and TO (or in fact *Data Transfer Object*, which is the actual name of the pattern - instead of the name that the sun people use because of their ignorance of the pattern community) are terms that aren't tied to J2EE in any way.
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Darya Akbari:
First of all, you came up with the term DTO not gundum hoi.
J2EE belongs to Sun and of course I prefer how Sun thinks about it.
BO and TO are wordings used by Sun. Even more, they describe J2EE patterns promoted by Sun.
I wonder how you get that Sun people are ignorant to the pattern community .
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Darya Akbari:
If you yourself accepted that we are in the J2EE arena, why don't you adapt yourself to J2EE's inventor way of thinking. Isn't it always better to use a framework (like J2EE is one) the way the inventor thought it should be used?
BO and TO are part of these J2EE patterns.
I think to help gundum hoi getting a clearer picture is to stay in the J2EE arena and no to confuse him with DTOs, theories, etc.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
I'm not sure that you would be forced to - although I'm also not sure that doing so would be really a really bad idea.
On the other hand, I wouldn't feel too bad using reflection to access private fields for persistence purposes, if nothing else comes to mind.
Originally posted by Mr. C Lamont Gilbert:
Because you are not the first to suggest this, I have considered using reflection for this purpose. But the issue is more complicated as my TO/DAO whatever to call them, actually track state change to know when they need saving and which objects need to be created in the db. Database management type stuff really.
So if I did away with my TO/DAO, then I would have to bake the state change monitoring into the BO.
Furthermore, this change always involves changing from my BOs using the DAOs to get the TOs, to my DAOs returning the BOs. So this turns my BO/DAO relationship inside-out.
And also, I would have to modify the BO for each DAO.
When I use JDO, I would have to have a set of BOs from JDO. When I use JDBC DAOs that would require a different implementation of the BOs and again hibernate DAOs would require a 3rd implementaiton of the BOs. I don't mind recreating persistence code for each DAO, but i would hate to recreate business code because I am adding a new DAOs implementation.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
from http://www.martinfowler.com/bliki/LocalDTO.html
DTOs are called Data Transfer Objects because their whole purpose ...
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Darya Akbari:
By the way, did you recognize that gundum hoi already left the party
Originally posted by Darya Akbari:
It all depends whether gundum hoi uses the J2EE or not.
Originally posted by Darya Akbari:
If you yourself accepted that we are in the J2EE arena, why don't you adapt yourself to J2EE's inventor way of thinking. Isn't it always better to use a framework (like J2EE is one) the way the inventor thought it should be used?
Why not following the path of least resistance?
J2EE patterns are very well accepted by the community if you count Martin Fowler and Grady Booch as members of this community . BO and TO are part of these J2EE patterns.
Originally posted by Mr. C Lamont Gilbert :
TO shows a clear seperation of behavior from a BO. I can't see anyreason to conflate these two.
Originally posted by Darya Akbari:
It all depends whether gundum hoi uses the J2EE or not. In case he does use J2EE of what help is your hint about DTO? Is the description somehow related to J2EE?
Your DTO link is only about theory
On the other hand I give him the BO and TO J2EE patterns at hand so that if he follows the J2EE description/examples for these patterns he has a tangible result which follows J2EE best practize.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Peer Reynders:
...
You are rightly concerned about the violation of the "Single Responsibility Principle" when your domain objects have to worry about persistence issues. That's why ORMs (like Hibernate) do it for you behind the scenes. Alternately you could use something like AOP (AspectJ) to inject the persistence aspects into your domain objects (a decidedly advanced technique).
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by gundum hoi:
DTO, TO and VO are all the same thing. It is sad that this multiple-term-for-the-same-thing problem exists in the patterns community because, the whole purpose of having this thing call "design patterns" is to have common terminologies, to ease discussion - so that software engineering can proceed to a higher level.
After reading, and re-reading and re-reading and re-reading the "Core J2EE Patterns" book again and again, now I understand that TO/DTO/VO is nothing more than a bucket to store data for transfer purposes only
Instead of doing :
1) someMethod(param1, param2, param3, param4, param5...param x);
it is much better to use a TO/DTO/VO and do this :
2) someMethod(param1); where param1 is a TO/DTO/VO
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I think she's lovely. It's this tiny ad that called her crazy:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|