“That’s one small step for a man, one giant leap for mankind.” Neil Armstrong, astronaut
«Это один маленький шаг для человека и огромный скачок для человечества». Нил Армстронг, астронавт
Chris Hadfield demonstrates how astronauts wash their hands in zero-g
According to both MVC and MVP the presentation layer consists of view objects, and application logic consists of controller objects (we will use “controller” name instead of “presenter” in MVP). For each view object a corresponding controller exists and vice versa. And although MVC and MVP are based on a common 3-tier principle: views process only presentation needs and controllers handle application logic, these patterns have two major differences:
- In MVC controllers receive and process user input, but in MVP views receive user input and then merely delegate processing to the corresponding controllers. That is why MVP pattern better fits modern UI environments (Windows/Web forms) where view classes themselves handle user gestures.
- In MVC controllers affect their views by changing the intermediate presentation model, which the views are subscribed to (by observer pattern). This makes views pure observers without direct access to them. MVP on the other hand violates this “pure observer” rule by providing a direct link from a controller to its view. This makes MVP more handy as compared to MVC.
Continue reading MVC MVP
int NumberOfSetBits(int i)
i = i - ((i >>> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
return (((i + (i >>> 4)) & 0x0F0F0F0F) * 0x01010101) >>> 24;
ReportMemoryLeaksOnShutDown := True;