Last Updated: February 25, 2016
·
1.083K
· alexanderbrevig

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#.