3 ms·
It's a good alternative to the State or Strategy patterns when you only need one per object and virtually all methods are affected. Using the pattern, you'd ne
by nostrademons 11y ago
It's a good alternative to the State or Strategy patterns when you only need one per object and virtually all methods are affected. Using the pattern, you'd need to explicitly delegate all calls to the state/strategy object. When you change the class, you're effectively using the type object as the state/strategy object, which makes perfect sense because it already contains all the methods.