What is MVC Category: System MVC=Model-View-Controller

Slides:



Advertisements
Similar presentations
3 Copyright © 2005, Oracle. All rights reserved. Designing J2EE Applications.
Advertisements

Coursework.  5 groups of 4-5 students  2 project options  Full project specifications on 3 rd March  Final deadline 10 th May 2011  Code storage.
Lab 9: Code Organization User Interface Lab: GUI Lab October 23 rd, 2013.
P5, M1, D1.
Observer Method 1. References Gamma Erich, Helm Richard, “Design Patterns: Elements of Reusable Object- Oriented Software” 2.
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
Winter 2012ACS-3913 Ron McFadyen1 Model View Controller Originated with Smalltalk development (1979) Separates a system’s classes into View, Controller,
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Object-Oriented Analysis and Design
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
Intro to Spring CJUG - January What is Spring? “The Spring framework provides central transaction control of various objects.” This means that any.
Behavioral Patterns  Behavioral patterns are patterns whose purpose is to facilitate the work of algorithmic calculations and communication between classes.
MVC pattern and implementation in java
MVC and MVP. References enter.html enter.html
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
CSSE 374: 3½ Gang of Four Design Patterns These slides derived from Steve Chenoweth, Shawn Bohner, Curt Clifton, and others involved in delivering 374.
(c) University of Washington08-1 CSC 143 Models and Views Reading: Ch. 18.
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many others 1.
Introduction to Java Beans CIS 421 Web-based Java Programming.
Model View Controller MVC Web Software Architecture.
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.
(1) Introduction to Java GUIs Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Object Arts.com “Twisting the Triad” The evolution of the Dolphin Smalltalk MVP framework Andy Bower Blair McGlashan Object Arts Ltd.
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.
Model View Controller (MVC) an architecture Rick Mercer with help from many of others 1.
L10: Model-View-Controller General application structure. User Interface: Role, Requirements, Problems Design patterns: Model – View – Controller, Observer/Observable.
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.
J2EE Platform Overview (Application Architecture)
Business rules.
Design Patterns Source: “Design Patterns”, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides And Created.
Software Design Refinement Using Design Patterns
Web Routing Designing an Interface
Java Beans Sagun Dhakhwa.
Observer Design Pattern
MVC and Design Patterns
Observer Design Pattern
MVC and other n-tier Architectures
Architectural Patterns for Interactive Software
Design Patterns: Model View Controller
Processes The most important processes used in Web-based systems and their internal organization.
Model-View-Controller Design Pattern
GoF Design Patterns (Ch. 26). GoF Design Patterns Adapter Factory Singleton Strategy Composite Façade Observer (Publish-Subscribe)
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
Programmable Logic Controllers (PLCs) An Overview.
MVC Framework, in general.
Design and Maintenance of Web Applications in J2EE
Intro to Spring CJUG - January 2013.
Model-View-Controller Patterns and Frameworks
Building Graphical User Interface with Swing a short introduction
Lecture 1: Multi-tier Architecture Overview
Model-View-Controller (MVC) Pattern
Model-View-Controller
Observer Pattern 1.
What is Singleton Category: Creational pattern
What is Adapter Category: Structural Also known as ‘Wrapper’
Question Banks, Reusability, and DDI 3.2 (Use Parameters)
Design Patterns Lecture part 1.
OBJECT ARCHITECTURE DESIGN
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Week 6, Class 2: Observer Pattern
Model, View, Controller design pattern
11. MVC SE2811 Software Component Design
11. MVC SE2811 Software Component Design
Eric Mazzocco, Jake Smith, Ian Anderson
ASP.NET MVC Imran Rashid CTO at ManiWeber Technologies.
Presentation transcript:

What is MVC Category: System MVC=Model-View-Controller Model: The data being maintained by the application (in the form of an object or objects) View: The presentation of the data Controller: The changing of data based on user inputs. Logically separates object data itself (model), from the presentation logic (view) and modification logic (controller) for that data.

MVC Background MVC often relies on two other patterns: Strategy & Observer About Strategy: Category: Behavioral Strategy objects represent some logic to be performed By being stored in separate objects, the logic is pluggable, simply by swapping out the strategy object being used. Usually, the Controller part of MVC is implemented as a Strategy object to simplify choosing controllers About Observer: Often a change to data requires a large number of disparate changes to occur (update 2 screens, send an email, save something to a file, etc). The observer pattern provides a generic format to notify many observers in a change to an observable The observable object, when changed, notifies all observer objects that it was changed, allowing each in turn to perform some functionality. Usually, the model part of MVC is implemented as observable (the object to be watched), and the views are implemented as observers (the objects to do the watching); therefore when the model changes, the views are automatically updated.

How to Use MVC Create a model object to represent your data. * Implement the observer pattern with your model to make updating the view objects more intuitive. Create 1-many views that represent the model object, and potentially some functionality (such as editing) Create 1-many controllers that represent the functionality for any views with controls on them. * Implement the strategy pattern with your controllers to make them easily pluggable into the view. * - Denotes an optional step

From (Stephen Stelting, Olav Maassen, Applied Java™ Patterns) Component Diagram Note: A component diagram and subsequently, components, are used to describe this pattern (as opposed to classes) because the model, controller, and view may not be one object, but a combination of many. From (Stephen Stelting, Olav Maassen, Applied Java™ Patterns)

Class Diagram (Strategy) From (Stephen Stelting, Olav Maassen, Applied Java™ Patterns)

Class Diagram (Observer) From (Stephen Stelting, Olav Maassen, Applied Java™ Patterns)

Why MVC MVC ensures that the three different components (model, view, and controller) are loosely coupled Different views, and different controllers can be plugged in easily. Not only can views differ in terms of functionality, they can also differ in terms of platform (Swing, console, web page, etc.)

Example Let’s say we are creating a program to manage contact information... All-in-one Heavyweight Class public class Contact { // … instance variables // … getter/setter methods public void renderDisplayView() { // render display } public void renderEditView() { // render edit view // connect buttons/fields to this class public void handleEdit(…) { // handle edit Modular, Lightweight Classes public class Contact { // … instance variables // … getter setter methods. } public interface ContactView { public void render(); public class DisplayContactView { public void render() { // render display view… public class EditContactView { // render edit view // connect buttons/fields to controller public interface ContactController { public void handle(…); public Class EditContactController { public void handle() { // handle edit…

Full Swing Example From (Stephen Stelting, Olav Maassen, Applied Java™ Patterns) (See associated .java files)