Developing GUI Applications: Architectural Patterns Revisited
European Conference on Pattern Languages of Programs
Developing large and complex GUI applications is a rather difficult task. Developers have to address various common software engineering problems and GUI-specific issues. To help the developers, a number of patterns have been proposed by the software community. At the architecture and higher design level, the Model-View-Controller (with its variants) and the Presentation-Abstraction-Control are two well-known patterns, which specify the structure of a GUI application. However, when applying
... e patterns in practice, problems arise, which are mostly addressed to an insufficient extent in the existing literature (if at all). So, the developers have to find their own solutions. In this paper, we revisit the Model-View-Controller, Hierarchical Model-View-Controller, and Presentation-Abstraction-Control patterns. We first set up a general context in which these patterns are applied. We then identify four typical problems that usually arise when developing GUI applications and discuss how they can be addressed by each of the patterns, based on our own experience and investigation of the available literature. We hope that this paper will help GUI developers to address the identified issues, when applying these patterns. In this paper we revisit three well-known patterns for GUI applications -MVC, HMVC (Hierarchical MVC) and PAC -by identifying four typical problems in the development of GUI applications and discussing how they are, or could be, addressed by these patterns. The paper is organized as follows. In the Background section we give a brief description of the MVC, HMVC, and PAC patterns, as well as present the four problems, which are then discussed one by one in the subsequent sections. The discussion is illustrated with numerous examples. Some implementation specifics for Java programming language and Java Swing toolkit are provided as well. We conclude our paper with a brief summary. Throughout the paper, we assume that the object-oriented approach is used. How to map classes onto implementation-level constructs (such as GUI toolkit widgets or Java classes)? How to initialize the resulting object network at runtime, instantiating particular objects and establishing relationships among them, i.e., initializing object references (known also as the visibility problem [Marinilli06])? Apparently, we do not have to start from scratch when tackling these issues, since these seem to be in the realm of the patterns for GUI applications, such as Model-View-Controller or Presentation-Abstraction-Control (and their variations). Here, we briefly review the patterns that are discussed in this paper. A detailed description could be found, e.g., in [POSA I] (see also the References section).