diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-01-27 00:17:22 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-02-08 21:43:17 +0100 |
commit | 9546dc2aa39ab096ccc723786e718a739d0bdaf9 (patch) | |
tree | 9c3afc6155cc59f6dd1235397230aaa15a5f8cec /docs | |
parent | refactor: Apply shared store patches in batches (diff) | |
download | sophie-9546dc2aa39ab096ccc723786e718a739d0bdaf9.tar.gz sophie-9546dc2aa39ab096ccc723786e718a739d0bdaf9.tar.zst sophie-9546dc2aa39ab096ccc723786e718a739d0bdaf9.zip |
refactor: Coding conventions
Make sure that files have a default import with the same name as the
file whenever possible to reduce surprise.
Also shuffles around some file names for better legibility.
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/architecture.md | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/docs/architecture.md b/docs/architecture.md index 791b57b..b76b2ff 100644 --- a/docs/architecture.md +++ b/docs/architecture.md | |||
@@ -78,18 +78,15 @@ Any actions of the `RendererStore` that should affect the shared state have to g | |||
78 | To reduce the amount of code injected into service frames, service renderer processes contain no stores. | 78 | To reduce the amount of code injected into service frames, service renderer processes contain no stores. |
79 | Instead, they purely rely on IPC messages to invoke actions in the main process (but they are not notified of the result). | 79 | Instead, they purely rely on IPC messages to invoke actions in the main process (but they are not notified of the result). |
80 | 80 | ||
81 | ## Controllers | 81 | ## Reactions |
82 | 82 | ||
83 | In the main process, _controllers_ react to `MainStore` changes by invoking Electron APIs and subscribe to Electron events in order to invoke `MainStore` actions. | 83 | In the main process, _reactions_ react to `MainStore` changes by invoking Electron APIs and subscribe to Electron events in order to invoke `MainStore` actions. |
84 | 84 | ||
85 | For better testability, controllers may rely on _infrastructure services_ (wrappers) abstracting away the underlying Electron APIs. | 85 | For better testability, reactions may rely on _infrastructure services_ (wrappers) abstracting away the underlying Electron APIs. |
86 | Each infrastructure of the service has to come with a TypeScript interface and at least one implementation. | 86 | Each infrastructure of the service has to come with a TypeScript interface and at least one implementation. |
87 | In the tests, the default implementations of the interfaces are replaced by mocks. | 87 | In the tests, the default implementations of the interfaces are replaced by mocks. |
88 | 88 | ||
89 | The infrastructure services and controllers are instantiated and connected to the `MainStore` in the [composition root](https://gitlab.com/say-hi-to-sophie/sophie/-/blob/main/packages/main/src/init.ts). | 89 | The infrastructure services and reactions are instantiated and connected to the `MainStore` in the [composition root](https://gitlab.com/say-hi-to-sophie/sophie/-/blob/main/packages/main/src/init.ts). |
90 | |||
91 | **TODO:** | ||
92 | While a service is a common term in MVC application architecture, we should come up with a different name to avoid clashing witch services, i.e., web sites loaded by Sophie. | ||
93 | 90 | ||
94 | ## React | 91 | ## React |
95 | 92 | ||
@@ -101,7 +98,7 @@ We must take care not to render anything in this area, since it will be entirely | |||
101 | 98 | ||
102 | # Packages | 99 | # Packages |
103 | 100 | ||
104 | The code of Sophie is distirbuted between different Node packages according to how they are loaded into the application. | 101 | The code of Sophie is distributed between different Node packages according to how they are loaded into the application. |
105 | 102 | ||
106 | All packages except the renderer package are tree-shaken and bundled with [esbuild](https://esbuild.github.io/) for quicker loading. | 103 | All packages except the renderer package are tree-shaken and bundled with [esbuild](https://esbuild.github.io/) for quicker loading. |
107 | The web application in the renderer packages is tree-shaken and bundled with [vite](https://vitejs.dev/). | 104 | The web application in the renderer packages is tree-shaken and bundled with [vite](https://vitejs.dev/). |