In my last blog entry OOP in LS: MVC in Lotus Notes I promised to write about the separation of front end and back end and the use of controller classes.
The primary concern is to implement all requirements from the problem domain in one place.
If from the problem domain some items has to be mandatory the definition of this is done within the model class. In case of a change of requirements (which we all know happens) there is only one place where the code must be changed. Which leads directly to higher maintainability.
This advantage will become quit clear if the application will be used both from the Notes client and the web browser. Although you could use one form for both you normally use two forms for better results. Instead of trying to keep the input validation on both forms in sync the forms access the model class via their controller classes.
Without a doubt the requirements from the problem domain has also to be fulfilled if the document is changed from a scheduled Agent. In that case the agent uses the model class directly. There is no need for a controller class because there are no events to react on.
If we want to use the model class from every context no Notes UI classes as NotesUIWorkspace or NotesUIDocument must be used. Otherwise a scheduled agent or a WebQuerySave agent won't run. But the ban of Notes UI classes is not a problem because the controller classes take over all tasks where these classes would be handy to use.
In my next blog entry base classes for model and controller are introduced which could be derived for concrete use.