mloxua
Last Updated: February 25, 2016
·
713
· alexanderbrevig
Feb007acc38e70d57f7b4c205f7e8b26

The Military Design Pattern

Let's say that you want to hide all your UI elements that inherits from a Hideable interface/baseclass.

This pattern enable you to go from code like this:

foreach (Hideable hideable in frame
    .GetWidgetsManager()
    .GetAllWidgets()) 
{
    hideable.Hide();
}
foreach (Hideable hideable in frame
    .GetPopupNotices()) 
{
    hideable.Hide();
}

To this:

Hideable.Hide();

I have written an article about this that explains in further detail with implementation in C#.

Say Thanks
Respond