What I agree is that objects have to be rich in information AND associations. I don´t like(it´s just my opinion) reflecting my tables in my Objects. Like, if I have a Category and a Product, I like to associate these two objects, not just add productId in Category. About the methods, I had all the types of fights with teachers in my graduation becoz they liked to teach persistent methods inside POJOs. :S. DAOs were made to persist data, not POJOs. Best Regards Rafael Mauricio Nami
2005/10/17, Frank W. Zammetti <[EMAIL PROTECTED]>: > > So, is another way of saying what your saying is that you feel that > DTO+DAO=Something Good(tm)? > > So, if instead of having: > > class CustomerDTO { > private String firstName; > private String lastName; > private String id; > public setFirstName(String); > public setLastName(String); > public setId(String); > public getFirstName(String); > public getLastName(String); > public getId(String); > } > class CustomDAO { > public createCustomer(CustomerDTO c); > public getCustomer(String id); > public updateCustomer(CustomerDTO c); > public deleteCustomer(String id); > } > > ...you instead have... > > class Customer { > private String firstName; > private String lastName; > private String id; > public setFirstName(String); > public setLastName(String); > public setId(String); > public getFirstName(String); > public getLastName(String); > public getId(String); > public createCustomer(); > public getCustomer(String); > public updateCustomer(); > public deleteCustomer(); > } > > Is that roughly what your saying? If so, I don't think I disagree and > would be interested to hear why anyone thinks it's NOT a good idea. > > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > AIM: fzammetti > Yahoo: fzammetti > MSN: [EMAIL PROTECTED] > > On Mon, October 17, 2005 12:00 pm, Rafael Nami said: > > [EMAIL PROTECTED] said: > > *"I think it is best to use directly domain objects, i.e. ye old (but > > good) > > OOP with "real" objects."* > > ** > > +1 :) > > Best Regards > > > > Rafael Mauricio Nami > > > > > > 2005/10/17, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > >> > >> I'm not a guru but... > >> Once I thought that DTOs are a nice way to separate the webapp's > layers, > >> just because they are simply data containers and have no logic. > >> But now I think they are completely useless, because they have no > logic! > >> I > >> know it is stupid to use the same answer for two opposite points of > >> view. > >> The cause of my change-of-mind is the so-called "anhemic programming" > >> that > >> DTOs promote. > >> I think it is best to use directly domain objects, i.e. ye old (but > >> good) > >> OOP with "real" objects. Someone could say that this breaks security, > >> but > >> I don't think so, because security will be broken only with a misuse of > >> these objects (e.g. calling business methods in JSPs). > >> I am sure that many developers of the list agree with me, and many > >> others > >> don't. > >> I think that the "ease of code" principle must be followed, then DTOs > >> are > >> simply a loss of time, IMO. > >> Ciao > >> Antonio Petrelli > >> > >> [EMAIL PROTECTED] wrote: > >> > >> >Hi, Gurus, > >> > > >> >Background: I just started a Struts project with Hibernate. I have > >> chosen to use the Data Access Object with (Abstract Factory) design > >> pattern because my client uses Oracle and I use Postgresql database. I > >> am > >> working with other teams remotely and they decided to use DTO. > >> > > >> >Problem: A few months ago, I recall a message thread on this list with > >> a > >> subject header of: 'DTOs are evil'. Since I am new to this, I am having > >> problems understanding why. I thought that DTO are for data storage and > >> data transfer between Business and Value Objects. > >> > > >> >Questions: I have the following questions: > >> > > >> >1. Why I shouldn't choose it? > >> > > >> >2. Should I be using the Apache Commons BeanUtils in my action? It has > >> a > >> method like BeanUtils.copyProperties(...). > >> > > >> >3. If not BeanUtils, then what do you recommend? > >> > > >> > > >> >Thanks, > >> > > >> >Bob > >> > > >> >__________________________________________________ > >> >Do You Yahoo!? > >> >Tired of spam? Yahoo! Mail has the best spam protection around > >> >http://mail.yahoo.com > >> > > >> > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >