2016年3月2日 星期三

Why I No Longer Use MVC Frameworks 



 In traditional MVC, the action (controller) would call an update method on the model and upon success (or error) decide how to update the view


The SAM pattern can be represented by the following expression:
         V = S( vm( M.present( A(data) ) ), nap(M))
which stipulates that the view V of a system can be computed, after an action A has been applied, as a pure function of the model.

In SAM, A (actions), vm (view-model), nap (next-action predicate) and S (state representation) are and must all be pure functions. With SAM, what we commonly call the “state” (the values of the properties of the system) is entirely confined to the model and the logic that changes these values is not visible outside the model itself. 







The SAM pattern changes completely the paradigm of front-end architectures because, on the foundation of TLA+, the business logic can be clearly delineated into:
  • Actions as pure functions
  • CRUD operations in the model
  • States which control automatic Actions

沒有留言:

張貼留言