The topic, of course, is not new, and a lot has already been said and written on this score. But still I will share my view on this matter, tk. my awareness of this fact was formed rather independently and on the basis of my own experience, values ββand views, and perhaps (hopefully) in it the reader will find something fresh or useful for himself.
Flux is not something new or revolutionary at all.
It's not that I don't like him for that. Rather, there is even nothing wrong with it - if the solution is good and time-tested, is it really bad? Rather, I'm just surprised to hear how the approach implemented in Flux in general (and in Redux in particular) is tried by some to pass off as something innovative and revolutionary. And the solution itself, in my opinion, is at least not without its drawbacks. But more on that later, but for now I will remember my youth.
In the early 2000s, I developed software and component libraries in Delphi for Windows (first Win9x, then XP). In Windows operating systems, from the very first, if I'm not mistaken, versions, there is a concept of a window for visual interface elements (buttons, input fields) - yes, a window is not only something with a frame, almost any visual control had its own window. In this case, a window is a structure in memory that has an associated identifier (window handle) and a window function (see below). If we want to perform any action on an element, for example, to change the text of a button, we must pack this action into a special message structure (Window message) and send it to the appropriate window. The structure consists of an encoded message type (for example, WM_SETTEXT - to set the text) and the payload itself.Once sent, the message does not go directly to the handler - instead, it goes to the queue, from which some dispatcher retrieves it and calls the window function of the window to which we sent the message, passing it as a parameter. In the simplest case, a window function is a large switch, where, depending on the type of message, we transfer control to a more specific handler. Doesn't it look like anything?
. WinAPI . , Redux, .
"Low coupling, high cohesion"
, , - , / . . - . "Low coupling, high cohesion" " ", , , SOLID- Design Pattern " ".
Redux - , , - Low cohesion High. , , . Low Coupling , . Java-, - (Bean) - , , - , , , , - .
Boilerplate
, Redux . , , . , , , , . , , , , - .
, Redux , - , Angular (angular-redux, NgRx). Redux State, React.js , . Angular , Injectable- . , ( )?
, Redux , .
In conclusion, something good should be noted. Let's say it's not so bad when you have a large team of developers of different levels, and everyone writes code that everyone understands in approximately the same style without inventing anything. If otherwise such a motley team will not be able to work effectively, then the game is definitely worth it. But in fact, I would like to have a simple and effective solution, devoid of the above disadvantages. Context API? May be.