Back to Blogs
How I Approach a Problem Before Writing Code
EngineeringProductivityGuideSystem Design

How I Approach a Problem Before Writing Code

Stop coding immediately. Learn the 80/20 rule of software engineering: 80% planning, 20% typing. A guide to thinking like a senior engineer.

19 views
0

Stop! Don't touch that keyboard yet.

The biggest mistake developers make is jumping straight into the code. The code is just the implementation detail; the solution happens in your head (and on paper) first.

I used to be a "feature factory"—churning out code the moment I got a ticket. But I quickly realized that velocity without direction is just speed towards a cliff.

Over the years, I've developed a rigorous mental protocol that I run before I even type git init. Here is my exact process for breaking down complex engineering problems.

The 4-Step Engineering Protocol

Radical Understanding

Read the requirements. Then read them again. If you can't explain the problem to a 5-year-old, you don't understand it well enough. I ask:

  • What is the root user need?
  • What are the edge cases?
  • What constraints (performance, budget, time) do we have?

The "Paper" Phase

I step away from the screen. I use a whiteboard, iPad, or just a notebook. I draw data flows, component hierarchies, and state diagrams.

Goal: Create a visual map of the system. If it looks messy on paper, it will look messy in code.

Pseudo-Coding

Write the logic in plain English. This bridges the gap between abstract design and concrete syntax. It forces you to think about algorithms without worrying about semicolon errors.

Implementation

Only now do I open VS Code. Because I've done the hard work, this part feels like transcription. It's fast, flow-state inducing, and largely bug-free.

Visualizing the Architecture

When I'm in the "Paper Phase" or setting up my mental model, I often visualize the codebase structure. It helps to see the "shape" of the application.

VS Code Architecture Visualization

VS Code Architecture Visualization

This visualization represents how I mentally group concerns—separating logic, UI, and state management before connecting them.

From Abstraction to Reality

Let's look at a practical example. Say we need a function to retry a network request.

The Plan (Pseudocode)

Try request. If fail, wait X seconds. Increase wait time. Try again. Stop after N tries.

The Implementation

typescripttypescript
async function retry<T>(
  fn: () => Promise<T>, 
  retries = 3, 
  delay = 1000
): Promise<T> {
  try {
    return await fn();
  } catch (error) {
    if (retries <= 0) throw error;
    
    // Log the retry attempt
    console.warn(`Retrying... attempts left: ${retries}`);
    
    // Wait for the specific delay
    await new Promise(res => setTimeout(res, delay));
    
    // Recursive call with exponential backoff
    return retry(fn, retries - 1, delay * 2);
  }
}

Pro Tip: Notice how the code is cleaner because the logic was already clear? Implementing exponential backoff is trivial when you've already decided that's the strategy.

Conclusion

Coding is an art of translation—translating human problems into machine instructions. The better you are at understanding the human problem, the more elegant your machine instructions will be.

Next time you get a task, resist the urge to code. Think first.


Ready to debate this? Drop a comment below or cheer if this resonates with your workflow!


Parth Sharma

Author Parth Sharma

Full-Stack Developer, Freelancer, & Founder. Obsessed with crafting pixel-perfect, high-performance web experiences that feel alive.

Discussion0

Join the conversation

Sign in to leave a comment, like, or reply.

No comments yet. Start the discussion!