Software Design 8.1 Model, View, Controller: battleship l Who does what, where are responsibilities in MVC?  This is a pattern, so there's isn't "one.

Slides:



Advertisements
Similar presentations
Understanding an Apps Architecture ASFA Computer Science: Principles Fall 2013.
Advertisements

Playing Tic Tac Toe with Neural Networks Justin Herbrand CS/ECE/ME 539.
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
Week 8, Class 3: Model-View-Controller Model-View-Controller Why? What? How? Example: Barnyard Simon for the Web Question: Where should we use the command.
MVC Nick Lopez Duplication of course material for any commercial purpose without the explicit written permission of the professor is prohibited.
Chapter 25 GRASP: More Objects with Responsibilities 1CS6359 Fall 2011 John Cole.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
Model View Controller (MVC) Architecture. Terminology and History MVC evolved from Smalltalk-80 Has become a key pattern in web based applications – If.
Adding the Detail Filling in Use Case Templates. Use Case Template The use case diagram is important for visualizing a system and as a communication tool.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Chapter 25 More Design Patterns.
MVC pattern and implementation in java
State Diagrams / System Sequence Diagrams (SSDs)
MVC and MVP. References enter.html enter.html
March 7, 2005MOBIKE WG, IETF 621 Mobility Protocol Options for IKEv2 (MOPO-IKE) Pasi Eronen.
Object Oriented Analysis and Design Introduction.
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Artificial Intelligence in Game Design
Design Document Presentation. Review Quoridor – a board game played on a grid where players must advance tokens across a board to win. Our basic objective:
Putting together a complete system Chapter 10. Overview  Design a modest but complete system  A collection of objects work together to solve a problem.
Process Improvement with Solitaire Using the PC Solitaire game to learn basic (and advanced) techniques of Process Improvement (So easy, even a can do.
Software Design 4.1 Tell, Don't Ask l Tell objects what you want them to do, do not ask questions about state, make a decision, then tell them what to.
CS 4730 Action vs. Interaction CS 4730 – Computer Game Design Credit: Several slides from Walker White (Cornell)
Software Design 9.1 From Using to Programming GUIs l Extend model of "keep it simple" in code to GUI  Bells and whistles ok, should be easy to use and.
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.
The Design of Everyday Things Darn these hooves! I hit the wrong switch again! Who designs these instrument panels, raccoons?
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
CPS 108/ola.1 From XP to javax.swing.* l What parts of embracing change can we embrace in 108?  Evolutionary design, small releases, iterative enhancement.
Creating Macros in Excel Adding Automated Functionality to Excel & Office Applications.
Software Design 5.1 From Using to Programming GUIs l Extend model of "keep it simple" in code to GUI  Bells and whistles ok, but easy to use and hide.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many of others 1.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 31. Review Creational Design Patterns – Singleton Pattern – Builder Pattern.
The Strategy Design Pattern © Allan C. Milne v
Dr Nick Mitchell (Room CM 224)
Project JETT/Duke 1 javax.swing, events, and GUIs l GUI programming requires processing events  There’s no visible loop in the program  Wire up/connect.
Stéphane Ducasse 1 Strategy.
MVC COMP 401 Fall 2014 Lecture 19 10/30/2014. Classic MVC 2
Model View Controller (MVC) an architecture Rick Mercer with help from many of others 1.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Troops and Flags Graduate Group #1 Introduction to Game Design and Development 12/10/2007.
L10: Model-View-Controller General application structure. User Interface: Role, Requirements, Problems Design patterns: Model – View – Controller, Observer/Observable.
CPS Backtracking, Search, Heuristics l Many problems require an approach similar to solving a maze ä Certain mazes can be solved using the “right-hand”
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
Duke CPS Programming Heuristics l Identify the aspects of your application that vary and separate them from what stays the same ä Take what varies.
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
Object Oriented programming
Where are we ? Setup Sprites Input Collision Drawing Sprites
Strategy Pattern Jim Fawcett CSE776 – Design Patterns Fall 2014.
CSE 333 – Section 4 HW3, MVC, GTK+.
Introduction to Design Patterns
Behavioral Design Patterns
CO6025 Advanced Programming
Fight Game Brian Kessler.
Presented by Igor Ivković
Design and Maintenance of Web Applications in J2EE
Informatics 43 – May 26, 2016.
SE2811 Software Component Design Dr. Rob Hasker
Design pattern Lecture 9.
Strategy Design Pattern
Planning and Storyboarding a Web Site
SE2811 Software Component Design Dr. Rob Hasker
Model-view-controller
Presented by Igor Ivković
CS 5010 Program Design Paradigms "Bootcamp" Lesson 12.1
MVC overview Model, View, Controller is MVC
HFOOAD Chapter 5 Interlude
Strategy Pattern Jim Fawcett CSE776 – Design Patterns Fall 2014.
Presentation transcript:

Software Design 8.1 Model, View, Controller: battleship l Who does what, where are responsibilities in MVC?  This is a pattern, so there's isn't "one right way" l Model encapsulates state and behavior for game  Holds boards, interprets shots, game over, …  What other behavior responsibilities?  When model changes, it notifies the view l View shows boards, accepts mouse and other input  These inputs must be forwarded to model, how?  Sometimes via controller, often view/controller same

Software Design 8.2 How do we use a view? l The view knows about model (controller in battleship)  In battleship.cpp, view constructed with the model l The model (controller) knows about the view  Why can't this happen at model construction time?  How does this happen in battleship.cpp?  What are alternatives (what if client-code "forgets"?) l Hollywood principle for OO/MVC  Don't call us, we'll call you  The view calls the model when things happen  The model reacts and updates the view, repeat

Software Design 8.3 Sequence Diagram l Function calls over time l Click is mapped to call  Model called  Mouse->board coord l Model interprets shot  Responds to view  What happens next? l How is "turn-taking" enforced  Shot already taken?  Next player to move?  Other possibilities?

Software Design 8.4 Separate control/model? l Typically the control is not associated with the model  What is the model for battleship? Boards? Players?  Why is a separate control a good idea? l Toward network play  What does the controller do? Player interpretation?  Player x "goes", what happens next?  What are responsibilities of player?  What sequence of calls envisioned l What is right interface for model? For Controller?  How do they know about each other? Associations?

Software Design 8.5 Placing Ships l How are rules for placing ships enforced?  What happens in current version?  Who is responsible for constraints on placement?  How do we allow for alternative scenarios? l Strategy Design Pattern useful when:  Need variants of an algorithm  Clients shouldn't know about algorithm  Configure class with different behaviors l What does ShipPlacementStrategy need?  How to determine if a ship placement is ok?

Software Design 8.6 How does Strategy access ships? l Model can pass all ships to strategy  What does strategy really need to determine if a placement is ok?  Just ships? Other data? l Model can pass itself to strategy  Why might this be better?  Downside to passing the model? l Worth doing in battleship example?

Software Design 8.7 Dummy model/controller l See pingcontroller.cpp  Echo/ping controller to show how MVC works l Simple version of a model that echos commands  Shot at? Here's the shot  Ship placed? Here's the ship l How do alternate play?  Where are players?  Other issues?