Winter 2012ACS-3913 Ron McFadyen1 Model View Controller Originated with Smalltalk development (1979) Separates a system’s classes into View, Controller,

Slides:



Advertisements
Similar presentations
Database Ed Milne. Theme An introduction to databases Using the Base component of LibreOffice LibreOffice.
Advertisements

Winter 2007ACS-3913 Ron McFadyen1 Duck Example Consider the text example (up to page 6). Each type of duck is a subclass of Duck Most subclasses implement.
Winter 2007ACS-3913 Ron McFadyen1 Also known as publish/subscribe The essence of this pattern is that one or more objects (called observers or listeners)
CSE 425: Semantic Analysis Semantic Analysis Allows rigorous specification of a program’s meaning –Lets (parts of) programming languages be proven correct.
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
Jan 29, Ron McFadyen1 UML Class Diagram Examples Based on well-known patterns Exhibit ways of providing dynamic structures and behaviour.
March Ron McFadyen1 Command The command pattern encapsulates a request or unit of work into an object. An invoker will ask a concrete command.
March R McFadyen1 Architecture Architecture involves the set of significant decisions about the organization of a software system, decisions.
Fall 2009ACS-3913 Ron McFadyen Composite Pattern Problem: How do we treat a composition structure of objects the same way as a non-composite object? Arises.
March Ron McFadyen1 Observer P Also known as Publish-Subscribe Applied in order to implement the Model-View Separation principle (see.
Fall 2009ACS-3913 Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
MVC Nick Lopez Duplication of course material for any commercial purpose without the explicit written permission of the professor is prohibited.
Spring 2010ACS-3913 Ron McFadyen1 Weather Station Page 39+ In this application, weather station devices supply data to a weather data object. As the data.
Java Swing Toolkit Graphics The key to effectively using graphics in Java is understanding: –the basic components of the graphics library –the patterns.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 5 Interactive Programs.
Nov Ron McFadyen1 Observer P Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another.
Fall 2009ACS-3913 Ron McFadyen1 idea was first put forth by Christopher Alexander (1977) in his work on architectural design principles a pattern is a.
Spring 2010ACS-3913 Ron McFadyen1 Command The command pattern encapsulates a request or unit of work into an object. An invoker will ask a concrete command.
Oct Ron McFadyen1 Collaborations Collaboration : an arrangement of classes, links, roles in a context to implement some behaviour. Useful for.
Winter 2007ACS-3913 Ron McFadyen1 Observer Pattern Problem: There are many objects (observers / subscribers) needing to know of the state changes, or events,
MVC Fall 2005 OOPD John Anthony. Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities.
Object-Oriented Analysis and Design
Design patterns Observer,Strategi, Composite,Template (Chap 5, 6)
Model View Controller (MVC) Architecture. Terminology and History MVC evolved from Smalltalk-80 Has become a key pattern in web based applications – If.
Fall 2009ACS-3913 Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Date: 1753 an interpretation.
March Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
March R McFadyen1 Figure 30.2 Layers in NextGen They only have three layers in this architecture Each layer is shown as a UML Package No separate.
More OOP Design Patterns
Chapter 13 Starting Design: Logical Architecture and UML Package Diagrams.
Design Patterns and Graphical User Interfaces Horstmann ,
MVC and MVP. References enter.html enter.html
CSSE 374: 3½ Gang of Four Design Patterns These slides derived from Steve Chenoweth, Shawn Bohner, Curt Clifton, and others involved in delivering 374.
ISP666 MVC & Design Patterns. Outline Review Event Programming Model Model-View-Controller Revisit Simple Calculator Break Design Patterns Exercise.
Swing and MVCS CompSci 230 Software Construction.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
CS 151: Object-Oriented Design October 24 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
Oct R McFadyen1 Facade P Problem: There are a set of classes, a subsystem, that you need to interact with for some purpose, but you don’t.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many others 1.
Model View Controller A Pattern that Many People Think They Understand, But Has A Couple Meanings.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Title Carolina First Steering Committee October 9, 2010 Online Voting System Design Yinpeng Li and Tian Cao May 3, 2011.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many of others 1.
JavaScript, Fourth Edition
CS 151: Object-Oriented Design October 15 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
1 CSE 331 Model/View Separation and Observer Pattern slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia.
INTRODUCTION JavaScript can make websites more interactive, interesting, and user-friendly.
Lecture Model View Controller s/w architecture AND general tips on structuring classes.
L10: Model-View-Controller General application structure. User Interface: Role, Requirements, Problems Design patterns: Model – View – Controller, Observer/Observable.
Java - hello world example public class HelloWorld { public static void main (String args[]) { System.out.println("Hello World"); }
CALCULATING BEATS PER MINUTE (BPM) If we count the number of beats in 60 seconds, that is the number of beats per minute (bpm)
Oct 3, Ron McFadyen1 GRASP Patterns 1.Expert 2.Creator 3.Controller 4.Low Coupling 5.High Cohesion.
1 Resort Data Processing One Login to Rule Them All.
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
Chapter 5 Patterns and GUI Programming -Part 2-. COMPOSITE Pattern Containers and Components Containers collect GUI components Sometimes, want to add.
Common Design Patterns
Observer Design Pattern
MVC and Design Patterns
What is MVC Category: System MVC=Model-View-Controller
Model-View-Controller
Building Graphical User Interface with Swing a short introduction
Model-View-Controller (MVC) Pattern
Patterns.
Starting Design: Logical Architecture and UML Package Diagrams
Graphical User Interfaces in Java Event-driven programming
Advanced ProgramMING Practices
Design Patterns Lecture part 1.
Advanced ProgramMING Practices
11. MVC SE2811 Software Component Design
11. MVC SE2811 Software Component Design
GoF Patterns Ch. 26.
Presentation transcript:

Winter 2012ACS-3913 Ron McFadyen1 Model View Controller Originated with Smalltalk development (1979) Separates a system’s classes into View, Controller, Model

Model View Controller ViewController Controller handles decisions regarding user events Model notifies its views Controller informs model to update itself according to user actions Other patterns are likely in use: Factory for creating a default controller Decorator for creating scrollable views … gets updates Winter 20122ACS-3913 Ron McFadyen

Model View Controller ViewController Strategy Model Composite Observer Winter 20123ACS-3913 Ron McFadyen

Winter 2012ACS-3913 Ron McFadyen4 Model View Controller Whenever the model’s state changes it notifies the view and the view can update itself. The model is a subject that notifies its observers (view) The controller represents a strategy for reacting to user interface events. A view has a controller, a strategy, associated with it; strategies can be swapped in and out. The controller, learning of a certain user action, may inform the model to take some action to update itself. The controller may also inform the view to take some action. The visual presentation is de- coupled from the actions required to manage user gui events. A view is typically a nested structure of components organized according to the composite pattern.

Winter 2012ACS-3913 Ron McFadyen5 Model View Controller Examples: Calculator example DJ example in text

Winter 2012ACS-3913 Ron McFadyen6 Model View Controller Calculator example (see course web pages) View: To display a log of operations To display running total and allow user to enter an operand and select an operator Model: the current state … the current total Informs the views of pertinent results Controller: Informs the model if the user selects an operator Informs views to update their display

Winter 2012ACS-3913 Ron McFadyen7 Model View Controller Assignment 5: modify this example to include a new view more operations (subtraction, division) one list of observers. Due Tuesday April 3, 2012

Winter 2012ACS-3913 Ron McFadyen8 Model View Controller DJ example in text, pages View: To display a pulsing beat (BeatBar) To display the beats per minute, and to let the user change the bpm in three ways: new value, increment, decrement Model: the current state … the current bpm Informs the views of pertinent changes Controller: Informs the model if the user changes the bpm Informs views to enable/disable buttons Note the controller interface could be described by use cases … one for each end-user goal

Winter 2012ACS-3913 Ron McFadyen9 Model View Controller MVC in practice is encountered in many variations on many platforms: e.g. these links may still be valid: Android-Developers-MVC-and-MVVM.aspx