 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Graeme Geldenhuys Guest
|
Posted: Thu Dec 21, 2006 9:13 am Post subject: What to learn first? MVC or MVP |
|
|
Hi,
I have been using the MGM (Model-GUI-Mediator) pattern in my work for
over a year now. [http://www.atug.com/andypatterns/mgm.htm] I think MGM
fits between MVC and MVP. It's really easy to implement and I works
perfectly with the Techinsite tiOPF framework.
Saying that, I have always been curious about MVC and MVP. I have been
wanting to learn one or both of them to see how they compare to MGM. I
use tiOPF and MGM in a commercial environment.
A few questions:
* Is there a need to study both MVC and MVP?
* Can I still use the GUI Designer to build my forms and then hook up
the MVC or MVP. I currently do this with MGM.
* tiOPF and MGM doesn't use Interfaces. My knowledge of Interfaces are
limited. Is Interfaces required for MVC or MVP? If so, I guess it would
be good to learn and add another tool to my developer toolbox.
* Coming back to the GUI Designer. I have existing forms I use with MGM.
Would it be possible to convert them one at a time to MVC or MVP to try
them out, or how does it work? I guess this is a stupid question,
because the whole point is to not have code in the Forms, which is what
I have now it MGM. All that a form of mine does, is create and destroy
instances of the Mediating Views. So I guess converting them should be easy.
* Can I use Visual Form Inheritance with MVC and MVP? Currently I am
with MGM.
* Why is there free/open source implementations of MVC and MGM for
Delphi, but not of MVP? Is MVP that hard that nobody wants to give
there work away, or make it a community project.
* Is MVC and MVP tied to a specific OPF framework, or is it easy to swap
out OPF frameworks? With MGM this should be pretty easy.
--
Graeme Geldenhuys
There is no place like S34° 03.168' E018° 49.342' |
|
| Back to top |
|
 |
Jon Guest
|
Posted: Thu Dec 21, 2006 4:11 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
Hi Graeme,
This looks really interesting, just what I need. Is there any example source anywhere you could point me to ? I am particularly interested in how it manages lists / listviews for example.
Thanks,
J
Graeme Geldenhuys <graemeg (AT) spamfilter (DOT) co.za> wrote:
| Quote: | Hi,
I have been using the MGM (Model-GUI-Mediator) pattern in my work for
over a year now. [http://www.atug.com/andypatterns/mgm.htm] I think MGM
fits between MVC and MVP. It's really easy to implement and I works
perfectly with the Techinsite tiOPF framework.
|
|
|
| Back to top |
|
 |
Oleg Zhukov Guest
|
Posted: Thu Dec 21, 2006 5:09 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
Hi Graeme,
"Graeme Geldenhuys" <graemeg (AT) spamfilter (DOT) co.za> wrote:
| Quote: | * Is there a need to study both MVC and MVP?
|
MVP is an evolution of MVC and has a number of benefits so most probably
you will choose MVP, but it's important to understand both paradigms.
| Quote: | * Can I still use the GUI Designer to build my forms and then hook up the
MVC or MVP. I currently do this with MGM
|
In contrast to MGM in both MVC and MVP the view observes the model,
so you will need to move UI update logic to your forms.
| Quote: | * tiOPF and MGM doesn't use Interfaces. My knowledge of Interfaces are
limited. Is Interfaces required for MVC or MVP? If so, I guess it would be
good to learn and add another tool to my developer toolbox.
|
Interfaces in MV(C/P) serve as a means of implementing Observer pattern.
MV(C/P) DOES require Observer pattern, but its implementations may
vary: Observer may also be implemented with events or with Observer
abstract class (as in http://www.atug.com/andypatterns/mgm.htm)
| Quote: | * Coming back to the GUI Designer. I have existing forms I use with MGM.
Would it be possible to convert them one at a time to MVC or MVP to try
them out, or how does it work?
|
As I mentioned in MGM the Mediator updates the UI, but in MV(C/P) the
UI observes the model and updates itself. So you will need to move the
update logic to your forms.
MGM is similar to Passive View pattern:
http://www.martinfowler.com/eaaDev/PassiveScreen.html
A detailed overview of MV(C/P) and others:
http://www.martinfowler.com/eaaDev/uiArchs.html
| Quote: | * Can I use Visual Form Inheritance with MVC and MVP? Currently I am with
MGM.
|
Why not.
| Quote: | * Why is there free/open source implementations of MVC and MGM for Delphi,
but not of MVP? Is MVP that hard that nobody wants to give there work
away, or make it a community project.
|
Sometimes it's called MVC but it's actually MVP, or it's easy to convert to
MVP.
| Quote: | * Is MVC and MVP tied to a specific OPF framework, or is it easy to swap
out OPF frameworks? With MGM this should be pretty easy.
|
MV(C/P) is a glue between the View and the Model. OPF is a glue between
the Model and Persistent Storage. They don't touch each other :-)
Regards,
--
Oleg Zhukov |
|
| Back to top |
|
 |
Graeme Geldenhuys Guest
|
Posted: Thu Dec 21, 2006 5:57 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
Jon wrote:
| Quote: | This looks really interesting, just what I need. Is
there any example source anywhere you could point me
to ? I am particularly interested in how it manages
lists / listviews for example.
|
Yes I have examples and a implementation. Both can be found in the
tiOPF project on SourceForge.
Examples:
https://svn.sourceforge.net/svnroot/tiopf/tiOPF2_Demos/GenericMediatingViews
There is examples for Edit and List mediators.
As for the implementation. I coded my implementation slightly different
to what Andy Bulka mentions on his website. I created generic mediators
for the most common GUI components and use RTTI to set and get data from
the Model. I now only need to descend from one of the generic mediators
and implement what I need by overriding certain methods. For example:
Setting the max length of a TEdit, etc. I also override methods to give
visual feedback of missing data or invalid data. For example: If a Last
Name edit box is empty, the editbox background will change to yellow
and the editbox hint property will be set saying what is wrong. As soon
as valid data has been entered, the control is set back to normal. (The
users love this)
Anyway, my implementation can be found in:
https://svn.sourceforge.net/svnroot/tiopf/tiOPF2/Trunk/GUI
The units are as follows:
tiGenericEditMediators.pas
tiGenericListMediators.pas
tiGenericTreeViewMediator.pas
tiTreeBuildVisitor.pas
The TreeView mediator is not an Observer at the moment. It can get
quite complex if you do. One day I'll implement it. I finally had a
need for a StringGrid mediator (I don't like grid's in a GUI, they
belong in a spreadsheet) and I'm currently working on that and should be
done with it in the next week or so.
--
Graeme Geldenhuys
There is no place like S34° 03.168' E018° 49.342' |
|
| Back to top |
|
 |
Jon Guest
|
Posted: Thu Dec 21, 2006 9:10 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
| Quote: | Yes I have examples and a implementation. Both can be found in the
tiOPF project on SourceForge.
|
Thanks for that, I've downloaded it and will take a look
J |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Fri Dec 22, 2006 4:34 am Post subject: Re: What to learn first? MVC or MVP |
|
|
"Graeme Geldenhuys" <graemeg (AT) spamfilter (DOT) co.za> a écrit dans le message de
news: 458a3138 (AT) newsgroups (DOT) borland.com...
| * Is there a need to study both MVC and MVP?
Not a need, but possibly an interest :-)
| * Can I still use the GUI Designer to build my forms and then hook up
| the MVC or MVP. I currently do this with MGM.
Certainly.
| * tiOPF and MGM doesn't use Interfaces. My knowledge of Interfaces are
| limited. Is Interfaces required for MVC or MVP? If so, I guess it would
| be good to learn and add another tool to my developer toolbox.
Interfaces are useful but, if you are using Delphi for Win32, they can bring
their own problems. You can avoid using interfaces, it's just not as elegant
a solution.
| * Coming back to the GUI Designer. I have existing forms I use with MGM.
| Would it be possible to convert them one at a time to MVC or MVP to try
| them out, or how does it work? I guess this is a stupid question,
| because the whole point is to not have code in the Forms, which is what
| I have now it MGM. All that a form of mine does, is create and destroy
| instances of the Mediating Views. So I guess converting them should be
| easy.
MVP can be used as much or as little as you want, it certainly isn't an all
or nothing case. My MVP frameworks, both Delphi and C#, ensure that there is
absolutley no code on any of the forms.
| * Can I use Visual Form Inheritance with MVC and MVP? Currently I am
| with MGM.
How you construct the UI elements is irrelevant to the MVP framework.
| * Why is there free/open source implementations of MVC and MGM for
| Delphi, but not of MVP? Is MVP that hard that nobody wants to give
| there work away, or make it a community project.
My clients, who have funded their versions of the MVP framework would not be
very happy if I jusqt gave away what has already cost them. The only way I
can help is to describe the constituent parts and their roles but I cannot
simply publish the total code. The other consideration is that I have found
MVP to be more of a design pattern than a ready coded framework; yes, there
are certain classes that can be re-used, but the Presenters and Interactors
tend to be a little more specific, depending on the UI classes being used
for the View components.
| * Is MVC and MVP tied to a specific OPF framework, or is it easy to swap
| out OPF frameworks? With MGM this should be pretty easy.
No, but you may need to provide some means of metadata to examine the
business classes. This is where .NET really comes into its own.
Have you read the articles on my website, www.carterconsulting.org.uk ?
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Fri Dec 22, 2006 4:40 am Post subject: Re: What to learn first? MVC or MVP |
|
|
"Oleg Zhukov" <ovzh__at__yandex__dot__ru> a écrit dans le message de news:
458a6b7c$1 (AT) newsgroups (DOT) borland.com...
| In contrast to MGM in both MVC and MVP the view observes the model,
| so you will need to move UI update logic to your forms.
This is not true, there is no need for any logic on the forms, that is what
the Interactors are for.
| Interfaces in MV(C/P) serve as a means of implementing Observer pattern.
| MV(C/P) DOES require Observer pattern, but its implementations may
| vary: Observer may also be implemented with events or with Observer
| abstract class (as in http://www.atug.com/andypatterns/mgm.htm)
....or by delegation.
| MGM is similar to Passive View pattern:
| http://www.martinfowler.com/eaaDev/PassiveScreen.html
| A detailed overview of MV(C/P) and others:
| http://www.martinfowler.com/eaaDev/uiArchs.html
Martin Fowler's MVP is no more than a different version of MVC with the
Presenter being a Mediator; it is nowhere near the sophistication of the MVP
pattern I designed, based on the Taligent documentation.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer |
|
| Back to top |
|
 |
Graeme Geldenhuys Guest
|
Posted: Fri Dec 22, 2006 9:13 am Post subject: Re: What to learn first? MVC or MVP |
|
|
Thanks to both Oleg and Joanna for taking the time to reply...
Joanna Carter [TeamB] wrote:
| Quote: | | In contrast to MGM in both MVC and MVP the view observes the model,
| so you will need to move UI update logic to your forms.
This is not true, there is no need for any logic on the forms, that is what
the Interactors are for.
|
From the little that I read, this is how I understood it as well.
| Quote: | | Interfaces in MV(C/P) serve as a means of implementing Observer pattern.
| MV(C/P) DOES require Observer pattern, but its implementations may
| vary: Observer may also be implemented with events or with Observer
| abstract class (as in http://www.atug.com/andypatterns/mgm.htm)
...or by delegation.
|
The base Object and List Object in tiOPF already implements the Observer
pattern (plus a few other handy patterns). Hence the reason my Mediators
descend from the base Object of tiOPF.
Saying that, I really like the idea of delegation. I saw that used in
Joanna's articles.
I agree with both your comments, that MGM is similar to the Passive View
pattern, where in the case of comparing MGM to MVP, the Presenter being
a Mediator. Now this is why I want to study MVC and MVP, so I can
compare them against MGM.
it is nowhere near the sophistication of the MVP
| Quote: | pattern I designed, based on the Taligent documentation.
|
This would explain why MGM was so quick and easy to understand and
implement. MVP seems to be a complex beast. :-)
--
Graeme Geldenhuys
There is no place like S34° 03.168' E018° 49.342' |
|
| Back to top |
|
 |
Graeme Geldenhuys Guest
|
Posted: Fri Dec 22, 2006 9:13 am Post subject: Re: What to learn first? MVC or MVP |
|
|
Joanna Carter [TeamB] wrote:
| Quote: | | * Is there a need to study both MVC and MVP?
Not a need, but possibly an interest
|
I should have phrased it better. That is exactly what I meant. :)
| Quote: | | * Why is there free/open source implementations of MVC and MGM for
| Delphi, but not of MVP? Is MVP that hard that nobody wants to give
| there work away, or make it a community project.
My clients, who have funded their versions of the MVP framework would not be
very happy if I jusqt gave away what has already cost them. The only way I
can help is to describe the constituent parts and their roles but I cannot
simply publish the total code. The other consideration is that I have found
|
Ok, that explains a bit. But surely you are not the only person in this
NG that has implemented a MVP in Delphi? Or are you?
Maybe Windows developers just haven't learned the concept behind
opensource software and it's advantages - but that's another issue. ;-)
| Quote: | MVP to be more of a design pattern than a ready coded framework;
|
A rather *large* design pattern...
Yes over a year ago, and was completely lost. Hence the reason I
implemented the MGM instead. It still bugs me that I didn't understand
the MVP fully, which is why I am attempting it again. I'll reread your
articles and start again.
Luckily my clients are understanding when it comes to OpenSource
software. They scored a lot from it (money wise and time), and like to
give some back. A year ago they funded my efforts to port the tiOPF
project to Free Pascal and a few months ago they funded the
implementation of Visual Form Inheritance in Lazarus. As long as they
can benefit from what is done, they seem to be okay with it. I'm sure
not all clients are that understanding. :-)
--
Graeme Geldenhuys
There is no place like S34° 03.168' E018° 49.342' |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Fri Dec 22, 2006 7:28 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
"Graeme Geldenhuys" <graemeg (AT) spamfilter (DOT) co.za> a écrit dans le message de
news: 458b765a (AT) newsgroups (DOT) borland.com...
| This would explain why MGM was so quick and easy to understand and
| implement. MVP seems to be a complex beast. :-)
Not really that complicated There are only 7 base classes :
Presenter
.Model
.CommandSet[Command]
.Selection
.View
.Interactor
But don't forget that a good MVP framework doesn't just work at an
object/form level, it should also be a Composite pattern where an Object
Presenter contains Property Presenters, hooked up to each edit on a form.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Fri Dec 22, 2006 7:40 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
"Graeme Geldenhuys" <graemeg (AT) spamfilter (DOT) co.za> a écrit dans le message de
news: 458b7b2a (AT) newsgroups (DOT) borland.com...
| Ok, that explains a bit. But surely you are not the only person in this
| NG that has implemented a MVP in Delphi? Or are you? :)
Possibly. And also now in C# :-)
| Maybe Windows developers just haven't learned the concept behind
| opensource software and it's advantages - but that's another issue. ;-)
Maybe most developers really can't afford to live on giving a lot of time
for free. After all, although it is noce to be part of some cozy, self-help
community, I can't send a piece of opens source code to the mortgage or
utility company, neither can I put it in the tank of my car :-)
| Luckily my clients are understanding when it comes to OpenSource
| software. They scored a lot from it (money wise and time), and like to
| give some back. A year ago they funded my efforts to port the tiOPF
| project to Free Pascal and a few months ago they funded the
| implementation of Visual Form Inheritance in Lazarus. As long as they
| can benefit from what is done, they seem to be okay with it. I'm sure
| not all clients are that understanding. :-)
I am currently working to create a written work that can describe the
framework without infringing too much on my clients' goodwill. Although the
Delphi framework has now been completely abandoned in favour of C#, due to
the extra features that reflection, generics and the .NET ComponentModel
namespace gives us.
..NET really has reduced, *severely* the amount of framework code that we had
to write compared with Delphi for Win32.
Nonetheless, I can still come to a company and teach you how to code the
essentials of the framework, I just cannot give away the code that I have
written for previous clients. It would only take 7-10 days, if you really
wanted to do that ?
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer |
|
| Back to top |
|
 |
Andreas Dorn Guest
|
Posted: Fri Dec 22, 2006 10:20 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
Graeme Geldenhuys wrote:
| Quote: | * tiOPF and MGM doesn't use Interfaces. My knowledge of Interfaces are
limited. Is Interfaces required for MVC or MVP?
|
Technically not, but I wouldn't go anywhere without them. To me not
using interfaces often looks as cumbersome as not using classes.
Sadly in win32-Delphi there's
- lots of ref-counting related nonsense
- no multiple interface inheritance
| Quote: | * Why is there free/open source implementations of MVC and MGM for
Delphi, but not of MVP? Is MVP that hard that nobody wants to give
there work away, or make it a community project.
|
So far I don't think there's a common agreement how MVP exactly should
look like, so I'd expect too much disagreement for a community
project...
Some points to disagree on:
Models:
Somebody here once wrote about using a singleton for 'the model'.
My Views usually don't observe 'the model', they observe 'a model'
and my models usually come in tree-structures.
Coupling of M-V-P:
How much do M,V and P know of each other (the exact class, a base
class, some interface, a base interface...)
Should typecasting be necessary/avoided.
Update logic:
You can put the update-logic into the view or into the presenter...
....
--
Andreas Dorn |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Sat Dec 23, 2006 3:37 am Post subject: Re: What to learn first? MVC or MVP |
|
|
"Andreas Dorn" <adornno1 (AT) web (DOT) de> a écrit dans le message de news:
458c05a9$1 (AT) newsgroups (DOT) borland.com...
| So far I don't think there's a common agreement how MVP exactly should
| look like, so I'd expect too much disagreement for a community
| project...
If you want it "straight from the horse's mouth" then go to
http://pcroot.cern.ch/TaligentDocs/TaligentOnline/DocumentRoot/1.0/Home/
This is the original and, in my opinion, the most comprehensive
documentation around; it was also my starting point. There is also a
"summary" document that used to be on IBM's website, but that appears to be
no longer available. However, if you really want a copy, I would e-mail you
mine :-)
| Some points to disagree on:
If you insist :-)
| Models:
| Somebody here once wrote about using a singleton for 'the model'.
| My Views usually don't observe 'the model', they observe 'a model'
| and my models usually come in tree-structures.
A full implementation of MVP also means that individual properties on an
object become the Value in an MVP component that is nested inside an
object-centric MVP component.
| Coupling of M-V-P:
| How much do M,V and P know of each other (the exact class, a base
| class, some interface, a base interface...)
| Should typecasting be necessary/avoided.
A Model know nothing of View or Presenter, it holds a Value, a Selection and
a Command Set.
A View knows nothing of the Model or the Presenter, it surfaces events that
can be handled by the Interactors held in the Presenter.
A Presenter holds a Model, a View and one or more Interactors. It can know
about the Model, View and Interactors, but it usually doesn't need to .
Interactors are custom written to handle a particular UI hierarchy with
sub-classes that handle particular value types, unless you use generics.
| Update logic:
| You can put the update-logic into the view or into the presenter...
Neither, this is the job of the Interactors.
Don't you just love a good discussion ? )
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer |
|
| Back to top |
|
 |
Andreas Dorn Guest
|
Posted: Sat Dec 23, 2006 7:18 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
Joanna Carter [TeamB] wrote:
| Quote: | "Andreas Dorn" <adornno1 (AT) web (DOT) de> a écrit dans le message de news:
458c05a9$1 (AT) newsgroups (DOT) borland.com...
| So far I don't think there's a common agreement how MVP exactly should
| look like, so I'd expect too much disagreement for a community
| project...
If you want it "straight from the horse's mouth" then go to
http://pcroot.cern.ch/TaligentDocs/TaligentOnline/DocumentRoot/1.0/Home/
This is the original and, in my opinion, the most comprehensive
documentation around; it was also my starting point. There is also a
"summary" document that used to be on IBM's website, but that appears to be
no longer available. However, if you really want a copy, I would e-mail you
mine
|
I've taken a look at the Taligent documents some time ago and I also
found them very useful (if you have the summary at hand I'd be
interested), but to me they didn't look static final (are they?).
One point that remained unclear to me was how to nest data properly.
It seemed to me that e.g. a change in one of the DocumentComponents
there doesn't cause synchronization issues in the DocumentTree.
This would be an assumption that's definitely too simple for my data.
Also the notion of 'Selection' makes sense for the examples in the
TaligentDocs, but to me it looked a bit like poor mans nesting
(caused by not having CommandSets available for the Sub-Data).
| Quote: | | Some points to disagree on:
If you insist :-)
I knew you couldn't resist  |
| Quote: | | Models:
| Somebody here once wrote about using a singleton for 'the model'.
| My Views usually don't observe 'the model', they observe 'a model'
| and my models usually come in tree-structures.
A full implementation of MVP also means that individual properties on an
object become the Value in an MVP component that is nested inside an
object-centric MVP component.
|
By components do you mean real Delphi components? Cutting down
component-nesting was one of the main issues for me to look into MVP.
| Quote: | | Coupling of M-V-P:
| How much do M,V and P know of each other (the exact class, a base
| class, some interface, a base interface...)
| Should typecasting be necessary/avoided.
A Model know nothing of View or Presenter, it holds a Value, a Selection and
a Command Set.
|
Ok, except that at the moment instead of a Selection I like fully grown
up SubModels that come with their own CommandSet and can be connected to
Views without having to nest any View-components.
It carries the penalty of synchronization issues, but I'm not sure
what is best. Time will tell if I'm going to refactor again...
| Quote: | A View knows nothing of the Model or the Presenter, it surfaces events that
can be handled by the Interactors held in the Presenter.
|
Ok. So far most of my Interactions are too special to be reused, so I
usually put them directly into a Presenter.
| Quote: | A Presenter holds a Model, a View and one or more Interactors. It can know
about the Model, View and Interactors, but it usually doesn't need to .
|
One issue I had was if the model contains a lot of data (too much to be
shoveled around) and a view needed it in an OnDraw-routine, I once gave
the view direct access to the model. But I think nowadays I would try to
avoid that.
| Quote: | Interactors are custom written to handle a particular UI hierarchy with
sub-classes that handle particular value types, unless you use generics.
| Update logic:
| You can put the update-logic into the view or into the presenter...
Neither, this is the job of the Interactors.
|
Thanks. I'm going to look how Interactors can do me any good...
| Quote: | Don't you just love a good discussion ? )
|
I asked for it... :-)
--
Andreas |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Sat Dec 23, 2006 9:15 pm Post subject: Re: What to learn first? MVC or MVP |
|
|
"Andreas Dorn" <adornno1 (AT) web (DOT) de> a écrit dans le message de news:
458d2ca6$1 (AT) newsgroups (DOT) borland.com...
| I've taken a look at the Taligent documents some time ago and I also
| found them very useful (if you have the summary at hand I'd be
| interested), but to me they didn't look static final (are they?).
I believe that they are incomplete, but I don't know if they are (were)
finished. There is certainly more framework there than we as Windows
developers would ever need.
| One point that remained unclear to me was how to nest data properly.
| It seemed to me that e.g. a change in one of the DocumentComponents
| there doesn't cause synchronization issues in the DocumentTree.
| This would be an assumption that's definitely too simple for my data.
Any data changes in nested properties/objects in the Model's Value should be
propogated within the object. It is then the job of the Views attached to
each nested property/object to update according to those changes.
| Also the notion of 'Selection' makes sense for the examples in the
| TaligentDocs, but to me it looked a bit like poor mans nesting
| (caused by not having CommandSets available for the Sub-Data).
Selection doesn't always take the form suggested in the Taligent example. It
is nothing to do with nesting, it is simply a subset of, or the whole,
Model; upon which the Command Set can act.
| By components do you mean real Delphi components? Cutting down
| component-nesting was one of the main issues for me to look into MVP.
No, an MVP component is the complete
Model/Selection/CommandSet/View/Presenter/Interactor "bundle". It is the job
of the object presenter to create one MVP component for each of the
properties of that object so that interaction between an edit control and a
property can be managed.
| Ok, except that at the moment instead of a Selection I like fully grown
| up SubModels that come with their own CommandSet and can be connected to
| Views without having to nest any View-components.
|
| It carries the penalty of synchronization issues, but I'm not sure
| what is best. Time will tell if I'm going to refactor again...
From experience, I think you will have to :-)
| Ok. So far most of my Interactions are too special to be reused, so I
| usually put them directly into a Presenter.
Interactors allow you to separate out UI response according to which UI
widget set you are using. If you have never had to switch widget sets, you
will not yet realise how useful that separation is.
| > A Presenter holds a Model, a View and one or more Interactors. It can
know
| > about the Model, View and Interactors, but it usually doesn't need to .
|
| One issue I had was if the model contains a lot of data (too much to be
| shoveled around) and a view needed it in an OnDraw-routine, I once gave
| the view direct access to the model. But I think nowadays I would try to
| avoid that.
This is where the Interactor comes in; it knows both the Model and the View
intimately and is able to respond to the View's requests for the data to be
painted.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer |
|
| Back to top |
|
 |
Powered by phpBB © 2001, 2006 phpBB Group .
|