When programming, one gets to deal with all sorts of information representations. You have to make sure that information is accessible, accurate, and easy to interact with. It is important to provide proper channels of handling information representation, be it array or collection, or a single variable. In order to properly do that we often … Continue reading Iterator Pattern
Tag: decoupling
Facade Pattern
Applications reach different levels of complexity within the development time span. Some settle down with just several classes. Others make to dozens of classes and complex interrelations between them. When that happens you want to make sure that you have proper mechanisms of controlling it, and that those mechanisms are simple enough for client to … Continue reading Facade Pattern
Adapter Pattern
Have you ever experienced inconvenience of having a different type of socket for your electric plugs, like when you travel to a different country? If you don’t have an adapter, you will not be able to use that socket and power up your devices. It’s good that adapters are generally well available to purchase in … Continue reading Adapter Pattern
Command Pattern
Imagine that we need to develop an application for a hotel. What we need to make is a device with that has multiple buttons on it that correspond to certain actions: calling room service, requesting laundry service, getting latest menu from the restaurant, refilling refrigerator and so on. We want to be able to fit … Continue reading Command Pattern
Abstract Factory Pattern
There is a way to generate objects without being tied to concreteness of a certain object. That is called a Factory Pattern or a Factory Method. However, often what happens is that we need to create not one type of an object but several similar ones. Imagine running a restaurant, and needing to have several … Continue reading Abstract Factory Pattern
Factory Pattern
Every time we code something, we create new instances. We literally use word “new” all the time. That creates a concrete object for us. It is bound to a particular type, and we can’t change it after we created it. Every time you use “new” - you create “concrete” instance. This is opposite to what … Continue reading Factory Pattern
Decorator Pattern
We know that if we want to extend functionality of a particular class, we literally “extend” that class and create a subclass. It is one of the ways to do that. However, it is not the most flexible approach. Moreover, you might encounter often the case where subclassing will turn into a nightmare. Imaging you … Continue reading Decorator Pattern
Observer Pattern
There is often a need to develop systems that listen on some kind of event. If you have ever encountered even a bit of Javascript, you saw those onChange, onClick, onKeyUp, and so on. We have a concept of a subject that contains a certain state. Once that state changes, all of the listeners get … Continue reading Observer Pattern
Orthogonality
When developer works through a particular systems, a variety of modules being developed: user interface, filters, generators, controllers, models, and so on. In this variety and plurality often lies a danger of connecting and making separate modules dependent on each other. There is a healthy degree of dependence where a module can request an object … Continue reading Orthogonality
