During the past few years, the process of designing an application has gone through another revolution of terms. When I started out in computing, data was in records and you wrote programs that have subroutines to perform repetitive tasks. Then there was the short-lived foray into 4GL’s, More recently with the introduction of OO-based languages, we had to learn about data in structures, instance objects, methods, enumerations and a whole host of new terms. At the same time, we got into client/server and N-tier application design. Mostly, these were just variations on what we were already familiar with, although making the most out of the new terminology can require a new way of thinking. In the past few years, the way you design applications has sort of been through another evolution. I say “sort of” because what’s happened is that some new terms have entered common usage. One of which is design patterns. Design patterns are just what they say, a pattern that you use when designing an application. They define/redefine some of the practices that we have been following for years. Two design patterns I want to highlight are MVC and MVVM.
MVC is Model-View-Control. This is where the Model (business logic & data) is separated from the View (what you see) and the Controller (dispatch logic). The Controller monitors both the Model and View components, and acts as the communicator between these two components. When you are using a well- designed UI Toolkit application, you’re probably using a MVC design. If you have your real business logic abstracted away from the UI Logic (which UI Toolkit doesn’t really help you implement), you have the Controller logic separated from your View, which is part of the MVC pattern. At a very simplistic level, the Synergy UI Toolkit List processor is the controller part of a MVC pattern, the load method is the Model and the list window is the View. The UI Toolkit code is partially agnostic to the actual data being processed – you just pass it the data as a parameter and the forms processing inside UI Toolkit takes care of the rendering of the data on screen. In a recent project, I created wrappers for the Synergy UI Toolkit logic in order to implement a formal MVC design, such that almost all of the logic required to drive the UI was abstracted into standard routines. So as far as the application developer was concerned, all they had to provide were the window scripts that defined the View, and the various business logic routines that were registered with the Controller.
MVVM is Model-View-ViewModel. This is a variation of the MVC, where the controller is replaced by the ViewModel. The ViewModel component instantiates instances of the Model component and it exposes public properties that the View component consumes. In a MVVM design, the Model is oblivious to the ViewModel and the View, and the ViewModel is oblivious to the View. MVVM seems to be the design pattern of choice for WPF applications, and was used by Microsoft when they developed Expression Blend. Because the View is separate to the ViewModel and Model components, it’s really easy to apply a new skin to an application that is implemented with this design. Synergy applications have been moving in this direction since the release of xfNetLink/xfServerPlus, so it’s a natural evolution to consider this design practice when updating the UI of an application.
In addition to the two I mentioned there are other variations in application design patterns (e.g. MVP). In the course of reading up on the various application design models, I came across a reference to a blog by Josh Smith on The Code Project, where he states “If you put ten software architects into a room and have them discuss what the Model-View-Controller pattern is, you will end up with twelve different opinions.” In a lot of cases, you’ll have an in-house design pattern that you’ve been using for years, but as you continue to develop your Synergy application, you should consider reassessing all the available design patterns to determine which pattern is the most appropriate for future-proofing your application.