How krawmire/profitocracy-maui works
Main Components
• Mobile UI Layer (Profitocracy.Mobile): This is the presentation layer handling all user interactions. It includes platform-specific configurations and pages (for Android, iOS, Windows, etc.), view models, and services (e.g., for currency, theme, and localization). The UI layer uses XAML pages, code-behind, and supports multi-platform builds.
• Domain Core (Profitocracy.Core): This layer contains the business logic, modeled with DDD. It includes domain models for Profiles, Categories, Transactions, Settings, and Summaries. It also defines abstractions (interfaces for calculation, profile, and category services), factories to build domain objects, and shared kernel objects (like AggregateRoot, Entity, and ValueObject). All the core business rules and calculations are encapsulated here.
• Infrastructure (Profitocracy.Infrastructure): This layer provides persistence and data handling implementations. It includes repositories (like ProfileRepository, CategoryRepository, etc.), mappers for translating between domain models and persistence models, and configuration files specifically for SQLlite persistence. This layer implements interfaces defined in the core and ties the business logic to actual storage mechanisms.
• Project Setup & Documentation: The solution file (Profitocracy.sln), documentation assets, and configuration files provide additional context for deployment and integration.
Out Relationships and Interactions
• The Mobile UI layer interacts with the Domain Core via service calls. For example, view models communicate with the CalculationService, ProfileService, and CategoryService to process user actions.
• The Domain Core layer relies on abstractions and interfaces which are implemented in the Infrastructure layer. The repositories (IProfileRepository, ICategoryRepository, etc.) abstract the persistence details, allowing business logic to work agnostic of the data store.
• Dependency inversion is employed so that the Domain defines interfaces and the Infrastructure provides concrete implementations (e.g., for SQLlite data persistence).
• The application leverages dependency injection (configured likely in MauiProgram.cs and related initialization classes) to wire up these relationships dynamically at runtime.
• The persistence layer (Infrastructure/Sqlite) contains mappers that convert domain objects to and from SQLlite models.
Architectural Patterns and Design Principles
• Domain-Driven Design (DDD): Separate domain logic from persistence and presentation. Domain models, factories, and value objects are located within Profitocracy.Core.
• Repository Pattern: Abstracts data access through defined interfaces in the core and implemented in the infrastructure layer.
• Dependency Injection: Using configuration files and registries (e.g., CoreRegistry.cs, InfrastructureRegistry.cs) to manage dependencies.
• Multi-layered Architecture: Clear separation between Mobile (Presentation), Core (Business Logic), and Infrastructure (Data Access).
• Factories and Value Objects: Use of factories (e.g., CategoryFactory, ProfileBuilder) ensures that object construction is centralized and encapsulated.
Technologies and Frameworks
• .NET / C# as the primary programming language.
• .NET MAUI for the mobile application.
• SQLlite for local data storage.
• Design patterns like Repository, Dependency Injection, and Domain-Driven Design are vital to the architectural foundation.