MVC Pattern

김지영·2022년 5월 23일
0

MVC (Model-View-Controller)

  • implements UI, data, and controlling logic
  • Goal: to decouple models (M) and views (V)
    - so that we can increase maintainability/testability of system

Three parts of the MVC pattern:
1. Model
2. View
3. Controller

1. Model

  • contains application data
    - often persisted to a backing store
  • doesn't know how to present itself
  • domain-independent
  • (in the Observer pattern:) models are often Subjects

2. View

  • presents the model to the user
  • allows the user to manipulate the data
  • doesn't store data
  • configurable to display different data

3. Controller

  • glues model & view together
  • when the Model changes, the Controller updates the View
  • when the user manipulates the View, the Controller updates the Model
  • houses the application logic
  • loose coupling between the Model and others
  • View is tightly cohesive w/ its Controller

profile
아줌마

0개의 댓글