📘 Why Documentation Really Matters in Code

📘 Why Documentation Really Matters in Code

As developers, we often underestimate how much time is lost not writing code — but trying to understand it.

Teams don’t slow down because the tech is hard — they slow down because no one knows why something was done a certain way, or how it’s supposed to work.

Good documentation isn't about writing more. It's about building a shared understanding — across features, functions, and future teammates.

As Robert C. Martin said:

“The proper use of comments is to compensate for our failure to express ourselves in code.”

Here’s what that looks like in practice 👇


🔹 1. Avoid unnecessary comments with clear naming

Bad: val t = System.currentTimeMillis() // timestamp for cache

Better: val cacheStartTimestamp = System.currentTimeMillis()


🔹 2. Express intent through method names

Bad: fun handle(u: User)

Better: fun validateAndSyncUser(user: User)


🔹 3. Let clean code reduce need for explanations

Bad: if (user.role == 1) // check if admin

Better: if (user.isAdmin())


🔹 4. Keep comments short and valuable

Bad: // we are checking if network is available before calling the API

Better: // Check network before API call


🔹 5. Document setup clearly in README files

Keep your README simple, helpful, and developer-first:

Project: Auth SDK Purpose: Handles user login, session validation, and token refresh in client apps Tech stack: Kotlin, Retrofit, Firebase Cloud Messaging Installation: – Add auth-sdk module to your project – Initialize inside your Application class – Provide: Firebase Token, Auth Token, User ID Usage: Call AuthManager.initialize(context, token, userId) on app launch

This helps future developers get started in minutes — not hours.


💬 Final Thought The best documentation doesn’t just explain — it empowers. It turns context into clarity. Confusion into confidence.

✨ Because at the end of the day, great code isn’t just written to run — it’s written to be read, shared, and evolved.

Iniyan Murugavel

Senior Lead Android | 8+ YoE | Android Architect | Kotlin | Jetpack Compose | KMM | Golang | BFF | Product Enthusiast | Lead with Curiosity Always | Scaling Startups | Ex-Rapido | Ex-KreditBee | Ex-HCL

3w

I appreciate this, Ajay

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics