DEV Community

Discussion on: Underrated design patterns

Collapse
 
thomaswdmelville profile image
Thomas Melville • Edited

Hi Bertil,

Two I've used are State and Proxy.

Proxy we used extensively in a java based test automation framework. It simplified the tests for the user while allowing us to make them more reliable. One example is in UI testing, ensuring the element is on the page before interacting with it. Anyone who has used selenium knows of the dreaded StaleElementReferenceException.

I used State in a java based server side of a web app. An object in the domain could be in one of many states and depending on the state could only transition to particular states. This was combined with the template method to give common functionality to all classes and yet let the algorithms vary