Image for post
Image for post
How to implement the State Pattern in Go

The State Pattern is considered a Behavioural Design Pattern. Behavioural patterns seek to ensure that objects may still exchange messages and at the same time be loosely coupled. This is enforced by proper assignment of responsibilities between objects. In case of the State Pattern this is implemented by letting an object alter behaviour when its internal state changes — sometimes to such an extend that it may look like the object has changed its class. …


Professional Software Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store