My New MVC Metaphor: The Command Line
November 16, 2009
A useful metaphor for the MVC pattern struck me today: The command
line. A command line prompt gives you all the elements of an MVC
architecture.
The Models
On the command line, the model elements are the programs you execute. ls, grep, awk, cat, wget, etc... all of those wonderful tools that actually get things done.
The Controllers
The controller elements are the things you use to tie the models together. The pipes, the redirects, the ampersands. All of these things allow you to tie models together in an infinite number of different combinations to do what you want. The proportion of models to controllers in any given system (or command) is high. You want it to be mostly models with a little controller glue...but without the controllers, the models are nearly useless. The result of all of this, then, is:
The View
Standard Out. Of course, the command line only really has one native input/output format: text. But oh what a format it is.
And the last component...
There's one more component we haven't addressed in this equation, but I'll leave that as an exercise to the reader.
The Models
On the command line, the model elements are the programs you execute. ls, grep, awk, cat, wget, etc... all of those wonderful tools that actually get things done.
The Controllers
The controller elements are the things you use to tie the models together. The pipes, the redirects, the ampersands. All of these things allow you to tie models together in an infinite number of different combinations to do what you want. The proportion of models to controllers in any given system (or command) is high. You want it to be mostly models with a little controller glue...but without the controllers, the models are nearly useless. The result of all of this, then, is:
The View
Standard Out. Of course, the command line only really has one native input/output format: text. But oh what a format it is.
And the last component...
There's one more component we haven't addressed in this equation, but I'll leave that as an exercise to the reader.
Any hint on what is the last component? :P
Posted by: Ian Lim | November 16, 2009 at 07:55 PM
Where is the database in this equation?
Posted by: Ben Rady | November 16, 2009 at 08:11 PM
Looks like you're missing STDERR. And maybe STDIN. :)
Posted by: www.facebook.com/profile.php?id=1149255213 | November 16, 2009 at 10:13 PM