OutSystems and OODesign Patterns

Luciano Schiavo
3 min readNov 24, 2019

--

Design pattern can be helpful with OutSystems but I don't usually listen to OutSystems developers talking about this. So, I decided to approach this subject presenting a simple practical use.

How to use design patterns with OutSystems

The subject of this post is in the book written in 1994 by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. The authors were often referred to as Gang of Four (GoF) and presented it at the OOPSLA(Object Oriented Programming, Systems, Languages & Applications — an anual ACM conference) meeting held in Portland, Oregon, in October and it uses C++ and Smalltalk code as example. The book uses a concept of Christopher Alexander (that says that a design “… pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in a such way that you can use this solution a million times over, without ever doing it the same way twice”) to contextualize the problem and define that design patterns are descriptions of communicating objects and classes that are customised to solve a general design problem in a particular context.

I usually hear that this book is only useful for object oriented languages (I can't blame them once design pattern definition says that) but if we pay attention only to the the general concept and I can affirm that it can be reused in the OutSystems (that is not an object oriented language) and I can cite as example a design pattern described in this book. You probably know it too, the famous Model-View-Controller (MVC).

MVC architectural pattern cataloged in the Software Architecture in Practice — 3rd Edition is mentioned in this book that shows its roots from1988 and if you go deep in the lecture you will realize that there are 23 design patterns. However, I will use the Singleton design pattern as example.

Singleton design pattern intents to ensure that a class has only one instance, and provide a global point of access to it. I usually use it to enable the access of parameters to my entire system, according to the implementation below.

Singleton implementation using OutSystems

When I read the entity parameter I check if there is more than one register on the aggregate and if the answer is yes, I raise an exception. The next step is to check if the parameter entity is empty. Being the case, I create a new register and deliver it as output of my action. The last false option will be performed only to deliver the actual register in the happy path.

As you can see, once you reuse the same concept, it is possible to implement design patterns using OutSystems to solve same problems that occur in the object oriented language.

I hope you liked this post and as it is my last one in this year, I wish you a happy Merry Christmas and a Happy New Year. :)

--

--

Luciano Schiavo
Luciano Schiavo

Written by Luciano Schiavo

PMP Certified | Togaf 9 and Business Architecture Certified| LSS Black Belt | Solutions Architect |Productivity Improvement Researcher

No responses yet