Hi Rasa Team & Contributors,
We are Team Error 404, a group of students from Iowa State University currently enrolled in Software Architecture and Design (SE 309). We’ve spent the past few weeks diving into Rasa’s codebase—analyzing it through the lens of Domain-Driven Design (DDD), SOLID principles, and software architecture patterns.
We greatly admire the clean modular structure Rasa maintains across major components like NLU, Core, and the Action Server. However, we found an area that could benefit from a refactor: the train()
function in model_training.py
.
Summary of Findings
Current Issues in train()
:
- Violates Single Responsibility Principle (SRP): Handles data loading, training logic, CLI outputs, and decision-making in one place.
- Violates Dependency Inversion Principle (DIP): Directly calls concrete utils and config loaders.
- Crosses Bounded Contexts: Mixes NLU, Core, and infrastructure concerns.
Proposed Refactor
Goals:
- Respect DDD boundaries between NLU, Core, and config
- Improve testability, maintainability, and modularity
- Prepare the codebase for future enhancements (e.g., separate training modules)
Key Changes
def load_training_data(…): …
def determine_training_type(…): …
def train(…): file_importer = load_training_data(…) training_type = determine_training_type(file_importer) …
This allows train()
to act as an orchestrator, delegating tasks to domain-specific helpers.
Benefits
- Modular: Easier to evolve each piece independently.
- Testable: Helpers can be unit tested in isolation.
- Clean: Improves code readability for new contributors.
- DDD-Aligned: Respects aggregate boundaries between NLU/Core logic.
We’d love feedback from Rasa maintainers and the community before moving forward with a draft PR. Are there edge cases, testing concerns, or potential regressions we should consider? Is there an existing design doc or related effort we should align with?
Thanks again for the amazing work on Rasa—it’s been a great system to study and learn from.
Looking forward to your thoughts!
— Team Error 404 Iowa State University – SE 309 Software Architecture & Design