Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958783

Pages: 1
Anonymous
Unregistered




The whole exercise is silly obfuscation
      #5718 - 03/24/04 05:30 PM

So, instead of "name=employee.getName();", we have "employee.export(myBuilder);name=myBuilder.getName();" Same difference - just hiding the getter (and setter) behind a pointless (and maintenence-unfriendly) layer of indirection.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Zing
Unregistered




Re: The whole exercise is silly obfuscation [Re: Anonymous]
      #12592 - 10/18/04 07:20 PM

Not really, because you never need the name.

If it's on the web page, you would use an HTMLBuilder.
If it's on a component, you would use a JComponentBuilder.
If it's supposed to go into a database, you would have an SQLBuilder.

Inventing a useless builder which does nothing but expose the get/set methods and using it as an argument against the original proposition, doesn't help anything, or anyone at all.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: The whole exercise is silly obfuscation [Re: Zing]
      #13353 - 11/17/04 04:46 AM

Quote:


...
If it's on the web page, you would use an HTMLBuilder.
If it's on a component, you would use a JComponentBuilder.
If it's supposed to go into a database, you would have an SQLBuilder.
...




what if you need just the first name, last name, or first and last name only, etc... i suppose you will make a fine-grained builder. if you have a fine-grained builder, you don't need any of the other builder. in many cases, this approach is using cruise missile to knock out $10 tent (rumsfeld, i think).


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: The whole exercise is silly obfuscation [Re: Anonymous]
      #13355 - 11/17/04 06:02 AM

Quote:

what if you need just the first name, last name, or first and last name only, etc...




Thats exactly the point! You don't(!) "just need the ..." whatever it is. You want to do something with it. Display it somewhere, Store it somewhere. So you Code a DisplayJustTheNameBuilder or if you like it more flexible a DisplayBuilder("JustTheName").

As with all Design Patterns they are overwight in this small examples, but highly useful in any full sized project.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: The whole exercise is silly obfuscation [Re: Anonymous]
      #15377 - 02/08/05 02:13 PM

Actually you might need first name, then some fields of another object and then the last name. In this particular example it doens't make much sense, but it often does.

Typically a user interface made based on the objects proves to be very unuseful. A good user interface is based on the process (or use cases) for the user, which uses parts from various objects.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: The whole exercise is silly obfuscation [Re: Anonymous]
      #15879 - 03/02/05 03:39 PM

Quote:


Typically a user interface made based on the objects proves to be very unuseful. A good user interface is based on the process (or use cases) for the user, which uses parts from various objects.





I agree with the above statement. I would argue that there are two things going on here. The first is the 'hiding' of the domain layer. I typically do this kind of hiding through DTOs (Data Transfer Objects), the author calls them Importer and Exporter objects. The second is the movement of data between the domain objects and the Importers/Exporters. I typically do this kind of thing via Assemblers.

In my most recent project we've had great success with using Commands tailored to the user interface. Each command is responsible for providing a set of input and output DTOs, and assembling and disassembling them. The command uses the domain layer to do it's work, but completely hides the domain objects by using the UI specific (NOT domain specific) DTOs.

What I like about the authors idea is in moving the assembly/disassembly into an interface contract promoted by the domain objects. My DTO, which might promote data found in 4 different domain objects, could implement 4 Exporter interfaces. My command could then pass my DTO to the four domain objects I'm interested in getting data from. Note that my DTO might not do anything with 80% of the data passed to it through the Exporter interfaces. If I change a 'property' of one of the domain objects, I only need to promote that property appropriately though my contracted Exporter interface. I avoid having to change all of my command assembler/disassemblers.

I like it. I'll have to do some more thinking about it.


Post Extras: Print Post   Remind Me!   Notify Moderator  

Unregistered




Re: The whole exercise is silly obfuscation [Re: Anonymous]
      #47325 - 05/17/07 12:35 AM

----
I typically do this kind of hiding through DTOs (Data Transfer Objects), the author calls them Importer and Exporter objects. The second is the movement of data between the domain objects and the Importers/Exporters.
----

I think you missed the point. The author is _not_ moving data around. The "domain-specific object" as you put it, is just "the object, the original and only object. It's data is not copied into other objects. A DTO is a xerox copy of the original, which is exactly what Holub is trying to avoid.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 8557

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5