When I first started working on Neurodoku, it was my very first Android side project. I wanted to learn about clean architecture, experiment with tools like KSP, and just have fun building something that worked.
And it did — at least in the beginning.
But Neurodoku didn’t start as a polished, perfect Sudoku app. In fact, the first version was complete chaos. It was built around a single Main Activity, without any proper architecture or navigation. The UI, logic, and data all lived in one place. No separation of concerns. No testability. No scalability.
It worked — for exactly one feature: solving Sudoku puzzles.
But as soon as I tried to add more — a timer, notes mode, hint system, or even dark mode — things started falling apart. The codebase simply couldn’t handle it.

Red Flags That Made Refactoring Inevitable
Here’s what made me realize it was time to rebuild the app from scratch:
- One Activity to Rule Them All: Every responsibility — UI, logic, state — lived in one bloated Main Activity.
- No Architecture = No Flexibility: There was no clean way to introduce features like hints, notes mode, or solver visualization.
- UI Limitations: Hardcoded layouts and colors made it impossible to modernize the design or support dark mode.
- Tooling Chaos: I jumped between tools like KAPT and KSP without a clear plan, leading to inconsistent implementation.
- Unscalable Codebase: Every new feature felt like a gamble — anything could break.
My Refactoring Approach: Starting from a Clean Slate
Rather than trying to untangle the spaghetti code, I made a tough but necessary decision:
Start over. Completely. But this time with structure and intention.
Here’s how I approached the rebuild:
1. Architecture First
I began by designing a proper structure using Clean Architecture and the MVVM pattern, creating clear separation between the UI, domain logic, and data layers.
2. Feature Planning
Before writing any code, I outlined all the features I wanted:
- Puzzle generation and solving
- Solving visualization
- User stats and profiles
- Blog section
- Brain health tips
- Full offline and online support



3. Screens Before Logic
Using Jetpack Compose and Navigation-Compose, I first created the basic screens and navigation flows — only then did I start implementing business logic.
4. Theming from the Start
To properly support dark mode, I moved all colors and styles into a centralized theme system, avoiding hardcoded values.



5. Choosing the Right Tools
This time, I selected my tools with care and consistency:
- Jetpack Compose for UI
- Room for local data persistence
- Firebase for cloud sync and authentication
- Koin for dependency injection
- Kotlin + KSP for clean and modern development

What the New Version Can Do (That the Old One Couldn’t)
The refactored Neurodoku isn’t just a basic Sudoku solver — it’s a complete mobile experience with features including:
- Real-time solving visualizations (backtracking algorithm)
- Puzzle generator across four difficulty levels
- Full dark mode support
- Hints, notes mode, and puzzle reset
- An in-app blog about brain health and Sudoku strategies
- User authentication, custom profiles, and stats tracking
- Offline storage with Room and optional cloud sync with Firebase
- A modern, modular, and testable codebase with unit tests
You can check it out on my GitHub under the Neurodoku repository.
What I Learned from Refactoring
Rebuilding Neurodoku taught me more than I expected — here are some of the biggest lessons:
- Architecture matters — even for small or hobby projects.
- The first version is just a draft — don’t be afraid to throw it away and do better.
- Tools like Jetpack Compose shine when the codebase is clean and modular.
- Scalability comes from structure, not clever shortcuts.
- Plan first, code second. It saves a lot of pain later.
Final Thoughts
Neurodoku was never supposed to be a full-fledged Sudoku platform — but refactoring it gave me the chance to apply everything I’d learned about Android development, architecture, and clean code.
If you’re a developer sitting on a messy old project, ask yourself:
Is it time to refactor?
If the answer is yes, don’t hesitate to start fresh.
It might be the best decision you make for your code — and your skills
Leave a Reply