Slides adapted from Alex Mariakakis, with material from Krysta Yousoufian and Kellen Donohue Section 8: Model-View-Controller.

Slides:



Advertisements
Similar presentations
Executional Architecture
Advertisements

Apache Struts Technology
Conversation Form l One path through a use case that emphasizes interactions between an actor and the system l Can show optional and repeated actions l.
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
© 2009 Research In Motion Limited Methods of application development for mobile devices.
BehavioralCmpE196G1 Behavioral Patterns Chain of Responsibility (requests through a chain of candidates) Command (encapsulates a request) Interpreter (grammar.
Graphical User Interface (GUI) Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Graphical User Interface (GUI) Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Object-Oriented Analysis and Design
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
Apache Struts Technology A MVC Framework for Java Web Applications.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
MIS2502: Data Analytics MySQL and SQL Workbench David Schuff
Slides by Alex Mariakakis with material from Krysta Yousoufian and Kellen Donohue Section 8: Model-View-Controller.
A physicist, an engineer and a programmer were in a car driving over a steep alpine pass when the brakes failed. The car was getting faster and faster,
MODEL VIEW CONTROLLER A Technical Seminar Report submitted to
MVC pattern and implementation in java
JavaScript & jQuery the missing manual Chapter 11
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
1 Dr Alexiei Dingli Web Science Stream Introducing Rails.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many others 1.
Building Secure Web Applications With ASP.Net MVC.
AJAX Compiled from “AJAX Programming” [Sang Shin] (Asynchronous JavaScript and XML)
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
Model View Controller A Pattern that Many People Think They Understand, But Has A Couple Meanings.
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
Developing MVC based AJAX applications Kapil Mohan Rich Internet Application Developer, Uzanto Consulting A talk by.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
Behavioural Design Patterns Quote du jour: ECE450S – Software Engineering II I have not failed. I've just found 10,000 ways that won't work. - Thomas Edison.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many of others 1.
PwC New Technologies New Risks. PricewaterhouseCoopers Technology and Security Evolution Mainframe Technology –Single host –Limited Trusted users Security.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
CS 4720 Model-View-Controller CS 4720 – Web & Mobile Systems.
CSE 331 Software Design & Implementation Hal Perkins Winter 2013 Events, Listeners, and Callbacks (slides by Mike Ernst and David Notkin) 1.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Model View Controller (MVC) an architecture Rick Mercer with help from many of others 1.
Prof. James A. Landay University of Washington Spring 2008 Web Interface Design, Prototyping, and Implementation Rich Internet Applications: AJAX, Server.
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
Dextrosoft SCHEDULED PHONE BACKUP Backup your mobile life Version Copyright © 2015 Dextrosoft Private Limited. All Rights Reserved.
Flux & React Web Application Development Mark Repka, Rich McNeary, Steve Mueller.
Apache Struts Technology A MVC Framework for Java Web Applications.
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.
Thomas Burleson. Using MVC with Flex & Coldfusion Projects June 27, 2007 See how Coldfusion MVC is similar to Flex MVC…
Section 8: Model-View-Controller
Introduction to Triggers
Observer Design Pattern
Section 8: Model-View-Controller
MVC and other n-tier Architectures
AJAX.
AJAX.
Lesson 1: Buttons and Events – 12/18
UNH Programming Assistance Center Automation
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
A physicist, an engineer and a programmer were in a car driving over a steep alpine pass when the brakes failed. The car was getting faster and faster,
Data, Databases, and DBMSs
Building responsive apps and sites with HTML5 web workers
MIS2502: Data Analytics MySQL and SQL Workbench
INFO/CSE 100, Spring 2006 Fluency in Information Technology
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
WPS - your story so far Seems incredible complicated, already
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.
Event loops.
Server & Tools Business
Presentation transcript:

Slides adapted from Alex Mariakakis, with material from Krysta Yousoufian and Kellen Donohue Section 8: Model-View-Controller

Agenda MVC MVC example 1: traffic light MVC example 2: registration HW8 info

MVC The classic design pattern Used for data-driven user applications Such apps juggle several tasks: Loading and storing the data – getting it in/out of storage on request Constructing the user interface – what the user sees Interpreting user actions – deciding whether to modify the UI or data These tasks are largely independent of each other Model, view, and controller each get one task

Model provides abstraction for data representation, storage, and retrieval What objects does this data represent? What SQL query will get me the data I need?

View asks model for data and presents it in a user-friendly format Would this text look better blue or red? In the bottom corner or front and center? Should these items go in a dropdown list or radio buttons?

Controller listens for the user to change data or state in the UI, notifying the model or view accordingly The user just clicked the “hide details” button. I better tell the view. The user just changed the event details. I better let the model know to update the data.

Structural Relationship What do you think are the benefits of MVC? ModelViewController taken from

Communication Flow ModelViewController push vs pull

Push vs. Pull Architecture Push architecture As soon as the model changes, it notifies all of the views Pull architecture When a view needs to be updated, it asks the model for new data Advantages for push Guaranteed to have latest data in case something goes wrong later on Advantages for pull Avoid unnecessary updates, not nearly as intensive on the view

Callbacks Synchronous callbacks: Examples: HashMap calls its client’s hashCode, equals Useful when the callback result is needed immediately by the library Asynchronous callbacks: Examples: GUI listeners Register to indicate interest and where to call back Useful when the callback should be performed later, when some interesting event occurs

Async Callbacks Asynchronous callbacks: Examples: GUI listeners Register to indicate interest and where to call back Useful when the callback should be performed later, when some interesting event occurs return, so client can finish processing

MVC in Webapps Ruby on Rails and Django enforce MVC In Ruby on Rails: Model: Ruby class defining an object, database backend Controller: Ruby code handling events and callbacks View: html page displays Which does Javascript belong to? Languages enforcing MVC doesn’t necessarily guarantee good design; you still have to make good choices

Benefits of MVC Organization of code Maintainable, easy to find what you need Ease of development Build and test components independently Flexibility Swap out views for different presentations of the same data (ex: calendar daily, weekly, or monthly view) Swap out models to change data storage without affecting user

MVC Example – Traffic Signal Regulate valid traffic movements Don’t let cars run into each other Detect cars waiting to enter intersection Traffic lights to direct car traffic Manual override for particular lights Automatic green for fire trucks Detect pedestrians waiting to cross Pedestrian signals to direct pedestrians External timer which triggers changes at set interval

Traffic Signal – MVC ComponentModelViewController Regulate valid traffic movements Detect cars waiting to enter intersection Traffic lights to direct car traffic Manual override for particular lights Detect pedestrians waiting to cross Pedestrian signals to direct pedestrians External timer which triggers changes at set interval

Traffic Signal – MVC ComponentModelViewController Regulate valid traffic movementsX Detect cars waiting to enter intersection Traffic lights to direct car traffic Manual override for particular lights Detect pedestrians waiting to cross Pedestrian signals to direct pedestrians External timer which triggers changes at set interval

Traffic Signal – MVC ComponentModelViewController Regulate valid traffic movementsX Detect cars waiting to enter intersection X Traffic lights to direct car traffic Manual override for particular lights Detect pedestrians waiting to cross Pedestrian signals to direct pedestrians External timer which triggers changes at set interval

Traffic Signal – MVC ComponentModelViewController Regulate valid traffic movementsX Detect cars waiting to enter intersection X Traffic lights to direct car trafficX Manual override for particular lights Detect pedestrians waiting to cross Pedestrian signals to direct pedestrians External timer which triggers changes at set interval

Traffic Signal – MVC ComponentModelViewController Regulate valid traffic movementsX Detect cars waiting to enter intersection X Traffic lights to direct car trafficX Manual override for particular lightsX Detect pedestrians waiting to cross Pedestrian signals to direct pedestrians External timer which triggers changes at set interval

Traffic Signal – MVC ComponentModelViewController Regulate valid traffic movementsX Detect cars waiting to enter intersection X Traffic lights to direct car trafficX Manual override for particular lightsX Detect pedestrians waiting to crossX Pedestrian signals to direct pedestrians External timer which triggers changes at set interval

Traffic Signal – MVC ComponentModelViewController Regulate valid traffic movementsX Detect cars waiting to enter intersection X Traffic lights to direct car trafficX Manual override for particular lightsX Detect pedestrians waiting to crossX Pedestrian signals to direct pedestrians X External timer which triggers changes at set interval

Traffic Signal – MVC ComponentModelViewController Regulate valid traffic movementsX Detect cars waiting to enter intersection X Traffic lights to direct car trafficX Manual override for particular lightsX Detect pedestrians waiting to crossX Pedestrian signals to direct pedestrians X External timer which triggers changes at set interval X

Traffic Signal – Model Stores current state of traffic flow Knows current direction of traffic Capable of skipping a light cycle Stores whether there are cars and/or pedestrians waiting Example TrafficModel

Traffic Signal – Views Conveys information to cars and pedestrians in a specific direction Examples CarLight – traffic light PedestrianLight – pedestrian light

Traffic Signal – Controller Aware of model’s current direction Triggers methods to notify model that state should change Examples PedestrianButton – notifies TrafficModel that there is a pedestrian waiting CarDetector – notifies TrafficModel that there is a car waiting LightSwitch – enables or disables the light Timer – regulates time in some way, possibly to skip cycles

MVC Example – Registration Registration system with web interface Advisors create classes, set space, time, restrictions Professors can see who’s signed up for their class Students can see available classes and sign up for classes Administrators can place holds on student registration Professors can be notified when a student drops Students can be notified when a spot is available in a class they want

Registration Would you use push or pull? What would change for interaction with an API or mobile app? If advisors can see what students are registered for and change their registration, what changes?

HW8 Overview Apply your generic graph & Dijkstra’s to campus map data Given a list of buildings and walking paths Produce routes from one building to another on the walking paths Distance in feet, compass directions Command-line interface now GUI in HW9

HW8 Data Format List of buildings (abbreviation, name, loc in pixels) BAG Bagley Hall (East Entrance) , BGR By George , List of paths (endpoint 1, endpoint 2, dist in feet) , , : , : ,1956.5: , , : , : , : (0,0) is in the upper left

MVC in HW8 Model stores graph, performs Dijkstra’s View shows results to users in text format Controller takes user commands and uses view to show results View and Controller will change in HW9, but Model will stay the same