When conducting interviews with newcomers in Digicode, I am noticing that many of them struggle to understand patterns topic. Using design patterns and building complex construction of products, are some of the things that a programmer will eventually encounter in their career. In this article, in just a few words, I will state what the patterns are and the role that they play for a developer and their team.
Design patterns are general repeatable solutions to a commonly occurring problem. For example, let’s say a developer is encountering the same problems, on several different projects, but keeps coming up with the same solution again and again. In response, the experienced developer will standardize the code. So going forward this would be the code used for all projects that encounters this problem. This is an example of a design pattern.
In my experience not many programmers are thinking they are writing a design pattern, when they are actually writing patterns. This does not mean that they need to come up with new solutions. There are plenty of design patterns that are available for any problem. Understanding common patterns allows developers to speak the same language. When the name of the template is known, it is much easier to tell a fellow programmer how to solve the problem in his code.
There are so many different templates available to a programmer to use, it really just depends on the tasks at hand. For instance, if there is a task that ensures the existence of one object, without the possibility of creating a new object, then the Singleton Pattern would be used. If you needed to examine an object and did not want to create a real object directly, you would use the Proxy Pattern. This will allow you to use a more functional object, without creating real objects. If relatable objects need to be created without specifying the classes, then the Abstract Factory Pattern would be most useful. The Mediator Pattern would be used if the programmer is looking for the interaction of several different objects that are independent of each other. The Decorator Pattern is a design pattern that will allow the programmer to either add functions or replace the functions of an object.
In addition to design patterns, there are also concepts of architectural patterns. There is no exact definition of architecture, but it is a combination of both science and art. The term architecture in software engineering refers to a set of decisions by structural elements in relation among themselves and the behavior of the individual elements of the entire system. They are similar to design patterns except the cover a wider scope. It is the blueprint for the system.
Like design patterns, there are a large number of ready-to-use architectures available for developers to use. Although results of these decisions are rather cumbersome, when working with a large team it is important to have a convenient, thoughtful, and easily supported architecture application. If everyone does what is expected and follows the structures that the architecture provides, it will make for a much easier job for everyone. When the right architecture is used it will also allow newcomers to come onboard quickly and efficiently, since there is less likely to be errors.
Some of the more popular ready to use architecture solutions are:
- MVC (Model View-Controller) – This concept is best used to separate business logic from visualization. The separation will increase the likelihood of using the code again. This would be most useful when the user needs to see data at the same time in different points of view and/ or concepts.
- MVP (Model-View-Presenter) – stems from MVC and used mainly to construct user interface.
- MVVM (Model-View-View-Model) – More popular and more convenient than the MVC, especially with the connection between UI of the application and the model.
- Pure MVC – is a template that is used in our Digicode projects. This architecture is popular among flash developers. It’s unlike the normal MVC with an additional layer at each level: Model-Proxy, View-Mediator, and Controller-Command.
The key to increasing productivity and saving time with developers is using templates. If these templates are created with the right patterns they will be successful. I have taken a look at popular templates and architectures that I use personally use on a daily basis.
If you are interested in learning more about this topic please leave a comment and I will be happy to share even more valuable information in relation to this article. You can also write to us in the Digicode LinkedIn profile in the article as well.