Monday, December 16, 2013

What Exactly Are Patterns?

I found very interesting paper: Developing GUI Applications: Architectural patterns Revisited by Alexandros Karagkasidis

Implementing presentation layer is a really tricky. It is at least so complex as implementing a domain layer and not at all less important. There are lots of approaches to the subject, from the most comprehensive MVC, MVP, PAC and HMVC to the most detailed being described by Martin Fowler or vendor-specific approaches i.e. MVVM (which might be described in a Flowler's language as well).

According to Alexandros all these share same problem: work well for simple cases. My own understanding is the core is how a GUI functionality should be exactly mapped to structural elements of a pattern.


Let's take MVC pattern. One may use this pattern on widget, container or window/frame level. Decision is left to a developer. Besides, from my experience an approach is highly coupled with a functionality flow and refactoring is really hard. Let's say you decided to implement MVC on container level and then a CR requires some small interaction between a frame caption, button, and tab color. You may hardcode it or extract a smaller MVC triad. With this, a refactoring is quite time-consuming.

My point is: non-GoF patterns define a general idea but it is not enough to implement them in a complex case. My observation is teams sometimes needs lots of iterations to find their own way to implement an architectural pattern. It may takes months or even years.

Mentioned article doesn't contain any solution, but it is worth to be read to give you an insight into a complexity of GUI development.