Presentation is loading. Please wait.

Presentation is loading. Please wait.

Model-View Controller

Similar presentations


Presentation on theme: "Model-View Controller"— Presentation transcript:

1 Model-View Controller
Design pattern presentation and discussion Rajat arya EFECS * OIM DAWG MVC Presentation

2 Agenda Definition History / Origins Functional Description
what is this fancy thing called MVC? History / Origins where does it come from? Functional Description how does MVC actually work? Goal / Benefits why is it important? Example Scenarios where could MVC be used? Sample MVC Implementation Review lets see this thing actually working Modern Implementations where does it exist right now? Questions? Reference Materials DAWG MVC Presentation

3 MVC Definition The Model-View Controller Paradigm is a triad of classes used to build modular applications. MVC consists of three components (objects): Model – application object (data) View – user interface (presentation) Controller – defines how user interface reacts to user action DAWG MVC Presentation

4 History First Appeared Formally in:
“A cookbook for using the model-view controller user interface paradigm in Smalltalk-8” by Glenn E. Krasner and Stephen T. Pope Journal of Object-Oriented Programming, 1(3):26-49 August/September 1988 DAWG MVC Presentation

5 Functional Description Intro – Observer Pattern
MVC utilizes two applications of the Observer Pattern Observer Pattern (aka Publish-Subscribe) Attach / Detach / Notify Decouples Subjects from Observers, subjects do not know about observers directly Observer Docs: DAWG MVC Presentation

6 MVC Functional Description
MVC Definition: Specific application of the Observer Design Pattern Model is application object (data) View is the user interface (presentation) – observes Model Controller defines way user interface reacts to input – observes View Observer Pattern Used Twice (Controller observes View and View observes Model) View Controller Model DAWG MVC Presentation

7 MVC Functional Description (2)
Controller maintains knowledge of both View and Model, View has knowledge of Model Controller observes changes in View (1), informs Model (2) View observes changes in Model (3) and updates View (1) Controller (3) (2) Model DAWG MVC Presentation

8 Goal / Benefits Modularity Flexibility Maintainability Testability
decoupling components allows each component to be versioned independently worked on by individuals on team (UI person, DB person, etc) Flexibility multiple Views for one Model (web frontend, desktop frontend, mobile frontend, etc) replace one component (replace data storage from flat file to database) Maintainability only change one component where bug exists, less risk in late changes Testability each component communicates through contract so each component can be unit-tested independently DAWG MVC Presentation

9 Example Scenarios Spreadsheet application (classic)
same data (model) spreadsheet can have multiple charts (views) updating spreadsheet should result in updated charts example of multiple views, single controller, single model Scaling an application view is desktop or web, model is a flat-file database updating the database to clustered set of SQL servers only model needs to take changes for architecture, controller connects to new model and doesn’t know that the model is now backed by several DBs instead of one file Multiple user interfaces to application web interface, mobile phone interface, point-of-sale interface, desktop interface multiple views, multiple controllers, single model DAWG MVC Presentation

10 Sample Implementation Review
Small WPF Application written in C# to illustrate how MVC. me if you would like a copy of the source code. DAWG MVC Presentation

11 Modern Implementations
GUI Frameworks for desktop applications Application Kit – part of Cocoa for OS X desktop apps GTK+ - part of GTK libraries, used in lots of apps Microsoft Foundation Classes (MFC) – Document/View Architecture Java Swing Windows Presentation Framework (WPF) TK Toolkit – part of Tcl/Tk Implementations of MVC in web-based frameworks ASP .NET MVC Framework (.NET) ProMesh.NET (.NET) Grails (Java) Struts (Java) Spring (Java) PureMVC (JavaScript) Ruby on Rails (Ruby) Zend Framework (PHP) Django (Python) Pylons (Python) DAWG MVC Presentation

12 Fin. Questions? DAWG MVC Presentation

13 Reference Links Design Patterns: Elements of Reusable Object-Oriented Software If you get nothing else from this talk, please go look this up – it is the most important book I’ve read regarding object-oriented programming: MVC Observer Pattern DAWG MVC Presentation


Download ppt "Model-View Controller"

Similar presentations


Ads by Google