PAC Software Architecture

MVC is the hot name in software architecture when it comes to GUIs. It is fantastic when it comes to simple GUI interfaces and for many developers it's the trusted architecture they turn to whenever they have a new project. But, if you want to get into a more complex interfaces the best architecture to use is often not MVC. If you want to tighten a bolt the right tool is a wrench and not a hammer. There is no right tool for every job. The same goes for GUI software architectures. MVC is not the right tool for every job. Another software architecture that deals with more complex interfaces is the Presentation-Abstraction-Control architecture.

The Basics

The PAC architecture is more common than most developers think and often gets mislabeled as MVC. PAC is further development of MVC to deal with more complex interfaces. The two main differences are that the presentation and abstraction (think view and model in MVC) don't directly talk to each other and that PAC uses a layered approach with PAC units. For some pretty pictures and a simple explanation check out this article which explains the concept better than I can.

PAC-diagram.png

This diagram shows how the layers talk to each other in parent child relationships and how the different components of a PAC unit talk to each other. In the diagram there are only two children but you can have many more than that. And, the layers of parent child relationships can be very deep.

An Example

gimp-pac.png
Let's look at GIMP for our example. In this image we have 4 boxes that represent different information. The one on the left is the tools to use on the image, in the middle we have the image, and on the right we have different layers to the image on top and the alpha channels on the bottom.

All of these are different PAC units in parent-child relationships. If I select a new layer in the layer window that unit updates it's presentation and abstraction. It, also, communicates to the image to update it's abstraction (it's on a new layer now) and it's presentation (it highlights the border around this layer). This parent tells it's other child units about changes so the alpha channels unit would update to show the alpha channels of the selected layer.

This is a more complex interface than MVC can easily handle. PAC was designed for this and can handle it in a more robust way allowing for easier expansion of the interface.

As is almost always the case, this type of architecture looks one way in theory and slightly different in practice depending on the application. So, stick this software architecture in your back pocket for your next development. It may be the right architecture for your project and it's always good to have one more tool in your chest of goodies.