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
Copy file name to clipboardExpand all lines: docs/decisions/0002-feature-based-application-organization.rst
+5-5
Original file line number
Diff line number
Diff line change
@@ -75,11 +75,11 @@ This section details a specific taxonomy and hierarchy to help make code modular
75
75
In order to isolate our view layer (React) from the management of our data, global state, APIs, and side effects, we want to adopt the "ducks" organization (see references). This involves isolating data management into a
76
76
sub directory of a feature. We'll use the directory name "data" rather than the traditional "ducks".
77
77
78
-
**C. React components will be named semantically.**
78
+
**B. React components will be named semantically.**
79
79
80
80
The convention for React components is for the file to be named for what the component does, so we will preserve this. A given feature may break up its view layer into multiple sub-components without a sub-feature being present.
81
81
82
-
**B. Files in a module's data directory are named by function.**
82
+
**C. Files in a module's data directory are named by function.**
83
83
84
84
In the data sub-directory, the file names describe what each piece of code does. Unlike React components, all of the data handlers (actions, reducers, sagas, selectors, services, etc.) are generally short functions, and so we put them all in the same file together with others of their kind.
85
85
@@ -99,7 +99,7 @@ In the data sub-directory, the file names describe what each piece of code does.
99
99
100
100
If you find yourself desiring to have multiple files of a particular type in the data directory, this is a strong sign that you actually need a sub-feature instead.
101
101
102
-
**C. Sub-features follow the same naming scheme.**
102
+
**D. Sub-features follow the same naming scheme.**
103
103
104
104
Sub-features should follow the same rules as any other module.
105
105
@@ -147,7 +147,7 @@ As described above in "Avoid circular dependencies", features should not import
147
147
148
148
The feature may only import from the exports of its child, which may include exports of the grandchildren. Importing directly from grandchildren (or great grandchildren, etc.) would violate the strict module boundary of the child.
149
149
150
-
**II. Features may import from their siblings.**
150
+
**III. Features may import from their siblings.**
151
151
152
152
It's acceptable to import from a module's siblings, or the siblings of their parents, grandparents, etc. This is necessary to support code re-use. As an example, assume we have a sub-module with common code to support our web forms.
153
153
@@ -160,7 +160,7 @@ It's acceptable to import from a module's siblings, or the siblings of their par
160
160
161
161
The sub-form modules can import from forms-common-code. The latter has its own strict module boundary and could conceptually be extracted into its own repository/completely independent module as far as they're concerned. They're unaware, conceptually, that it's a child of feature1, and they don't care.
162
162
163
-
**III. Features may import from the siblings of their parentage.**
163
+
**IV. Features may import from the siblings of their parentage.**
164
164
165
165
This is less intuitive, but is not really any different than the above.
0 commit comments