I just released the first version of a model-view-controller framework I've been writing for C++. I have games in mind for it, though it is abstract enough that it could be used for something else.
Models subclass the Model class and are the most loosely-coupled elements in the design. They don't depend on anything.
Controllers subclass Controller and attach themselves as observers to a System object to listen for input or other kinds of notifications from the underlying system. The controller updates Model(s) and selects a View (or, more likely, a ViewComposite) to display.
Views subclass View and can be contained within ViewComposites. They attach themselves to Model(s) to listen for changes to Model updates (optional) and are called to display by a Controller.
The Controllers and Views (but not Models!) depend on a SystemInterface, which is just an interface for an underlying system. A System object implements the SystemInterface. An example of a SystemInterface would be ConsoleInterface and an example of a System would be a ncursesSystem. The goal is that there could be multiple implementations of a single SystemInterface, possibly for different platforms.
Finally, there is a Facade object that the application might subclass itself from. The Facade is an interface to everything else and is responsible for registering Models, Views, and Controllers, as well as initializing a System. The rest of the system interacts via the Facade. I intentionally avoided the use of singletons.
I would like a review of the code quality. I don't expect anybody else to use it yet (though, if you want to, go ahead!), but I would like to know if there are any obvious problems with the quality of the code.
You can browse the code at http://code.google.com/p/sydmvc/sour...wse/#svn/trunk without needing to download it.
I will attach an example (albeit very sloppy) implementation of it. I know it's sloppy; it was written haphazardly while writing the actual framework.
I'm only interested in comments about the framework, not the attached example usage of it.
http://code.google.com/p/sydmvc/sour...wse/#svn/trunk
http://code.google.com/p/sydmvc/
Bookmarks