Model-View-Controller

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Lab 9: Code Organization User Interface Lab: GUI Lab October 23 rd, 2013.
13-Jun-15 Model-View-Controller. 2 Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities.
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.
Model-View-Controller. Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities are Design.
29-Jun-15 Model-View-Controller. 2 Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities.
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
CS6320 – MVC L. Grewe THE ISSUE: Separating Implementation from Interface The business logic stays the same regardless of what the presentation is The.
14-Jul-15 Model-View-Controller. 2 Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities.
MVC pattern and implementation in java
MVC CompSci 230 S Software Construction. MVC Architecture  A typical application includes software to  maintain application data,  document text.
 The scientific method comes in many different forms but always has these basic steps: 1. Ask a question 2. Develop a hypothesis (An if/then statement.
Model-View-Controller design pattern. Design Patterns “Making abstractions which are powerful and deep is an art. It requires tremendous ability to go.
Design Pattern. Definition: A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
Java Model-View-Controller. Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities are.
CSE 332: Design Patterns Review: Design Pattern Structure A design pattern has a name –So when someone says “Adapter” you know what they mean –So you can.
ANDROID AND MODEL / VIEW / CONTROLLER. Slide 2 Design Patters Common solutions to programming problems are called design patterns Design patterns are.
6-Jan-16 Model-View-Controller. 2 Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities.
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.
L10: Model-View-Controller General application structure. User Interface: Role, Requirements, Problems Design patterns: Model – View – Controller, Observer/Observable.
12-Jun-16 Event loops. 2 Programming in prehistoric times Earliest programs were all “batch” processing There was no interaction with the user Input Output.
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
21-Jun-16 Swing Basics and Model-View- Controller.
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.
CHALLENGING HIGHER ACHIEVING PUPILS IN MATHEMATICS Cluster Meeting 29th March 2010.
Introduction to Computing Systems
What Do You Use the Internet For?
Introduction To DBMS.
Component 1 Logical operators.
Design Patterns Source: “Design Patterns”, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides And Created.
Introduction to .NET Florin Olariu
Phil Tayco Slide version 1.0 Created Sep 18, 2017
Debugging Intermittent Issues
Organizational Patterns
Event loops 16-Jun-18.
Introduction to System Analysis and Design
Linear Equations Linear equations are functions which have two variables. They have an independent and dependent variable. Free powerpoints at
Debugging Intermittent Issues
Model-View-Controller Design Pattern
What is MVC Category: System MVC=Model-View-Controller
Design and Maintenance of Web Applications in J2EE
Model-View-Controller
Using Objects 21-Nov-18.
Model-View-Controller Patterns and Frameworks
Event loops.
Building Graphical User Interface with Swing a short introduction
Steps of the Scientific Method
Scientific Method.
Using a Scientific Approach
Review: Design Pattern Structure
Computer Science Testing.
Separation of Concerns
Event loops 17-Jan-19.
Event loops 17-Jan-19.
Professor John Canny Spring 2004 March 5
Algorithms and Problem Solving
Event loops 8-Apr-19.
Tonga Institute of Higher Education IT 141: Information Systems
Peter Seibel Practical Common Lisp Peter Seibel
Tonga Institute of Higher Education IT 141: Information Systems
Model, View, Controller design pattern
Learn how to choose the best strategy to solve the problem.
Professor John Canny Spring 2003 March 12
Domain ( Input ): 2, 4, 5, 7 Range ( Output ): 32, 59, 65, 69, 96.
Learning Objectives The student will analyze why individuals choose not to express or manage feelings in situations; e.g., using anger to manipulate.
Designing Experimental Investigations
Event loops.
Event loops 19-Aug-19.
Presentation transcript:

Model-View-Controller 30-Nov-18

Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities are Design Patterns describe the higher-level organization of solutions to common problems Design patterns are a major topic in O-O design

The MVC pattern MVC stands for Model-View-Controller The Model is the actual internal representation The View (or a View) is a way of looking at or displaying the model The Controller provides for user input and modification These three components are usually implemented as separate classes

The Model Most programs are supposed to do work, not just be “another pretty face” but there are some exceptions useful programs existed long before GUIs The Model is the part that does the work--it models the actual problem being solved The Model should be independent of both the Controller and the View But it provides services (methods) for them to use Independence gives flexibility, robustness

The Controller The Controller decides what the model is to do Often, the user is put in control by means of a GUI in this case, the GUI and the Controller are often the same The Controller and the Model can almost always be separated (what to do versus how to do it) The design of the Controller depends on the Model The Model should not depend on the Controller

The View Typically, the user has to be able to see, or view, what the program is doing The View shows what the Model is doing The View is a passive observer; it should not affect the model The Model should be independent of the View, but (but it can provide access methods) The View should not display what the Controller thinks is happening

Combining Controller and View Sometimes the Controller and View are combined, especially in small programs Combining the Controller and View is appropriate if they are very interdependent The Model should still be independent Never mix Model code with GUI code!

Separation of concerns As always, you want code independence The Model should not be contaminated with control code or display code The View should represent the Model as it really is, not some remembered status The Controller should talk to the Model and View, not manipulate them The Controller can set variables that the Model and View can read

Key points A Model does the “business logic” It should be I/O free Communication with the Model is via methods This approach gives maximum flexibility in how the model is used The Controller organizes the program and provides input (control) to the Model The View displays what is going on in the model It should never display what should be going on in the model For example, if you ask to save a file, the View shouldn’t itself tell you that the file has been saved—it should tell you what the model reports Especially in small programs, the Controller and View are often combined

The End Give someone a program, you frustrate them for a day; teach them how to program, you frustrate them for a lifetime. — David Leinweber