MVC (Model-View-Controller) 是一种架构模式,将应用程序分离为三个部分——Model(数据/逻辑)、View(UI/表现)和 Controller(处理输入、协调)——促进关注点分离。这是一个基础模式,有许多变体(MVP、MVVM)。
三个组件
MODEL → data and business LOGIC (the core: data, rules, state) — independent of the UI
VIEW → the UI/PRESENTATION (displays data to the user) — what the user sees
CONTROLLER → handles user INPUT, coordinates between Model and View (processes requests,
updates the model, selects the view)
→ SEPARATION: data/logic (Model) ≠ presentation (View) ≠ input handling (Controller)
