Ben Rady has a new metaphor for the MVC pattern, the command line. It’s interesting how as you become more familiar with a particular pattern or technology, you begin to see it in other places. Oftentimes, this is helpful in beginning to understand things more deeply. Occasionally, it gets you in trouble when you begin to see patterns in everything not unlike when I first learned the factory pattern and then thought everything was a factory.
In this case, I think he’s right that the command line can be thought of as an implementation of MVC. The part he doesn’t address is a persistent data storage layer and the model’s interaction with it. With Ruby on Rails, our interaction with the data goes through the model in the form of ActiveRecord. With the command line example, your interaction between the model and the data all depends on what model you’re using, an interesting twist. For example, with grep, your interaction becomes the search strings and regular expressions you feed it to determine what data you want to see. With wget, you determine your model-data interaction by specifying URLs or specific resources that you want your model to load.
Thinking of the command line as an implementation of MVC gets you thinking about other common applications or tools that might also be MVC in nature. Any come to mind?