How ip25-solutions/quickcalculator works
Project’s Main Components
• UI / Presentation Layer:
• This is implemented in the "app/src/main/java/com/ipsolutions/quickcalculator/presentation" directory (e.g., MainScreen.kt) along with the UI styles under "ui/theme". The UI leverages Jetpack Compose.
• Business Logic / ViewModel:
• While the file structure does not have an explicit "viewmodel" folder, the "logic" directory (e.g., CalculatorEstate.kt) appears to handle state management and logic that sits between the UI and core computational components.
• Core / Domain Layer:
• The "core" directory (e.g., Calculator.kt) encapsulates key functionalities. These files contain the fundamental operations and possibly core business rules or algorithms.
• Evaluation Component:
• As cited in the README, JavaScript (via the ScriptEngineManager) is used to evaluate mathematical expressions, so include an evaluation engine component that interacts with the core logic.
• Android System Components:
• AndroidManifest.xml, resource directories (res for UI layouts, images, themes, etc.), and configuration files that are essential for app initialization and styling.
• Testing Components:
• Existence of both instrumented tests ("app/src/androidTest") and unit tests ("app/src/test"), indicating a separation for verifying UI / integration aspects and core functionality.
Relationships and Interactions
• The UI components (the Compose screens and theme definitions) interact with the ViewModel (or logic layer) using the MVVM pattern.
• The ViewModel (or state/logic layer) orchestrates user interactions from the UI and communicates with the Core domain (Calculator operations).
• The Core component may also interface with the JavaScript evaluation engine to compute expressions.
• Testing layers interact with each of these components as separate units, ensuring modularity.
• Any build and deployment processes are managed via gradle scripts (build.gradle.kts, settings.gradle.kts) which are separate from runtime architecture but crucial for the build pipeline.
Architectural Patterns and Technologies
• MVVM: Enforce the separation between UI (View), logic/state management (ViewModel), and business rules (Model/Core).
• Jetpack Compose: Defines how UI elements are declared and updated.
• Kotlin: The core programming language throughout the project.
• JavaScript Evaluation: A specific sub-component (invoked via ScriptEngineManager) for handling mathematical expression parsing and evaluation.