tag:blogger.com,1999:blog-14570545.post115350336786368555..comments2023-10-03T14:02:23.078+02:00Comments on Thoughts and Fragments: Constructing View objects with the Builder patternSergio Bossahttp://www.blogger.com/profile/09315991044338298083noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-14570545.post-2191064244355816752015-10-09T09:00:29.152+02:002015-10-09T09:00:29.152+02:00As you said in the DDD mailing list, some kind of ...As you said in the DDD mailing list, some kind of Facade could do the job (even if with minor flexibility in the build process), but again, I think the Builder to be the best.<br /><a href="http://meizusale.com/meizu-mx5" rel="nofollow">meizu mx5</a><br /><a href="http://www.xiaomi2u.com/" rel="nofollow">xiaomi redmi note 2</a><br /><a href="http://meizusale.com/" rel="nofollow">meizu m2</a>houhttps://www.blogger.com/profile/16381262426656422499noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-36445953537089873272015-05-05T11:36:56.880+02:002015-05-05T11:36:56.880+02:00Each specific type of product implements these ope... Each specific type of product implements these operations as relevant for the construction of that particular product. So this pattern focuses on a generic process of constructing specific product types. But how does this particular abstraction help us in constructing view objects? I hope you can elaborate a little bit more on that.<br /><a href="http://www.meizu-mx5.com/" rel="nofollow">Anonymoushttps://www.blogger.com/profile/14345910870099888991noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-76651379026019496072013-05-17T03:19:58.787+02:002013-05-17T03:19:58.787+02:00I was lucky enough to get to meet some of Eric Zim... I was lucky enough to get to meet some of Eric Zimmerman’s MFA students and <a href="http://www.arm2teeth.com/" rel="nofollow"><strong>buy wow gold</strong></a> their projects when I guest-taught a class on how indie developers can work with the games press. I recently interviewed Eric and his fellow <a href="http://www.arm2teeth.com/FIFA-13.Gold" rel="nofollow"><strong>buy FIFA 13 ultimate teamAnonymoushttps://www.blogger.com/profile/01190304872434512533noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-29801916725190999962009-07-23T06:06:49.425+02:002009-07-23T06:06:49.425+02:00I like wrought iron gates, thank for the links!
H...I like wrought iron gates, thank for the links!<br /><br /><a href="http://www.drkoher.com" rel="heyhey" rel="nofollow">Hair Transplant Raleigh</a>Flerkin McBlerkinnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-55600091847801805722008-02-08T20:18:00.000+01:002008-02-08T20:18:00.000+01:00Sergio, when I read your code I realise how much a...Sergio, when I read your code I realise how much a basic programmer I am. Anyhow, onwards and upwards - always something new to learn.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-138051072552180702007-07-30T13:09:00.000+02:002007-07-30T13:09:00.000+02:00Sergio,I'm just starting to learn about DDD. So I ...Sergio,<BR/><BR/>I'm just starting to learn about DDD. So I might be wrong. <BR/><BR/>Since you can make any kind of query in your builder, doesn't it mean that you risk of creating a leakage in your domain boundary if you're tempted to query objects that come from outside your aggregate root either directly or indirectly (through join) ?<BR/><BR/>Regards,<BR/><BR/>SetyaSetyahttps://www.blogger.com/profile/03813815691287052202noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-53659505322636825592007-03-11T07:32:00.000+01:002007-03-11T07:32:00.000+01:00I like the idea of view objects and builder patter...I like the idea of view objects and builder pattern. There are some object mapping frameworks that could help us build view objects more easily such as Dozer, DynaDto, ...<BR/>By using Dozer or DynaDto, you can save development time a lot. :)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-70484925337382036822007-01-29T16:11:00.000+01:002007-01-29T16:11:00.000+01:00"but setter methods must be used by the builder fo..."but setter methods must be used by the builder for constructing the View object."<br /><br />Is this a limitation of Java? We make an effort to have most, if not all, objects be immutable. Objects are always built by other objects (factory objects) and they use the contructor to do so. Thus, you would be hard pressed to find a single "set" in any of our 300+ classes.<br /><br />-JoeAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1162996826717885642006-11-08T15:40:00.000+01:002006-11-08T15:40:00.000+01:00Thanks for the blog entry, its an interesting topi...Thanks for the blog entry, its an interesting topic that covers an issue that we're dealing with on my project currently.<BR/><BR/>There are few points I disagree with:<BR/><BR/> 1) I agree with some of the other replies in that I'm not sure that the view objects necessarily come from domain objects, particularly if your creating them for performance.<BR/> 2) The builder pattern might not be wellAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154615104841376462006-08-03T16:25:00.000+02:002006-08-03T16:25:00.000+02:00Okay, I'll try wordpress.Here's my very first blog...Okay, I'll try wordpress.<BR/><BR/>Here's my very first blog entry about view objects.<BR/><BR/>http://billhamaker.wordpress.com/Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154601085249519282006-08-03T12:31:00.000+02:002006-08-03T12:31:00.000+02:00Bill Hamaker said...> Sorry no blog yet, I should ...Bill Hamaker said...<BR/><BR/>> Sorry no blog yet, I should probably <BR/>> create one. Any opinions on the best <BR/>> blog website?<BR/><BR/>Yes, you should create one ;)<BR/>I strongly discourage you to use the Blogger service: I use it because I don't want to change the blog address, but it lacks a lot of features.<BR/>Maybe you could take a look at the WordPress service.<BR/><BR/>> One thingSergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154463593988387782006-08-01T22:19:00.000+02:002006-08-01T22:19:00.000+02:00Sergio,Sorry no blog yet, I should probably create...Sergio,<BR/><BR/>Sorry no blog yet, I should probably create one. Any opinions on the best blog website?<BR/><BR/>One thing that is confusing about views is the chicken/egg question. Which came first, the view or the domain object?<BR/><BR/>In your preface you define a view as being an immutable value object extracted from one or more domain objects. However in practice view objects are Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154411734212844502006-08-01T07:55:00.000+02:002006-08-01T07:55:00.000+02:00Roni Burd said...> Very interesting discussion ind...Roni Burd said...<BR/><BR/>> Very interesting discussion indeed!<BR/><BR/>Hi Roni,<BR/><BR/>thanks for your words.<BR/>You can read my reply in your blog.<BR/><BR/>Cheers,<BR/><BR/>Sergio B.Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154289158731328572006-07-30T21:52:00.000+02:002006-07-30T21:52:00.000+02:00Very interesting discussion indeed!I think Sergio ...Very interesting discussion indeed!<BR/><BR/>I think Sergio touched an interesting point on how to build view object and give that responsibility to a specific class. <BR/><BR/>What I like about this approach against the simple facade one, is that it separates the responsibility to a class, although I doubt the Builder pattern is the right solution (at least in its "GoF style") and would not go Roni & Cindyhttps://www.blogger.com/profile/11442220403217805641noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154126950164093472006-07-29T00:49:00.000+02:002006-07-29T00:49:00.000+02:00Jesse Napier said ...> I understand the Hibernate ...Jesse Napier said ...<BR/><BR/>> I understand the Hibernate can eagerly <BR/>> fetch collections, but is that really <BR/>> what <BR/>> we are trying to do here? Im talking <BR/>> about <BR/>> returning a collection of objects for <BR/>> displayiing in a list. So the projection <BR/>> itself would be the collection without <BR/>> the <BR/>> need to eagerly fetch another <BR/>> association<BR/><BRSergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154100102239818452006-07-28T17:21:00.000+02:002006-07-28T17:21:00.000+02:00Hi Sergio, I must be missing something because to...Hi Sergio, I must be missing something because to me it looks like your example is all about building a single view of an aggragrate and certain associations into a single view. I understand the Hibernate can eagerly fetch collections, but is that really what we are trying to do here? Im talking about returning a collection of objects for displayiing in a list. So the projection itself would Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154094324805538452006-07-28T15:45:00.000+02:002006-07-28T15:45:00.000+02:00Hi Jesse,thanks for joining this discussion.> I wa...Hi Jesse,<BR/><BR/>thanks for joining this discussion.<BR/><BR/>> I was having an issue with displaying a <BR/>> list of domain object data that requires <BR/>> me to walk the object graph of each of <BR/>> the items in the list.<BR/>> [CUT] <BR/>> View objects sound like a great way to <BR/>> help me solve my problem, but a builder <BR/>> doesn’t seem appropriate for returning a <BR/>> Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1154079056382534412006-07-28T11:30:00.000+02:002006-07-28T11:30:00.000+02:00Christofer Jennings said...> Have you tried making...Christofer Jennings said...<BR/><BR/>> Have you tried making the view-objects' <BR/>> fields final and setting them in a <BR/>> constructor? It looks like the builder <BR/>> work the same<BR/><BR/>If you use the view object constructor and remove all setters, it could be hard to construct the object in different steps!<BR/>You'd have to place all retrieved properties of the view object into Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1153930890825799112006-07-26T18:21:00.000+02:002006-07-26T18:21:00.000+02:00Hi Sergio,Thanks for writing this up. I think ther...Hi Sergio,<BR/>Thanks for writing this up. I think there are some very interesting ideas here. But I'm not exactly sure that the builder pattern is the solution to solve my initial problem. I was having an issue with displaying a list of domain object data that requires me to walk the object graph of each of the items in the list. When walking the graph, some associations are lazy loaded which Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1153852207623613202006-07-25T20:30:00.000+02:002006-07-25T20:30:00.000+02:00Have you tried making the view-objects' fields fin...Have you tried making the view-objects' fields final and setting them in a constructor? It looks like the builder work the same, and it could be a (gulp) singleton ... injected of course. :)<BR/><BR/>And I'm still not convinced polymorphism would be much use once you have fields from two or more object types in one view-object (like in my last message). The UI *could* use polymorphism, but *does*bozhttps://www.blogger.com/profile/06030343788643798572noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1153847176534951932006-07-25T19:06:00.000+02:002006-07-25T19:06:00.000+02:00Pascal Lindelauf said...> What I was wondering is:...Pascal Lindelauf said...<BR/><BR/>> What I was wondering is: what exactly is <BR/>> the extra value you get when choosing <BR/>> the <BR/>> Builder pattern as opposed to, say, a <BR/>> Façade pattern? As far as I can see (and <BR/>> correct me if I’m wrong), the extra <BR/>> value <BR/>> is that you can define a kind of generic <BR/>> user interface for a particular type of <BR/>> class.<BR/><BR/Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1153846306177331672006-07-25T18:51:00.000+02:002006-07-25T18:51:00.000+02:00Hi Christofer,thank you very much for pointing me ...Hi Christofer,<BR/><BR/>thank you very much for pointing me out the public setters of the SimpleEmployeeView class: I quickly wrote that code as example, and I didn't notice it.<BR/>If you re-read the post, I improved the example separating the SimpleEmployeeView interface and implementation, in order to use, outside the builder, only the interface (that has no setter methods).<BR/><BR/>As you Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1153844216315238722006-07-25T18:16:00.000+02:002006-07-25T18:16:00.000+02:00Hi Bill,thanks for your interesting thoughts.Linki...Hi Bill,<BR/><BR/>thanks for your interesting thoughts.<BR/><BR/>Linking the concept of View object with that of Proxy object is interesting and may deserve another whole post.<BR/><BR/>Let me know if you have some other thought, or maybe some blog post of yours to point to.<BR/><BR/>Cheers,<BR/><BR/>Sergio B.Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1153768124678352362006-07-24T21:08:00.000+02:002006-07-24T21:08:00.000+02:00Hi Sergio,Thanks for your reply. I feel we’re gett...Hi Sergio,<BR/><BR/>Thanks for your reply. I feel we’re getting closer to the root of the proposed solution. Let’s take it another step further. What I was wondering is: what exactly is the extra value you get when choosing the Builder pattern as opposed to, say, a Façade pattern? As far as I can see (and correct me if I’m wrong), the extra value is that you can define a kind of generic user Pascal Lindelaufhttps://www.blogger.com/profile/11329453203481798837noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1153763131523843262006-07-24T19:45:00.000+02:002006-07-24T19:45:00.000+02:00Thanks for the blog Sergio. I like the idea of rea...Thanks for the blog Sergio. I like the idea of read-only view objects and builders. And I've got a couple of questions.<BR/><BR/>1) If view objects are read-only, why do they have public setters in your example? (Am I just nit-picking example code here?)<BR/><BR/>2) Are the interfaces useful? (related to Bill's comment, I think.)<BR/><BR/>It seems like view-objects are here to help when we need bozhttps://www.blogger.com/profile/06030343788643798572noreply@blogger.com