Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Writing About Code Makes You a Better Coder

· 6 min read · Home Tech

In this article
  1. Why Writing About Code Works
  2. The Cognitive Benefits of Teaching Through Writing
  3. How Writing Improves Code Quality
  4. What to Write About (and How to Start)
  5. Common Pitfalls to Avoid
  6. Writing vs. Other Learning Methods
  7. Frequently Asked Questions

Yes, writing about code makes you a better coder. The act of explaining technical concepts forces you to clarify your own understanding, identify gaps in your knowledge, and think more deeply about the decisions you make while programming.

Why Writing About Code Works

When you write about code, you move from passive consumption to active engagement. Reading documentation or watching tutorials can give you a false sense of understanding, but writing requires you to structure your thoughts, choose precise language, and anticipate questions a reader might have. This process is similar to the Feynman Technique, where you try to explain a concept in simple terms to reveal what you truly understand and what you don't. For example, if you can't write a clear paragraph about how JavaScript's event loop works, you probably don't understand it well enough to debug a race condition in your own code.

Writing also slows you down. In a world of copy-paste solutions and Stack Overflow answers, writing forces you to examine each line and each design choice. When you document why you chose a particular algorithm or why you structured a class in a certain way, you are more likely to notice flaws or alternatives. This reflective practice is a hallmark of deliberate practice, which is essential for improving any skill.

The Cognitive Benefits of Teaching Through Writing

Explaining code in writing activates different cognitive processes than simply writing code. When you write for an audience, you must consider the reader's background, which pushes you to define terms, provide context, and draw analogies. This is a form of elaboration, a learning technique where you connect new information to existing knowledge. For instance, if you're writing about recursion, you might compare it to Russian nesting dolls or to a loop that calls itself. These analogies not only help your readers but also solidify your own mental model.

Furthermore, writing about code often leads to what researchers call the "generation effect" — the phenomenon where producing information yourself improves retention better than just reading it. When you write a tutorial about a tricky bug you fixed, you are essentially rehearsing the solution, which makes it more likely you'll remember it next time. This is why many developers keep a blog or a personal wiki; the act of writing is a form of self-assessment.

How Writing Improves Code Quality

Writing about your code can directly improve the code itself. When you sit down to describe your architecture, you often spot inconsistencies, dead code, or missed edge cases. This is because writing forces you to look at the code from a higher level, not just line by line. For example, you might realize that your function named getUserData also updates the database, which violates the principle of least surprise. Writing the documentation for that function would make that misnomer painfully obvious.

Moreover, writing about code encourages you to think about the "why" behind your decisions. If you can't explain why you used a switch statement instead of an if-else chain, you might not have a good reason. This kind of introspection often leads to simpler, more maintainable code. Many developers report that after writing a blog post about a particular design pattern, they refactor their own projects to better align with the principles they described.

What to Write About (and How to Start)

You don't need a blog with thousands of readers to benefit. The audience can be just yourself. Here are some effective ways to start writing about code:

  • Keep a development journal: After each coding session, write a few paragraphs about what you did, what problems you encountered, and how you solved them.
  • Write internal documentation: Document the functions and modules you create, even if no one else will read them.
  • Answer questions on forums: Sites like Stack Overflow are great places to practice explaining code to others. Even if you don't post, try to write out an answer to a question you know the answer to.
  • Create tutorials for your future self: Write a guide on how to set up a project or use a particular API. This is especially useful for things you don't do every day.
  • Explain a bug you fixed: Write a post-mortem of a tricky bug, including what caused it and how you fixed it.

When you start, focus on topics you find difficult. The process of writing will force you to fill in the gaps in your understanding. If you get stuck, that's a sign you've found something you need to learn.

Common Pitfalls to Avoid

While writing about code is beneficial, there are some common mistakes that can reduce its effectiveness:

  • Copy-pasting code without explanation: The value is in the explanation, not the code itself. If you just paste a block of code, you're not forcing yourself to think.
  • Writing only about what you already know: This is comfortable but doesn't stretch your understanding. Challenge yourself to write about topics that are slightly beyond your current level.
  • Focusing on syntax rather than concepts: Syntax is easy to look up. The real value is in explaining why something works, not just how.
  • Not revising your writing: The first draft is rarely good. Revising your writing is like refactoring your code; it makes it better and helps you learn more.

Writing vs. Other Learning Methods

Writing about code is often compared to other learning methods like pair programming, reading books, or watching videos. Each has its strengths. Reading is efficient for absorbing a lot of information, but it's passive. Pair programming gives you immediate feedback, but it requires another person. Writing combines the benefits of active recall and elaboration, and it's something you can do alone, at your own pace. It's also a permanent record that you can return to later, which is something you can't do with a conversation.

However, writing is not a replacement for practice. You still need to write code, debug, and build projects. Writing is a complement that enhances the learning you get from practice. The best approach is to combine writing with hands-on coding: write about a concept, then implement it, then write about what you learned during the implementation.

Frequently Asked Questions

Do I need to be a good writer to benefit?

No. The goal is not to produce polished prose but to clarify your thinking. Even rough notes can be incredibly valuable. The act of putting your thoughts into sentences is what matters, not the grammar or style.

How often should I write about code?

Consistency matters more than frequency. Writing once a week for 30 minutes is better than writing for 3 hours once a month. The key is to make it a regular habit so that it becomes part of your learning routine.

What if I write about something and it turns out I was wrong?

That's actually a good thing. Being wrong is a powerful learning opportunity. When you discover your mistake, you'll likely remember the correct information much better than if you had never written it down. You can also correct the post, which is a great way to deepen your understanding.

Can writing about code help with job interviews?

Yes, indirectly. Writing about code improves your ability to articulate your thought process, which is exactly what interviewers want to see. It also helps you build a portfolio of explanations that you can reference during interviews.

Should I write about code I don't fully understand?

Yes, but with caution. Write about it as a learning exercise, and be clear that you're still exploring. The process of writing will help you figure out what you don't know, and you can then research those gaps. This is often more effective than trying to learn everything before you start writing.