Skip to content

Commit 080c904

Browse files
docs: add model-based approach in rejected alternative
1 parent 6b8096d commit 080c904

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

docs/decisions/0003-runtime-architecture.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,12 @@ Within this ADR, the decisions have the following dependencies:
231231
Consequences
232232
************
233233

234-
**Plugin System and Extensibility:**
235-
236234
1. The stevedore-based plugin system enables third-party developers to extend grouping capabilities without requiring changes to core platform code, promoting ecosystem growth.
237235

238236
2. The plugin discovery mechanism creates a clear extension point for operators and third parties, encouraging the development of domain-specific criterion types.
239237

240238
3. The Django configuration-based backend registration system allows for flexible data source integration without core code modifications.
241239

242-
**Architecture and Performance:**
243-
244240
4. The centralized registry provides consistent criterion type resolution across the application while supporting dynamic discovery of new types.
245241

246242
5. The backend client abstraction enables integration with diverse data sources while maintaining clean separation between data access and evaluation logic.
@@ -255,8 +251,6 @@ Consequences
255251

256252
10. The rule tree construction and optimization enables complex boolean expressions to be evaluated efficiently, allowing for flexible grouping logic without sacrificing performance.
257253

258-
**Developer Experience and Validation:**
259-
260254
11. The orchestrator functions abstract runtime complexity and provide clear interfaces for developers while reducing the likelihood of incorrect direct registry or backend usage.
261255

262256
12. Schema-based validation ensures configuration correctness while enabling dynamic UI generation, improving both developer and operator experience.
@@ -268,6 +262,17 @@ Consequences
268262
Rejected Alternatives
269263
**********************
270264

265+
Overload Model Layer with Business Logic
266+
========================================
267+
268+
Another alternative for defining criterion types in the user groups project was a model-based approach, where each criterion type would be represented as its own Django model. This approach, while providing a clear separation of concerns and allowing for complex criterion type definitions, had several drawbacks that led to its rejection.
269+
270+
In this approach, each criterion type is represented as its own Django model, inheriting from a shared base class. These models define the fields required for their evaluation (such as a number of days, grade, etc) and include a method to return matching users. Evaluation is done by calling each model's method during group processing.
271+
272+
This approach was centered on relying on the model definition to handle business logic and evaluation, with the model layer responsible for both data structure and logic execution.
273+
274+
For more details on this approach, see the :doc:`0002-user-groups-model-foundations` ADR Rejected Alternatives.
275+
271276
Criterion-Owned Data Access
272277
===========================
273278

0 commit comments

Comments
 (0)