You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A component always consists of at least four classes: a `Component`, a `ComponentView`, a `ComponentViewModel`
134
-
and `ComponentMediator`. A natural question might arise: why is there no `Model` in the component, given that
135
-
the pattern is called MVVM?
136
-
137
-
Firstly, a component is a building block for constructing a user interface, which might not be related to the
138
-
application's business logic at all. Secondly, the `Model` exists independently of the UI and should have no knowledge
139
-
of the component's existence. Thirdly, MVVM is fundamentally about the separation of responsibilities rather than
140
-
the mandatory presence of all three layers in every element. In other words, a component does not violate MVVM
141
-
principles simply because it lacks a `Model`; it remains compliant as long as the `View` and `ViewModel` maintain a
142
-
clear separation of concerns and communicate exclusively through data binding and observable properties.
134
+
and `ComponentMediator`:
135
+
136
+
<imgwidth="1013"height="460"alt="Screenshot from 2025-12-19 17-19-38"src="https://github.com/user-attachments/assets/00bbbb5e-9092-4752-8954-c9b8da184ca3" />
137
+
138
+
A natural question might arise: why is there no `Model` in the component, given that
139
+
the pattern is called MVVM? Firstly, a component is a building block for constructing a user interface, which might
140
+
not be related to the application's business logic at all. Secondly, the `Model` exists independently of the UI and
141
+
should have no knowledge of the component's existence. Thirdly, MVVM is fundamentally about the separation of
142
+
responsibilities rather than the mandatory presence of all three layers in every element. In other words, a component
143
+
does not violate MVVM principles simply because it lacks a `Model`; it remains compliant as long as the `View` and
144
+
`ViewModel` maintain a clear separation of concerns and communicate exclusively through data binding and observable
145
+
properties.
143
146
144
147
The `ComponentView` and `ComponentViewModel` classes correspond to the `View` and `ViewModel` in the MVVM pattern and
145
148
are relatively straightforward. The `Component` and `ComponentMediator` classes, on the other hand, address the
0 commit comments