Professor John Canny Spring 2003 March 12

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

6/13/20151 CS 160: Lecture 13 Professor John Canny Fall 2004.
1 Model View Controller. 2 Outline Review Definitions of MVC Why do we need it? Administiriva Changing the display Event flow Dragging at interactive.
Graphical User Interface (GUI) Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Graphical User Interface (GUI) Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
0 CS 160: Design Process: Implement Event-based UI Programming, Model-View-Controller, and the Web Jeffrey Nichols IBM Almaden Research Center
Object-Oriented Analysis and Design
Stanford hci group / cs376 research topics in human-computer interaction UI Software Tools Scott Klemmer 27 October 2005.
User Interface Programming in C#: Direct Manipulation Chris North CS 3724: HCI.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
MVC pattern and implementation in java
Software Tools.  It accomplishes an important task  (for better and for worse) You don’t have to make it yourself, and it abstracts a set of knowledge.
Introduction to Flash FYS100 Creative Discovery in Digital Art Forms Spring 2007 Burg.
Model-View-Controller Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
MVC CompSci 230 S Software Construction. MVC Architecture  A typical application includes software to  maintain application data,  document text.
(c) University of Washington08-1 CSC 143 Models and Views Reading: Ch. 18.
FLTK Help Session By Richard Yu Gu CS 638 -Graphics Fall, 1999.
Web Application Design Patterns. Large Scale Architectures Early systems were monolithic applications –Large and hard to maintain Then came the client-server.
User Interface Programming in C#: Direct Manipulation Chris North CS 3724: HCI.
Java Direct Manipulation Chris North cs3724: HCI.
CS160 Discussion Section Matthew Kam Apr 7, 2003.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many of others 1.
ANDROID AND MODEL / VIEW / CONTROLLER. Slide 2 Design Patters Common solutions to programming problems are called design patterns Design patterns are.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Model-View-Controller Architecture. 2 Give someone a program, you frustrate them for a day; teach them how to program, you frustrate them for a lifetime.
Tutorial 7 Creating Animations. XP Objectives Learn about animation Create a timeline Add AP divs and graphics to a timeline Move and resize animation.
1 CSC 221: Computer Programming I Fall 2009 Introduction to programming in Scratch  animation sprites  motion, control & sensing  costume changes 
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
Programming Paradigms, Software Architectural Patterns, and MVC CS 378 – Mobile Computing for iOS Dr. William C. Bulko.
Mobile Computing CSE 40814/60814 Spring 2017.
Guided By: Dr. Mingon Kang
Unit 5: Canvas Painter.
Design Patterns Source: “Design Patterns”, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides And Created.
GRASP – Designing Objects with Responsibilities
Create a Halloween Computer Game in Scratch
Support for the Development of Interactive Systems
Scratch for Interactivity
PYGAME.
Section 8: Model-View-Controller
Lecture 27 Creating Custom GUIs
Section 8: Model-View-Controller
An Introduction to Programming and VB.NET
Understand Windows Forms Applications and Console-based Applications
Introduction to Events
Chapter 16 – Programming your App’s Memory
Scratch for Interactivity
Model-View-Controller Design Pattern
Event Driven Programming
Design and Maintenance of Web Applications in J2EE
GEOMATIKA UNIVERSITY COLLEGE CHAPTER 2 OPERATING SYSTEM PRINCIPLES
Model-View-Controller Patterns and Frameworks
Web Application Architectures
Patterns.
Model-View-Controller
Software models - Software Architecture Design Patterns
Geography 413/613 Lecturer: John Masich
Using Functions
Web Application Architectures
Professor John Canny Spring 2003 March 10
Professor John Canny Spring 2004 March 5
Algorithms and Problem Solving
A physicist, an engineer and a programmer were in a car driving over a steep alpine pass when the brakes failed. Their car raced down the mountain, and.
Model, View, Controller design pattern
Scatter Diagrams Slide 1 of 4
Creating a Simple Game in Scratch
Web Application Architectures
CSC 221: Introduction to Programming Fall 2018
ACM programming contest
Presentation transcript:

Professor John Canny Spring 2003 March 12 CS 160: Lecture 12 Professor John Canny Spring 2003 March 12 5/12/2019

Outline Model-view controller Why do we need it? Changing the display Event flow Dragging at interactive speeds 5/12/2019

Model-View-Controller Architecture for interactive apps introduced by Smalltalk developers at PARC Partitions application in a way that is scalable maintainable Model View Controller 5/12/2019

Example Application Blue circles: 4 Cardinal squares: 2 5/12/2019

Model Model Information the app is trying to manipulate View Controller Model Information the app is trying to manipulate Representation of real world objects circuit for a CAD program logic gates and wires connecting them shapes in a drawing program geometry and color 5/12/2019

View View Implements a visual display of the model Controller Implements a visual display of the model May have multiple views e.g., shape view and numerical view 5/12/2019

Multiple Views Blue circles: 4 Cardinal squares: 2 5/12/2019

View View Implements a visual display of the model Controller Implements a visual display of the model May have multiple views e.g., shape view and numerical view Any time the model is changed, each view must be notified so that it can change later e.g., adding a new shape 5/12/2019

Controller Receives all input events from the user View Model Controller Receives all input events from the user Decides what they mean and what to do communicates with view to determine which objects are being manipulated (e.g., selection) calls model methods to make changes on objects model makes change and notifies views to update 5/12/2019

Controller Blue circles: 4 Cardinal squares: 2 5/12/2019

Controller Blue circles: 4 Cardinal squares: 2 5/12/2019

Relationship of View & Controller “pattern of behavior in response to user events (controller issues) is independent of visual geometry (view issues)” Controller must contact view to interpret what user events mean (e.g., selection) 5/12/2019

Combining View & Controller View and controller are tightly intertwined lots of communication between the two Almost always occur in pairs i.e., for each view, need a separate controller Many architectures combine into a single class View Model Controller 5/12/2019

Why MVC? Combining MVC into one class or using global variables will not scale model may have more than one view each is different and needs update when model changes Separation eases maintenance easy to add a new view later new model info may be needed, but old views still work can change a view later, e.g., draw shapes in 3-d (recall, view handles selection) 5/12/2019

Adding Views Later Blue circles: 4 Cardinal squares: 2 5/12/2019

Changing the Display How do we redraw when shape moves? 5/12/2019

Moving Cardinal Square Blue circles: 4 Cardinal squares: 2 5/12/2019

Erase w/ Background Color and Redraw Blue circles: 4 Cardinal squares: 2 5/12/2019

Changing the Display Erase and redraw using background color to erase fails drawing shape in new position loses ordering Move in model and then redraw view change position of shapes in model model keeps shapes in a desired order tell all views to redraw themselves in order slow for large / complex drawings flashing! 5/12/2019

Damage / Redraw Method View informs windowing system of areas that need to be updated (i.e., damaged) does not redraw them at this time… Windowing system batches updates clips them to visible portions of window Next time waiting for input windowing system calls Redraw method for win. passes region that needs to be updated 5/12/2019

Damage old, Change position in model, Damage new Blue circles: 4 Cardinal squares: 2 5/12/2019

Event Flow Creating a new shape 5/12/2019

Event Flow (cont.) Assume blue circle selected Blue circles: 0 Cardinal squares: 0 Assume blue circle selected 5/12/2019

Event Flow (cont.) Press mouse over tentative position Blue circles: 0 Cardinal squares: 0 Press mouse over tentative position Windowing system identifies proper window for event Controller for drawing area gets mouse click event Checks mode and sees “circle” Calls models AddCircle method with new position 5/12/2019

Event Flow (cont.) Blue circles: 0 Cardinal squares: 0 AddCircle adds new circle to model’s list of objects Model then notifies list of views of change drawing area view and text summary view Views notifies windowing system of damage both views notify WS without making changes yet! model may override 5/12/2019

Event Flow (cont.) Views return to model, which returns to controller Blue circles: 0 Cardinal squares: 0 Views return to model, which returns to controller Controller returns to event handler Event handler notices damage requests pending and responds If one of the views was obscured, it would be ignored 5/12/2019

Event Flow (cont.) Blue circles: 1 Cardinal squares: 0 Event handler calls view’s Redraw methods with damaged area Views redraw all objects in model that are in damaged area 5/12/2019

Dragging at Interactive Speeds Damage old, move, damage new method may be too slow must take less than 200 ms to be smooth Solutions don’t draw object, draw an outline (cartoon) use XOR to erase fast (problems w/ color) save portion of frame buffer before dragging 5/12/2019

Summary Model-view controller Motivation Display updates Event flow Dragging at interactive speeds 5/12/2019