Board index » delphi » MVP demo.

MVP demo.


2005-04-04 11:34:07 PM
delphi221
Hello, Joanna,
Your MVP sample shows for a list control to work.
Can I apply that to a more complicate form. For example, customer info
maintains form, need to retrieve several fields(name, address, accountID,
balance) from diff tables and at the bottom, need to bind a grid to the
customer order entries (recordset) to show the detail. when the database
get changed(someone else change it at the same time), how to refresh it on
screen?
How to apply? Please advice.
 
 

Re:MVP demo.

"JS" <XXXX@XXXXX.COM>a écrit dans le message de news:
42515e6a$XXXX@XXXXX.COM...
Quote
Can I apply that to a more complicate form. For example, customer info
maintains form, need to retrieve several fields(name, address, accountID,
balance) from diff tables and at the bottom, need to bind a grid to the
customer order entries (recordset) to show the detail. when the database
get changed(someone else change it at the same time), how to refresh it on
screen?
Certainly, MVP can be applied to any level of complexity; all that is
required is realise that MVP components can and should be nested.
You really need to build a framework in such a way that you have MVP
components (complete Presenters that contain a Model, View, Interactors,
Selection and Commands) for each property type you wish to display. Then you
also need specialised MVP components to cater for List and Object
properties.
So you would typically have :
Integer
String
Float
Date
etc...
and then :
List
Object
You have already seen something of how to create an MVP component to link up
a List View to a list of objects
Linking up the basic types like Integer, string, etc means creating
components that link Value Type classes for each of the basic types to edits
on a form.
Object MVP components will be mainly linking an object property to either: a
combo box that will display a list of objects to choose from, or a form that
allows editing of a whole object.
MVP components to link objects to editing forms will typically contain an
internal collection of MVP components designed to link up the properties of
the object to their respective edits on the form.
Changes to data are propogated through the Persistence Framework to the
objects behind visual controls and the Observer pattern within the MVP
framework allows the forms and edits to be updated in reponse to those
changes.
But beware of trying to update in response to other users, changes, this has
to be very carefully handled to avoid deadlocks and other contention issues.
This doesn't just apply to OO frameworks like OPF and MVP, it is a headache
in the 'data-aware' world as well.
Joanna
Consultant Software Engineer
TeamBUG support for UK-BUG
TeamMM support for ModelMaker
 

Re:MVP demo.

Thanks Joanna,
"Joanna Carter (TeamB)" writes
Quote
>Can I apply that to a more complicate form. For example, customer info
>maintains form, need to retrieve several fields(name, address, accountID,
>balance) from diff tables and at the bottom, need to bind a grid to the
>customer order entries (recordset) to show the detail. when the database
>get changed(someone else change it at the same time), how to refresh it
>on
>screen?

Changes to data are propogated through the Persistence Framework to the
objects behind visual controls and the Observer pattern within the MVP
framework allows the forms and edits to be updated in reponse to those
changes.
Can it possible fail in one step when propagate the change, how to handle
that?
Quote
But beware of trying to update in response to other users, changes, this
has
to be very carefully handled to avoid deadlocks and other contention
issues.
This doesn't just apply to OO frameworks like OPF and MVP, it is a
headache
in the 'data-aware' world as well.
How to handle ''data-aware" in general throught OPF and MVP?
 

Re:MVP demo.

"JS" <XXXX@XXXXX.COM>a écrit dans le message de news:
42517501$XXXX@XXXXX.COM...
Quote
Can it possible fail in one step when propagate the change, how to handle
that?
No, it should not be possible to fail in reflecting the value of a Value
Type in a visual control, this should be virtually failsafe.
Quote
How to handle ''data-aware" in general throught OPF and MVP?
If you mean connecting data-aware controls directly to database tables, then
this just doesn't work. The only real use for data-aware controls is to
create custom datasets that allow edits to bind to properties of objects,
but there are too many problems with unwanted side effects for my liking, so
I don't bother using them at all.
I have found it much easier to create my own object-aware controls as part
of the MVP framework.
Joanna
Consultant Software Engineer
TeamBUG support for UK-BUG
TeamMM support for ModelMaker