Presentation is loading. Please wait.

Presentation is loading. Please wait.

Model View Controller Development architecture. MVC Model: the classes encapsulating the functionality of your app View: what the user sees and interfaces.

Similar presentations


Presentation on theme: "Model View Controller Development architecture. MVC Model: the classes encapsulating the functionality of your app View: what the user sees and interfaces."— Presentation transcript:

1 Model View Controller Development architecture

2 MVC Model: the classes encapsulating the functionality of your app View: what the user sees and interfaces with Controller: middleman between view and model

3 MVC  Model does not talk to the View directly When the View changes (via an event from the user for example), the Controller can update the Model When the Model changes (via some computation, for example), the Controller can refresh the View

4 MVC – Why? Separate User Interface and functionality Clean design Easier to modify your project Easier to work as a group or team Easier to separate the expertise of people (coding, graphics,..)

5 MVC – Tic Tac Toe X XO O

6 What will be in the View? 9 buttons that the user will interact with Other things (labels) to tell the user what is going on (anybody won? ) and give some feedback (cannot play here,..)

7 MVC – Tic Tac Toe What will be in the Model? i.e. how can we represent the Tic Tac Toe game in a class? Natural instance variable = 2-dim array of 3 rows and 3 columns Whose turn is it to play?

8 MVC – Tic Tac Toe What else will be in the Model? i.e. how can we represent playing Tic Tac Toe in a class? Functions to play, enforce the rules, update the 2-dim array, determine whose turn is it to play, if the game is over, if somebody won,..

9 MVC – Tip calculator TipCalculator class Instance variables, init method, accessors, mutators, methods to calculate tip, tip per guest, total bill,..


Download ppt "Model View Controller Development architecture. MVC Model: the classes encapsulating the functionality of your app View: what the user sees and interfaces."

Similar presentations


Ads by Google