Smarter ToDos With Kotlin
Article Summary
Kotlin's built-in TODO() is great, except it crashes your app in production. Kaushik Gopal built something smarter.
Standard Kotlin TODOs throw NotImplementedError exceptions that blow up your app whenever the code path executes. Gopal created a custom ToDo() function that's aggressive with developers but gentle with users.
Key Takeaways
- Custom ToDo() only crashes in debug builds, never in production
- Accepts due dates so TODOs blow up only after deadline passes
- Alternative approach: sleep execution 10ms per overdue day (max 5s)
- Keeps documentation in code without requiring external tracking tools
Critical Insight
A simple Kotlin wrapper around TODO() that checks BuildConfig.DEBUG and date conditions prevents production crashes while keeping developers accountable.