DOC PREVIEW
Duke CPS 100E - MVC: Model, View, Controller

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CompSci 100E8.1MVC: Model, View, Controllerÿ A model is the state and brains of a systemþ In a game it's all the pieces and where they areþ In a spreadsheet it's the data and the formulaeÿ The view is how we look at the modelþ Spread sheet has graphs, charts, cells, text, …þ Game has board, number of opponents, hit-points, …ÿ When the model changes, the views reflect the changesþ The model tells the views how/if it has changedþ Model sends information to views ORþ View asks model for informationCompSci 100E8.2MVC: interfaces and inheritanceÿ A model might have multiple viewsþ Tell all the views "I've changed"þ Who manages the views? This requires state: store viewsþ Why can't we keep this state in an interface?ÿ See IModel and AbstractModelþ One specifies behavior, the other provides defaultþ Don’t rewrite code if we don't have to, maintaining viewswill be the same for all modelsÿ See IView and SimpleViewþ No default/shared view state/behavior: text and GUICompSci 100E8.3Does SimpleViewer know Model?ÿ What does the SimpleViewer know about its model?þ If we look at code, is there any application-specific logic?þ What if we wanted to play a game, start a new game?ÿ Control in MVC with SimpleViewer and IModelþ Loading a file calls initialize()þ Entering text calls process()þ Model calls view with messages, errors, and complete updateÿ This isn't complete general, but it's pretty genericþ For this input, here's the outputCompSci 100E8.4Pixmap Assignmentÿ “Last” CompSci 6 Assignmentþ Lots has been done for youþ Mainly an exercise in working with 2 D infoÿ Not really MVCþ Doesn’t hurt to keep that model in mind, thoughÿ Lots of GUI stuffþ Graphical User Interface is not reall focus of this courseþ Just use what has been givenþ Become familiar with it by reading code, seeing resultsÿ Feel free to experimentCompSci 100E8.5Java Exceptionsÿ Many I/O operations can throw Exceptionsþ Code handles it for yourþ However, need to know what is going onþ (Review pages in Chapter 2)ÿ Catching Exceptionsþ Use try-catch blocktry {// statements that might generate exception}catch (exception_type var){// code that deals with exception}ÿ Method can pass on responsibility for exception with


View Full Document

Duke CPS 100E - MVC: Model, View, Controller

Documents in this Course
Topics

Topics

9 pages

Lecture

Lecture

3 pages

Notes

Notes

2 pages

Hashing

Hashing

19 pages

Lecture

Lecture

59 pages

Lecture

Lecture

6 pages

Lecture

Lecture

4 pages

Lecture

Lecture

20 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

7 pages

Lecture

Lecture

8 pages

Lecture

Lecture

10 pages

Lecture

Lecture

4 pages

Notes

Notes

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Lecture

Lecture

13 pages

Lecture

Lecture

6 pages

Lecture

Lecture

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

5 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

10 pages

Sets

Sets

14 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Test 1

Test 1

7 pages

Load more
Download MVC: Model, View, Controller
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view MVC: Model, View, Controller and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view MVC: Model, View, Controller 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?