Design Patterns
Comparing MVC Controller and Application Controller
The Model-View-Controller design pattern provides a very useful separation between parts of an application. Unfortunately some other patterns have emerged that add confusion to what the parts of MVC really are.
The most striking example of this is the Application Controller[^appc]. A lot of web application frameworks use this pattern and often—if not always—AppController is the only type of controller available and this leads beginners to believe that this “controller” is in fact the C in MVC. (Ruby on) Rails is an example
State and Proxy: Substitution Proxy
I was reading the State pattern in GoF and there was one issue they addressed that I think I have a better solution for.
A quick reminder if you don’t remember the pattern: Allow an object to alter its behavior when its internal state changes. The object will appear to change its class. The example GoF gives is a TCPConnection class that is composed of a TCPState, the TCPstate will behave differently depending on the current state of the connection (such as throwing an exception if close() is called when the state is already