Can anybody point to/give a very very correct example for the Model-View-Controller paradigm? I mean something really simple (like an inches to cm converter) implemented in some easy-to-understand language (VB.NET?) absolutely and exactly following MVC principles.
This one's pretty good: http://www.c2.com/cgi-bin/wiki?ModelViewController
But really, MVC is very simple:
Model: Your DATA. View: The thing that controls how your data is PRESENTED. Controller: Sits between the data and the view, other data sources, and controls any changing of the data that needs to be done.
This isn't to say that your view won't itself be built out of models, views, and controllers, but if you sort things according to these questions, things will usually stay pretty clean:
- Is it something the user interacts with, or that formats things for a user? It goes in the View.
- Is it just a representation of data, with little associated "smarts"? It's a model.
- Everything else goes in the controller.
I am created one small login application in java(GWT) which is following MVC pattern.Though it is in java but I used interfaces and classes in it.So hopefully you will understand it.There is one Controller class which is following singleton pattern.You can get all source from here