Hello Matthias,

sorry, i send this directly to your email address.

MB> Tony  already  said  most  of  the  interesting  things.  From  my
MB> experience  as  a software architect in several projects, I'd like
MB> to add a word of warning: :-)

>> I have modeled a class FooFacade with the stereotype <<Facade>>. This
>> class has associations to the Entity classes (<<EntityRef>>) which 
>> should be accessed via this facade. So i generate this facade with 
>> some createing, accessing (vo's) and removeing functions for each 
>> association.

MB> It may seem tempting to generate all these CRUD
MB> (create,read,update,delete) functions for your entities into the session
MB> facade. However, doing this, you expose the internals of your component
MB> across the facade to the client! The facade does not deserve its name
MB> any more.

MB> Example:

MB> class MyFacade
MB> {
MB>     public XValue createX();
MB>     public XValue findX(key);
MB>     public void updateX(XValue);
MB>     public void deleteX(key);

MB>     public YValue createY();
MB>     public YValue findY(key);
MB>     public void updateY(YValue);
MB>     public void deleteY(key);
MB> }

MB> What if (after three months into the project) you decide to remove
MB> entity Y? You'll have to modify a lot of client code that uses the CRUD
MB> functions for Y.

MB> I would recommend to put higher-level business methods into the facade
MB> that support your particular use case. Create one facade per coherent
MB> group of use cases. Adding or deleting one more entity class does not
MB> affect those high level methods and you have decoupled your component
MB> from your client. Your code will be much easier to maintain.

MB> Tell me if I understood you correctly and if all this makes sense to
MB> you...

Yes,  you  understood  me  correctly, and it makes sense but i have no
idea  how  the higher level methods should look to decouple the client
from the components ...


best regards

Ingo Bruell

---
<[EMAIL PROTECTED]>
<ICQ# 40377720>
Oldenburg  PGP-Fingerprint: CB01 AE12 B359 87C4 BF1C  953C 8FE7 C648 169E E5FC
Germany    PGP-Public-Key available at pgpkeys.mit.edu

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to