Applications developed for the S60 platform can use a number of different architecture solutions to meet their requirements. One example of a common approach includes the Model - View - Controller (MVC) pattern used in GUI-based applications. In this approach, the application is split into three separate logical parts. Each part contains a different aspect of the entire application, and has a specific role.
Figure: Logical dependencies in the MVC pattern
In this approach, the model:
contains and manipulates the data in the application
is owned by the controller
is typically implemented in its own class or classes
the view :
displays the application state known by the model
receives user input
notifies the controller of relevant events
is implemented either with a CCoeControl
derived
class or a CAknView
derived
class
For more information on these options, see Traditional Symbian OS UI application architecture and S60 view architecture.
the controller :
handles application-wide events
commands the model, typically based on user input
selects the view to be displayed
is implemented either with a CAknAppUi
-derived
class or a CAknViewAppUi
derived class.
For more information on these options, see Traditional Symbian OS UI application architecture and S60 view architecture.
requires the implementation of CAknApplication
and CAknDocument
derived
classes.
The pattern is implemented with the following classes.
Figure: Relationship between the classes that make up a typical S60 application
The CAknApplication
-derived class:
provides the application object expected by the application framework when the application is launched
defines the application properties
creates the CAknDocument
derived
class if it does not exist yet
if an instance of the application is already running, switches to that instance and exits
The CAknDocument
-derived class:
creates the controller class
is the base class for application documents