Mvc – Command Line Interface MVC Architecture

command linemvc

I just learned about the MVC architecture. I was going back and working on a command line file transfer application I wrote, and I was curious, to what degree should command line interfaces follow the MVC pattern?

Best Answer

Model View Controller isn't just for applications with GUI's. Very simply it's the idea that you can separate your code into at least three areas of responsibility. Actually, under MVC the fact that your application is a CLI is a detail to which the model can be blissfully unaware. One of the advantages of this is that means you can use the same model untouched if you decide to make a GUI version of your App.

CLI or not, the "degree" to which you should follow MVC depends entirely on how much you care about writing code that welcomes a requirements change. Otherwise, feh, who cares?

Related Topic