Understanding Parent and Child Modules in Trongate
The Trongate framework introduces the concept of Parent and Child Modules, a powerful feature that allows for modular and hierarchical organization of application components. This architecture enables developers to create complex, nested module structures, enhancing code reusability and maintaining a clean, organized codebase.
Key Concepts
- Parent Module: A module that contains one or more child modules.
- Child Module: A module that is nested within a parent module.
This hierarchical structure allows for the creation of self-contained, feature-rich components that can be easily integrated into Trongate applications.
Structuring Parent and Child Modules
When working with parent and child modules in Trongate, it's essential to understand the proper directory structure and naming conventions.
Directory Structure
modules/
├── parent_module/
│ ├── controllers/
│ ├── assets/
│ ├── views/
│ └── child_module/
│ ├── controllers/
│ ├── assets/
│ └── views/
In this structure, the child module is a subdirectory within its parent module, maintaining its own truly modular structure.
Naming Conventions
When referencing child modules, use the format: parent_module-child_module
. This convention is crucial for proper routing and module loading.