The document discusses the Flux application architecture and its similarities to and differences from MVC. Flux utilizes a unidirectional data flow and aims for predictability, a single source of truth for application data, and consistently displaying data on the UI. While Flux shares similarities with MVC in separating concerns into views, models, and controllers, it aims to improve on MVC with its unidirectional data flow and emphasis on predictability. The document also notes that concepts are more important than buzzwords when it comes to architectural patterns.
15. Bliki > Google
“Different people reading about MVC in different places take different
ideas from it and describe these as 'MVC’.”
- Martin Fowler
@duffleit@oetzn
34. Structure
• View → React
• Model → Store
• Controller → […]
Goals
• Unidirectionality
• Predictability
• Single Source of Truth
• Consistently Display Data
@duffleit@oetzn
We have at least one thing in common, we love React.
But what is React? It is just a tiny, but pretty cool library that provides support for rendering UIs from javascript.
And - it's great tooling, a fast growing commuity, and some very interesting concepts behind it.
<div>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
Independent from ReactJS
Can be used with angular for example
CLI
if you take redux and add a view library like react, you end up with the flux architecture pattern
Independent from ReactJS
Can be used with angular for example
CLI
if you take redux and add a view library like react, you end up with the flux architecture pattern
Important question is why did engineers at Facebook invent a new way of structuring UI-related code?
Why not make use of one of the existing patterns?
MVC did not scale.
Messenger problem.
MVC did not scale for them.
Very controversial statement.
After some research we discovered many differences in how MVC is described or explained.
So like every professional software engineer, we asked Google. And the result was not that helpful.
https://www.c-sharpcorner.com/article/introduction-to-Asp-Net-mvc/ (appearantly everyone is talking to everyone)
https://www.infoworld.com/article/2941414/microsoft-net/best-practices-in-asp-net-mvc.html (oh wait, the view is not talking to the controller?)
https://coldbox.ortusbooks.com/content/full/overview/what_is_mvc.html (who needs boxes and circles when you can have gears)
https://www.zkoss.org/wiki/ZK_Developer%27s_Reference/MVC (so now the database is the whole model, and gears again)
So, there seems to be some confusion around MVC. And of course, we were not the first to discover this.
So, there seems to be some confusion around MVC. And of course, we were not the first to discover this.
After digging not too long, we discovered that there is actually a paper from 1979 by a guy named Trygve Reenskaug that describes MVC. Anybody ever took a look at that?
Idea: consistently displaying data, separation of concerns (both things are kind of related to the problem stated before)
3 types of classes: models, views and controllers
Model: hold state, model the real world, ignorant of how it is displayed and interacted with, just provide the API
View: not the representation itself, take model and transform it into the presentation, “urgency level -> color”-mapping
Controller: take input, map to commands for the model
Let’s go on a journey through the evolution of web applications
In the beginning, there was no JavaScript
MVC on the server
Let’s go on a journey through the evolution of web applications
In the beginning, there was no JavaScript
MVC on the server
<div>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
Let’s go on a journey through the evolution of web applications
In the beginning, there was no JavaScript
MVC on the server
.setClass(„done“)
We you think about it, it is quite straight forward:
What parts do we need to cover?
Model
View
Controller
What is React doing?
What is the Redux Store doing?
Observer pattern -> dominant in MVC
Sidenote: Redux store is Subject/Obersable, View is Observer, like in the original Smalltalk implementation
Actually it's quite straight forward
React takes a Model and creates UI -> ViewPart
Where does the model come from? Redux Store
D: What is the controllers job?
Change the model based on user input
“This functionality is what MVC calls the controller”