Software design patterns are not a new concept. Christopher Alexander is credited with originating the idea of design patterns in his book A Pattern Language: Towns, Buildings, Construction. The book itself is on architecture and discusses the various design patterns found in traditional architecture. It became apparent that the idea of pattern language could apply to many complex engineering tasks, and has been applied to some. Recent examples include include and, computer science, and interaction designs.
Software engineering and design in particular has been influenced by the idea of design patterns. Kent Beck and Ward Cunningham, two of the fathers of extreme programming, applied design patterns to programming in 1987. Design patterns in software engineering gained more popularity and exposure after the book by the Gang of Four, Design Patterns: Elements of Reusable Object-Oriented Software was published. In the book, the authors discuss the trials and tribulations of object oriented programming, as well as the capabilities. They go on to discuss 23 classic design patterns in software engineering. The book was revolutionary and sold several hundred thousand copies and is a staple for software engineers everywhere.
What is a design pattern anyway? It is a reusable solution to a commonly occurring problem in software design. It is not an out of the box, finished design that can be transformed directly into code. Instead it’s a template for how to solve a problem that can be used in a variety of circumstances and situations. When applied to object-oriented programming, they show the relationships between objects and classes. Again, these ideas and concepts were brought about by examining patterns in traditional architecture, but anyone who has spent any amount of time programming can see how it can be applied to software design.
Design patterns can speed up the development process by providing proven development paradigms. This is accomplished by reusing patterns to prevent minor issues that can cause major problems. It also improves code clarity and readability for programmers and architects who are familiar with the patterns.
There are several different design patterns identified in software engineering. Model-View-Controller (MVC) is perhaps the most well known. It’s actually been argued that MVC predates the concept of design patterns. In addition, there is Model-View-Presenter (MVP) and Model-View-ViewModel (MVVM). I’m going to take a closer look at the MVVM design pattern and where it began. First let’s take a look at a diagram depicting MVVM:
![]()
The MVVM pattern originated from Microsoft as a specialization of the Presentation Model design pattern. For the most part, it’s based upon the MVC pattern, MVVM is most often used by Silverlight, .Net, WPF, and C# developers. It was designed to make use of specific functions in WPF to better facilitate the separation of View layer development from the rest of the pattern by removing almost all of the code behind from the View layer. Instead of requiring Interactive Designers to write View code, they can use the native WPF markup language XAML. The separation of roles allows Interactive Designers to focus on user experience needs rather than programming or business logic.
Let’s take a look at the elements of the pattern. The Model refers to one of two things, depending upon the approach – either an object model that represents the real state content (an object-oriented approach), or the data access layer that represents that content (a data-centric approach). The View refers to all elements displayed by the UI such as buttons, windows, graphics, and other controls. Finally, the ViewModel is a data abstraction of your view. This is where your View (aka UserControl) get’s its data. So if you view needs to get data, the ViewModel is where it gets it from. Also if values need to be converted or formatted, this is where it happens.