PC2 MVC Details - pc2ccs/pc2v9 GitHub Wiki

Each PC² code module (server, team, judge, scoreboard, etc.) is organized using the Model/View/Controller (MVC) architecture. Each module contains a model, which holds the data associated with the contest. The various types of model data are defined as classes in package core.model. Each module’s model is an instance of class core.model.InternalContest; the model is typically represented in the code by convention as a variable named contest (although this is not 100% consistent and there is no rule which enforces it).

Class InternalContest implements an interface named IInternalContest which defines the methods used to manipulate the model (contest) data. In other words, each PC² module contains its own “internal contest representation” (model) together with a set of predefined methods for manipulating that contest model’s data.

Each module also contains a controller which manages the manipulation of the contest model. Each controller is an instance of class core.InternalController. The InternalController class implements an interface named IInternalController, which defines the methods available for controlling (manipulating) the model as well as for performing other “control” functions. (For example, IInternalController defines methods such as submitRun() for inserting a run into the model; setContestTime() for updating the contest time stored in the model; login() for logging a client into the server, and so forth.)

Finally, each module also has associated with it one or more views. A view is (typically) a graphical user interface (GUI) which displays widgets on the screen to allow users to invoke various functions in the controller and hence manipulate the model or perform other actions. Views are classes defined in package edu.csus.ecs.pc2.ui and also within subpackages inside the ui package. For example, when an Application Team client module starts it displays the GUI defined by class ui.team.TeamView.