Graeme Geldenhuys wrote: > On 10/11/2007, Al Boldi <[EMAIL PROTECTED]> wrote: > > > You don't need to do this. Eg: create a form without code or > > > non-visual components, bind BO attributes and components in a single > > > line, and the MVP will do the rest for you using informations from the > > > model. > > > > Sure, this is great when you are working with a disconnected > > presentation layer like a web interface. But for native apps, you don't > > need this, because your presentation layer is already connected to your > > model via TForm. > > I've lost you there. Why don't you need something like that? You > should never be mixing your BOM (business object model) with your > presentation layer. Borland didn't help this much be DB-aware > components and developers slapping loads of business rules in the > Forms directly.
This is a big misconception. The fact that TForm has the ability to host business rules and whatever else does not mean that you have to do it this way. You can maintain whatever model you like with TForm, for the mere fact that it's event-driven. > A GUI is the presentation layer. A Web interface is > another. Separating the BOM and the presentation layer you can have > one application that can server a standard GUI or Web interface. We > have such a product. And the business rules are maintained in a > single location. So if we change a text entry validation rule, it gets > automatically applied to both the GUI and Web application. Because we > have not business rules in our forms. This also makes unit testing > much easier. Yes, if your requirements are such that they call for a disconnected presentation layer, then you have a case to use an MVP. But again, don't let the TForm name mislead you into thinking that the TForm is about the presentation layer only. It's a lot more than that. It's about an event driven approach that happens to easily and directly inline the presentation layer. You don't have to use this layer if you don't like to, and you could conceivably create a disconnected model based on TForms much like the MVP, but this would increase code complexity a lot, so you would only want to do it when absolutely necessary. > I don't use MVP, but instead MGM (Model-GUI-Mediator) which is an > alternative to MVP. I used it extensively with tiOPF in our products. > I wrote mediators for LCL and fpGUI which can make any standard > (non-db) component object aware without sub-classing. > > http://www.atug.com/andypatterns/mgm.htm Sounds interesting. Does it feature a WebPresentation proxy? Thanks! -- Al _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
