@@ -22,15 +22,15 @@ All of them try more or less
2222* to decouple the "different things" (widgets, forms, business logic, ...) from each other
2323* make the "different things" easily testable (unit-testable)
2424* try to separate presentation from behaviour
25- * make the view easily "exchangeable" (e.g. replace Swing with JavaFX)
26- * concentrate the business logic into e.g. the "model ", which "lives longer" (in years) than the often changing GUI technologies
25+ * make the View easily "exchangeable" (e.g. replace Swing with JavaFX)
26+ * concentrate the business logic into e.g. the "Model ", which "lives longer" (in years) than the often changing GUI technologies
2727* ...
2828
2929When you develop a Java Swing GUI in practice, you face the following additional challenges
3030
31- * how to enforce the proper threading (view elements like JPanel, JButton, ... should be only accessed by AWT-EventDispatchThread)?
32- * how to keep the view "responsive" by kicking off background actions (-> SwingWorker, new Thread(...), ExecutorService, ...)?
33- * how to combine the results from multiple asynchronous actions (multiple SwingWorker's, Thread's, Future's, ...) into one result for the view ?
31+ * how to enforce the proper threading (View elements like JPanel, JButton, ... should be only accessed by AWT-EventDispatchThread)?
32+ * how to keep the View "responsive" by kicking off background actions (-> SwingWorker, new Thread(...), ExecutorService, ...)?
33+ * how to combine the results from multiple asynchronous actions (multiple SwingWorker's, Thread's, Future's, ...) into one result for the View ?
3434* how to implement Undo/Redo, Validation, Exception-Handling, Timeouts, ...?
3535* how to enforce acyclic relationships between "stuff" to get good (isolated) testability?
3636* how to deal with backpressure when e.g. the backend is too fast for the frontend and the GUI thread can't keep up?
@@ -72,7 +72,7 @@ image::MVVM_dependencies.png[]
7272
7373* The View "sees" the ViewModel
7474* The View "doesn't see" the Model
75- * The ViewModel "sees" the model
75+ * The ViewModel "sees" the Model
7676* The Model "doesn't see" the ViewModel and "doesn't see" the View
7777* We have acyclic dependencies
7878
@@ -181,7 +181,7 @@ link:./src/main/java/ch/petikoch/examples/mvvm_rxjava/example5[]
181181
182182* Same as Example 4
183183* You can cancel the submit processing
184- * The model has a classic "blocking" API
184+ * The Model has a classic "blocking" API
185185
186186image::example5.png[]
187187
@@ -194,7 +194,7 @@ link:./src/test/groovy/ch/petikoch/examples/mvvm_rxjava/example5[]
194194link:./src/main/java/ch/petikoch/examples/mvvm_rxjava/example5a[]
195195
196196* Same as Example 5
197- * The model has a "non-blocking" API, the ViewModel gets simpler
197+ * The Model has a "non-blocking" API, the ViewModel gets simpler
198198
199199Tests:
200200
@@ -205,7 +205,7 @@ link:./src/test/groovy/ch/petikoch/examples/mvvm_rxjava/example5a[]
205205link:./src/main/java/ch/petikoch/examples/mvvm_rxjava/example6[]
206206
207207* Same as Example 5a
208- * But with two model API calls running in two different threads
208+ * But with two Model API calls running in two different threads
209209* Waiting for both of them
210210* Cancellation for both of them
211211
@@ -215,12 +215,12 @@ Tests:
215215
216216link:./src/test/groovy/ch/petikoch/examples/mvvm_rxjava/example6[]
217217
218- === Example 6a: Form submit with exceptions in model (backend) calls
218+ === Example 6a: Form submit with exceptions in Model (backend) calls
219219
220220link:./src/main/java/ch/petikoch/examples/mvvm_rxjava/example6a[]
221221
222222* Same as Example 6
223- * But like in real world, there are sometimes exceptions during e.g. model (backend) method calls
223+ * But like in real world, there are sometimes exceptions during e.g. Model (backend) method calls
224224* How to handle them?
225225
226226This is of course a challenging task: +
@@ -240,8 +240,8 @@ link:./src/test/groovy/ch/petikoch/examples/mvvm_rxjava/example6a[]
240240
241241link:./src/main/java/ch/petikoch/examples/mvvm_rxjava/example7[]
242242
243- * The model publishes `LogRow` s (using a computational thread)
244- * These are added in the view as rows of a `JTable` (using GUI thread)
243+ * The Model publishes `LogRow` s (using a computational thread)
244+ * These are added in the View as rows of a `JTable` (using GUI thread)
245245
246246image::example7.png[]
247247
@@ -255,8 +255,8 @@ link:./src/test/groovy/ch/petikoch/examples/mvvm_rxjava/example7[]
255255link:./src/main/java/ch/petikoch/examples/mvvm_rxjava/example7a[]
256256
257257* Same as example 7
258- * But: The model 's log Observable sometimes fail
259- * We add some exception handling into the viewmodel , to keey the view alive
258+ * But: The Model 's log Observable sometimes fail
259+ * We add some exception handling into the ViewModel , to keep the View alive
260260
261261image::example7a.png[]
262262
@@ -269,8 +269,8 @@ link:./src/test/groovy/ch/petikoch/examples/mvvm_rxjava/example7a[]
269269
270270link:./src/main/java/ch/petikoch/examples/mvvm_rxjava/example8[]
271271
272- * The model uses a threadpool to create plenty of `LogRow` s (using as many threads as there are CPU cores)
273- * Since the view runs on a single thread, it can't keep up with the pace
272+ * The Model uses a threadpool to create plenty of `LogRow` s (using as many threads as there are CPU cores)
273+ * Since the View runs on a single thread, it can't keep up with the pace
274274** "Fast producer, slow consumer" kind of problem
275275* We need to think about backpressure
276276** We could slow down the `LogRow` production (blocking backpressure)
@@ -290,7 +290,7 @@ link:./src/main/java/ch/petikoch/examples/mvvm_rxjava/example9[]
290290* So far the views were very static
291291* Now we have structural changes at runtime, think of a wizard with it's steps
292292* Parts of the views remain static (header, footer)
293- * Therefore we need some kind of view composition
293+ * Therefore we need some kind of View composition
294294
295295image::example9.png[]
296296
0 commit comments