MVP and nabiro FAQ
- How to open popup from presenter?
One simple solution is to use the SmartPoupManager? or the PopupManager? and cast the view inside the presenter to the Sprite class.
- How to initialize view with default values?
The default values for the view should be initialized from the constructor of the presenter. If the view is not fully instantiated use invalidation technique to populate the controls.
- How to set the data to view from another compoent (not using services, just using public properties of the view)?
If the component is a child of the component trough the interface implemented by the view, otherwise trough instructions.
- What is the difference between view and the component? Is there any?
View establishes an MVP triad (complex or simple). The component is a child of the view. The component can be written by implementing simple MVP or doing more general purpose component with a single file. Please do a careful consideration on how to implement UI element of an application. It is very important to identify the nature of the UI element (view, project specific component, general purpose component / candidate for Nabiro library) before the implementation starts.
- When to use presenter and interface for a component and when this this not a good practice?
Any time that a component contain business logic is a good reason to put it in a separate file (i.e. use MVP), if a component doesn't have inside business logic (i.e. an item renderer) or if it's a custom component like one for image rendering, a list, etc. you can avoid to use MVP.
- Where to keep session data for the view?
Always in the presenter, you can use the protected property _dataSet and create two accessor methods to cast the data to the right type and use them in the view.
- How to share data between views (how to notify other view that the data has changed)?
Generally speaking trough a repository, in nabiro trough the SharedData? class.
- Where to put business logic of the view?
Always in the presenter or just in case the presenter is not needed in a class for code behind.
- When to use the command?
When it executes a piece of code that can live stand alone, doesn't have dependencies and when it's not only a matter to notify a component or send data to it.
- How large can presenter be to be readable?
It depends, but when a presenter start to be more than 400 rows may be that you have made a bad analysis and that the component has to be divided in more components
- What are the instructions and when to use them?
Instruction are custom events compatible with our event bus, through a simple dispatch you are in touch with all the component of an application (cheke here for more details).
- How to make a server side call?
Using the ServiceConnector class as explained here.
- How to handle an view event?
Using public methods of a presenter and avoiding event injection in the presenter if it's not really needed.
- Why there must be a interface for the view?
In order to clearly separate logic and view and because if your logic is built over an interface (i.e. calling methods and properties of the interface) also if you change the view or the framework you use for components changes you have only to make some changes in the view and not also in the presenter.
Download in other formats:
1.1.2-pro © 2008-2009
agile42 all
rights reserved
(this page was served in: 0.15000 sec.)