Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.

Slides:



Advertisements
Similar presentations
12 October 2011 Andrew Brown IMu Technology EMu Global Users Group 12 October 2011 IMu Technology.
Advertisements

Apache Struts Technology
Model-View Controller
Introduction to Model-View-Controller (MVC) Web Programming with TurboGears Leif Oppermann,
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.
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.
Model-View-Controller. Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities are Design.
CS 290C: Formal Models for Web Software Lecture 1: Introduction Instructor: Tevfik Bultan.
Software Architecture Patterns (2). what is architecture? (recap) o an overall blueprint/model describing the structures and properties of a "system"
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
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.
Apache Struts Technology A MVC Framework for Java Web Applications.
Session-01. Layers Struts 2 Framework The struts 2 framework is used to develop MVC-based web application. Struts 1.0 was released in June The.
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
N-Tier Architecture.
UNIT-V The MVC architecture and Struts Framework.
MVC pattern and implementation in java
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
MVC and MVP. References enter.html enter.html
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Portlet Framework: the Liferay way Liferay Service Builder, Portlet MVC Catania, 10/06/2014Riccardo Rotondo.
ASP.NET and Model View Control Jesper Tørresø ITNET2 F08.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
MVC CompSci 230 S Software Construction. MVC Architecture  A typical application includes software to  maintain application data,  document text.
® IBM Software Group © 2007 IBM Corporation J2EE Web Component Introduction
Requirements To Design--Iteratively Chapter 12 Applying UML and Patterns Craig Larman.
1 Another group of Patterns Architectural Patterns.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Design Patterns Model – View – Controller. Copyright © 2001 DeLorme 28 November 2001 History ► A framework pattern for reusable applications. ► Depends.
MVC Design Pattern Web Developer at Crimshield, Inc Application Developer at IBM Present - Delta Developer at Tides.
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in.
WEP Presentation for non-IT Steps and roles in software development 2. Skills developed in 1 st year 3. What can do a student in 1 st internship.
Model View Controller MVC Web Software Architecture.
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.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
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.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
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.
SEA Side – Extreme Programming 1 SEA Side Software Engineering Annotations Architectural Patterns Professor Sara Stoecklin Director of Software Engineering-
L10: Model-View-Controller General application structure. User Interface: Role, Requirements, Problems Design patterns: Model – View – Controller, Observer/Observable.
ASP.NET MVC An Introduction. What is MVC The Model-View-Controller (MVC) is an architectural pattern separates an application into three main components:
Introduction to Model-View-Controller (MVC) Web Programming with TurboGears Leif Oppermann,
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Apache Struts Technology A MVC Framework for Java Web Applications.
Basics Components of Web Design & Development Basics, Components, Design and Development.
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
21-Jun-16 Swing Basics and Model-View- Controller.
Tutorial on Science Gateways, Roma, Riccardo Rotondo Portlet Framework: the Liferay way Liferay Service Builder, Portlet MVC.
Design Patterns Source: “Design Patterns”, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides And Created.
MVC and other n-tier Architectures
Building Web Applications with Microsoft ASP
Haritha Dasari Josue Balandrano Coronel -
CS5220 Advanced Topics in Web Programming Course Overview
Model-View-Controller Design Pattern
Design and Maintenance of Web Applications in J2EE
CS102 – Bilkent University
Model-View-Controller Patterns and Frameworks
Lecture 1: Multi-tier Architecture Overview
Model-View-Controller
WPS - your story so far Seems incredible complicated, already
CS5220 Advanced Topics in Web Programming Course Overview
Presentation transcript:

Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture

The hard problem in Object-Oriented 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. Design Patterns 2

First Appeared Formally in: “A cookbook for using the model-view controller user interface paradigm in Smalltalk- 8” by Glenn E. Krasner and Stephen T. Pope Journal of Object-Oriented Programming, 1(3):26-49 August/September 1988 The MVC pattern 3

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 components of program. The MVC pattern 4

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, etc. The Model 5

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, etc. The Model 6

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 Controller 7

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. The View 8

Architecture Diagram 9 View model representation Model business logic Controller user interaction UpdateEvent User Actions SetState Get State Change 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! Combining Controller and View 10

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 Separation of concerns 11

Model Domain objects – map to database tables. Constraints - validate fields and order the view. Dynamic - change domain - changes database. Dynamic Finders - not static - automatically generated from finder method name - v.cool. View Template to display domain objects. Can use gsp, jsp or html. Tag libraries - easy to use - can change dynamically. Controller Decides what to do when a view submits and action to the server. “Flash” feature - for messages in the view. Model View Controller in Grails 12

Separation between the data layer and the interface is the key: The view is easily replaced or expanded. Model data changes are reflected in all interfaces because all views are Observers. Better scalability since UI and application logic are separated. Distribution over a network is greatly simplified. Advantages 13

Modularity ▫ decoupling components ▫ allows each component to be versioned independently ▫ worked on by individuals on team (UI person, DB person, etc) Flexibility ▫ multiple Views for one Model (web frontend, desktop frontend, mobile frontend, etc) ▫ replace one component (replace data storage from flat file to database) Maintainability ▫ only change one component where bug exists, less risk in late changes Testability ▫ each component communicates through contract so each component can be unit-tested independently Advantages 14

Spreadsheet application (classic) ▫ same data (model) spreadsheet can have multiple charts (views) ▫ updating spreadsheet should result in updated charts ▫ example of multiple views, single controller, single model Scaling an application ▫ view is desktop or web, model is a flat-file database ▫ updating the database to clustered set of SQL servers ▫ only model needs to take changes for architecture, controller connects to new model and doesn’t know that the model is now backed by several DBs instead of one file Multiple user interfaces to application ▫ web interface, mobile phone interface, point-of-sale interface, desktop interface ▫ multiple views, multiple controllers, single model Example Scenarios 15

GUI Frameworks for desktop applications ▫ Application Kit – part of Cocoa for OS X desktop apps ▫ GTK+ - part of GTK libraries, used in lots of apps ▫ Microsoft Foundation Classes (MFC) – Document/View Architecture ▫ Java Swing ▫ Windows Presentation Framework (WPF) ▫ TK Toolkit – part of Tcl/Tk Implementations of MVC in web-based frameworks ▫ ASP.NET MVC Framework (.NET) ▫ ProMesh.NET (.NET) ▫ Grails (Java) ▫ Struts (Java) ▫ Spring (Java) ▫ PureMVC (JavaScript) ▫ Ruby on Rails (Ruby) ▫ Zend Framework (PHP) ▫ Django (Python) ▫ Pylons (Python) Modern Implementations 16