How kotlincoimbatore/kotlin-basketball-scorer-app works
Project Type and Purpose
• This is a native Android mobile application written in Kotlin whose sole purpose is to track basketball scores in memory (no persistence layer).
• It follows the standard Android “app” module structure with a single Activity as the entry point.
File Structure
• Top-level files:
• settings.gradle, build.gradle, gradle wrapper → Gradle-based build system
• “app” module:
• src/main/java/.../MainActivity.kt → Application logic & entry point
• src/main/res/layout/activity_main.xml → UI definition
• src/androidTest → Instrumented UI tests
• src/test → Local unit tests
Extract Insights from the README
• “non data persistant” → no database or network layer
• Simple UI + in-memory state → small number of components
Main Components
a. Android Device / OS Layer
b. Android Runtime (ART / Dalvik VM)
c. App Module
• MainActivity (presentation & controller)
• UI Layout (activity_main.xml views: TextViews, Buttons)
• In-memory Score Model (e.g., integer counters in MainActivity)
d. Tests
• Unit Test Suite (JUnit classes in src/test)
• Instrumented Test Suite (Espresso tests in src/androidTest)
e. Build System (Gradle Wrapper & Plugin)
Relationships and Data Flows
• User taps button → Android OS dispatches event → MainActivity.onClick()
• onClick() updates Score Model → MainActivity updates UI via findViewById/Binding
• Gradle build → compiles Kotlin → dex → APK
• Unit tests run on the JVM; Instrumented tests run on Android emulator/device
Architectural Patterns & Design Principles
• Very simple MVC/MVP-style: Activity as Controller + View + in-memory Model
• Separation of concerns: UI XML vs. Activity logic vs. test code
• Build-time modularity: “app” module under Gradle
Detail Level
• Every folder of significance: src/main/java, src/main/res, src/test, src/androidTest
• Call out build.gradle and gradlew as part of your deployment/build pipeline
• Don’t over-decompose: separate the project into UI, logic, model, and tests