understanding mvc design

12
+ Thyda ENG, Software Developer Understanding The MVC Design

Upload: instedd-ilab-southeast-asia

Post on 15-Jul-2015

162 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Understanding MVC Design

+

Thyda ENG, Software Developer

Understanding The MVC Design

Page 2: Understanding MVC Design

+What is MVC ?

■ is stand for Model View Controller.

■ is the software architecture commonly used for creating web applications or software.

1

www.ilabsea.org | @ilabsea

Page 3: Understanding MVC Design

+Components

2

www.ilabsea.org | @ilabsea

Page 4: Understanding MVC Design

+Controller

■ It is a link between a user and the system, middle man.

■ Manages the user request when the user click on GUI of the system

3

Controller

www.ilabsea.org | @ilabsea

Page 5: Understanding MVC Design

+Controller

View

Controller

Model

receives data from the view, via user inputuses the right model

determine which action needs to be taken

load the view

4

www.ilabsea.org | @ilabsea

Page 6: Understanding MVC Design

+Model

■ represents the knowledge.

■ is the data and the rules applying to that data.

■ a model could be an object.

5

www.ilabsea.org | @ilabsea

Page 7: Understanding MVC Design

+Model

View

Controller

Model

receives instruction via the controller and work with data

return data to the controller

6

www.ilabsea.org | @ilabsea

Page 8: Understanding MVC Design

+View

■ present the data receive from controller.

■ provides the different ways to present the data.

■ is the template that contains the markup of page.

7

view

Page 9: Understanding MVC Design

+View

View

Controller

Model

works with the controller directly to retrieve the data

display the content retrieved by the controller

is the GUI that enable the user to interact with the system

8

Page 10: Understanding MVC Design

+MVC Diagram

View

Controller

Model

3. return the result to controller

4. controller get the information requested and send back to the user with appropriate view

1. user input some action, perhaps from a form or by clicking a button.

2. determines what to do with the data the user input from the view, and send it to the right model.

9

www.ilabsea.org | @ilabsea

Page 11: Understanding MVC Design

+Advantages

■ turn an application into a maintainable, modular and rapidly developed package.

■ clear separation of presentation and application logic.

■ reduces the complexity when designing large application.

10

www.ilabsea.org | @ilabsea

Page 12: Understanding MVC Design

+Example

View

Controller

Model

11

are pages for view books, register, buy, add items

contains actions such as: view books, register, buy, add items

handle data and logic related to the items in the shop

Develop the online book store

www.ilabsea.org | @ilabsea