MVC CompSci 230 S2 2015 Software Construction. MVC Architecture  A typical application includes software to  maintain application data,  document text.

Slides:



Advertisements
Similar presentations
Michael Brockway Advanced Applications Development in Java Model-View-Controller Architecture l MVC Architecture l Delegate-Model Architecture l Observer.
Advertisements

Presented by Benjamin Kehrer [CSCI 360, CofC, 03/17/08]
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
COSC 3461: Module 8 Model-View-Controller (MVC) Architecture.
Model-View-Controller Architecture Hector Raphael Mojica.
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.
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
Model View Controller (MVC) Architecture. Terminology and History MVC evolved from Smalltalk-80 Has become a key pattern in web based applications – If.
Graphical User Interface (GUI) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Stanford hci group / cs376 research topics in human-computer interaction UI Software Tools Scott Klemmer 27 October 2005.
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
MODEL VIEW CONTROLLER A Technical Seminar Report submitted to
Chapter 13 Starting Design: Logical Architecture and UML Package Diagrams.
MVC pattern and implementation in java
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
MVC and MVP. References enter.html enter.html
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Model-View-Controller Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
(c) University of Washington08-1 CSC 143 Models and Views Reading: Ch. 18.
Swing, part 2 Tutorial 07 1 / 31 Leonid Barenboim 25/4/2010.
Chapter 6 – Architectural Design CSE-411, Dr. Shamim H Ripon.
Swing and MVCS CompSci 230 Software Construction.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
User Interface Programming in C#: Model-View-Controller Chris North CS 3724: HCI.
Hark the Sound Version 2 Meghan Dickenson Megan Dunigan Max Smolens Scott Weeks.
3461 Model-View Controller Advanced GUI concepts.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many others 1.
CPSC 372 John D. McGregor Module 3 Session 1 Architecture.
An Introduction to Programming and Object Oriented Design using Java 3 rd Edition. Dec 2007 Jaime Niño Frederick Hosch Chapter 18 Integrating user interface.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 35 MVC and Swing MVC.
1 Java Model-View-Controller - see programming.html#concepts.
CPSC 871 John D. McGregor Module 3 Session 1 Architecture.
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.
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style ADVANCED PROGRAMMING PRACTICES Model View.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
TK2023 Object-Oriented Software Engineering CHAPTER 8 LOGICAL ARCHITECTURE.
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 Architecture. 2 Give someone a program, you frustrate them for a day; teach them how to program, you frustrate them for a lifetime.
עקרונות תכנות מונחה עצמים תרגול 8: MVC. Outline  MVC  Using the default models  Example- File Browser.
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.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Java - hello world example public class HelloWorld { public static void main (String args[]) { System.out.println("Hello World"); }
Model View ViewModel Architecture. MVVM Architecture components.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Application architectures Advisor : Dr. Moneer Al_Mekhlafi By : Ahmed AbdAllah Al_Homaidi.
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.
1 Visual Basic: An Object Oriented Approach 7 – The User interface.
Programming Paradigms, Software Architectural Patterns, and MVC CS 378 – Mobile Computing for iOS Dr. William C. Bulko.
CompSci 230 S Software Construction
Design Patterns Source: “Design Patterns”, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides And Created.
CompSci 280 S Introduction to Software Development
Advanced Swing Lists.
CompSci 280 S Introduction to Software Development
Model-View-Controller Design Pattern
CS102 – Bilkent University
Model-View-Controller Patterns and Frameworks
Building Graphical User Interface with Swing a short introduction
עקרונות תכנות מונחה עצמים תרגול 8: MVC
Model-View-Controller
Starting Design: Logical Architecture and UML Package Diagrams
Professor John Canny Spring 2004 March 5
Model-view-controller
Model, View, Controller design pattern
Professor John Canny Spring 2003 March 12
Presentation transcript:

MVC CompSci 230 S Software Construction

MVC Architecture  A typical application includes software to  maintain application data,  document text in a word processor  state of a chess game -- positions of pieces  present output  outline view or print preview in a word processor  graphical view of chess game  process user input  key presses  mouse click on controls 132

Swing’s Model-based Architecture  “Swing architecture is rooted in the model-view-controller (MVC) design that dates back to SmallTalk.  “MVC architecture calls for a visual application to be broken up into three separate parts:  A model that represents the data for the application  The view that is the visual representation of that data  A controller that takes user input on the view and translates that to changes in the model.” [Amy Fowler, ibid.] 133

MVC: According to Wikipedia  A controller can send commands to the model to update the model's state (e.g., editing a document).  It can also send commands to its associated view to change the view's presentation of the model (e.g., by scrolling through a document).  A model notifies its associated views and controllers when there has been a change in its state.  This notification allows the views to produce updated output, and the controllers to change the available set of commands.  In some cases an MVC implementation may instead be 'passive' and other components must poll the model for updates rather than being notified.  A view requests information from the model that it uses to generate an output representation to the user. 134

Model-View-Controller (MVC) Data model Data displayUser input Model ViewController UI: Data: manipulate refresh events 135

Spaghetti Code vs Modular Design  Spaghetti Code  Haphazard connections, probably grown over time  No visible cohesive groups  High coupling: high interaction between random parts  Understand it: all or nothing  Modular System  High cohesion within modules  Low coupling between modules  Modules can be understood separately  Interaction between modules is easily-understood and thoroughly specified Both examples have 10 modules and 13 connections! 136

E.g. C# TreeView Control TreeView control Nodes collection treeView1.Nodes Java: model listeners Model View Controller 137

Multiple Views Model View Controller View Controller 138

Typical real-world approach  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! Data model Data displayData manipulation logic Model ViewController 139

E.g. C# TreeView Control TreeView control Nodes collection treeView1.Nodes Java: model listeners Model View Controller 1310

C# DataBase Controls DataSet class -tables -columns -rows DataGrid control -scroll, sort, edit, … Model View Controller DB 1311

MVC Example in Java  Example: JList  A javax.swing.ListModel is an object which maintains a list of objects: it knows how big the list is, which object is where in the list, etc, and can insert/remove objects  A javax.swing.JList is a graphical component giving a view of the list and able to receive user input to modify the list DefaultList Model Javax.swing. JList modifies notifies DefaultListModel > AbstractListModel > Javax.swing.ListModel isEmpty(): boolean getSize(): int addElement(Object) removeElement(Object) elementAt(): Object removeElementAt(int) insertElementAt(int) indexOf(Object): int etc JList Javax.swing.JComponent 1312