- Create a project structure with 4 folders
- Create Entities in Model to represent data.
- Create DataAccessLayer for interacting with database.
- Create BusinessAccessLayer.
- Identify the Display, Focus and Binding functionalities to be done in the UI,
- Create interfaces (View Interface) and put those methods inside it.
- Create Presenter class with a private global variable of type ViewInterface.
- Create a constructor for Presenter class accepting a parameter of type of ViewInterface and inside constructor, assign parameter value to global parameter created in the step 7.
- Identify actions to be performed in the UI like [Binding the Grid], [Save the record if validation passes].
- Put all those methods inside Presenter (As these methods are action methods, all will be with return type void.)
- Create View and implement View interface and override all the methods.
- Create a global private Presenter object inside a View.
- Create default constructor for view and inside it initialize presenter object created in step 12, passing current Page instance as parameter.
- Handle events in the view and pass control to Presenter
In 3-Tier application in UI, we handle the events and call the actions (methods in short) defined in the page itself and In MVP in UI, we handle the events and call the actions defined in the presenter.
Hope you enjoyed,
Refer following links to learn more about MVP and 3-Tier architecture.
Hope to see some good comments.