Vanta Logo
SPONSOR
Automate SOC 2 & ISO 27001 compliance with Vanta. Get $1,000 off.
Published
3 min read
Up to date

Trevor I. Lasn

Staff Software Engineer, Engineering Manager

Make It Work First Before Optimizing

Users don't care how elegant your code is. They care if it solves their problem.

I once worked on a project where we spent days optimizing our database queries. We shaved milliseconds off response times. Our code was a thing of beauty. There was just one tiny problem: The core feature didn’t actually work.

Oops.

We’d gotten so caught up in making things fast that we forgot to make sure they worked in the first place. It’s a classic rookie mistake, but I’ve seen senior devs fall into this trap too.

So let’s talk about why you should focus on making your code work before worrying about making it fast.

The Siren Song of Optimization

Look, I get it. Optimization is sexy. There’s something deeply satisfying about seeing those performance metrics improve. It feels like real engineering.

Imagine walking into a meeting and saying, “I improved our algorithm efficiency by 400%.” Sounds a lot sexier than, “I made sure the ‘Submit’ button actually submits things.”

But here’s where it gets tricky:

  • Premature optimization is a time sink: I once spent three days optimizing a function, only to realize later that it was called maybe once a week. Total time saved? Microseconds. Time wasted? Days.
  • It can introduce new bugs: In my quest for speed, I’ve accidentally broken working code more times than I care to admit. Optimization often means making code more complex, and complexity breeds bugs.
  • It can mask bigger issues: Focusing on making things fast can distract you from asking if you’re building the right thing in the first place.

Don’t get me wrong - optimization is important. But it’s like a turbocharger for your car. Really cool, but utterly useless if the engine doesn’t run in the first place.

A Tale of Two Developers

Meet Alice and Bob. They’re both tasked with building a new feature for their company’s app.

Alice dives right in. She writes messy, unoptimized code, but within a day, she has a working prototype. It’s slow, it’s clunky, but it works.

Bob, meanwhile, spends that first day researching the most efficient algorithms for the task. He meticulously plans out his data structures. His code is a marvel of efficiency… but after a week, the feature still isn’t functional.

Who do you think their boss is happier with?

The Power of Working Code

Here’s why Alice’s approach is often better:

  1. Faster feedback: With a working prototype, Alice can get user feedback immediately. Maybe the feature isn’t even needed!
  2. Easier debugging: It’s simpler to fix bugs in simple, straightforward code.
  3. Clearer optimization targets: Once the code works, Alice can profile it to see where optimization is actually needed.
  4. Motivation boost: Nothing kills motivation like spending weeks on something with no visible progress.

But What About Technical Debt?

I can hear some of you screaming, “But what about technical debt? Won’t we just have to rewrite everything later?”

Maybe. But here’s the thing: You don’t know what parts of your code will need optimization until you have a working system. Premature optimization isn’t just the root of all evil - it’s a waste of time.

This ties into a broader question: when should you actually worry about technical debt?

If you found this article helpful, you might enjoy my free newsletter. I share developer tips and insights to help you grow your skills and career.


More Articles You Might Enjoy

If you enjoyed this article, you might find these related pieces interesting as well. If you like what I have to say, please check out the sponsors who are supporting me. Much appreciated!

Leadership
6 min read

Software Engineer Titles Have (Almost) Lost All Their Meaning

Examining the Devaluation of Software Engineer Titles and Its Impact on Tech Industry Integrity

Oct 20, 2024
Read article
Leadership
3 min read

Barnacle Strategy for Startups

As a founder, you're always on the lookout for smart ways to grow your startup without burning through your limited resources. That's where the barnacle strategy comes in.

Oct 3, 2024
Read article
Leadership
6 min read

The Monday Morning Test to Measure Engineering Team Health

Why the first day back can reveal everything about your engineering team's health

Nov 4, 2024
Read article
Leadership
5 min read

You Can Choose to Be Someone Who's Competent in Many Things, or Unbelievably Good at One Thing

Should you diversify your skills or specialize?

Sep 26, 2024
Read article
Leadership
7 min read

Can Scrum Be Salvaged?

Scrum is failing engineering teams and what it's actually costing us

Nov 14, 2024
Read article
Leadership
3 min read

When Tasked with a Problem, Start with the Bigger Picture

When faced with a challenge, I always step back to see the whole picture first. It's like pausing a complex strategy game to study the map. You might lose a few seconds of play time, but you gain a crucial understanding of the battlefield.

Oct 3, 2024
Read article
Leadership
7 min read

Evolve or Become Irrelevant

Why staying relevant in tech means constantly adapting to new technologies and trends

Sep 15, 2024
Read article
Leadership
5 min read

When Should You Actually Worry About Tech Debt?

Technical debt isn't the monster under your bed, but it can become one if ignored too long.

Sep 12, 2024
Read article
Leadership
8 min read

What Makes a Great Engineering Manager?

People don't quit jobs, they quit bad managers. Here's what great engineering leadership actually looks like

Dec 8, 2024
Read article

Become a better engineer

Here are engineering resources I've personally vetted and use. They focus on skills you'll actually need to build and scale real projects - the kind of experience that gets you hired or promoted.

Many companies have a fixed annual stipend per engineer (e.g. $2,000) for use towards learning resources. If your company offers this stipend, you can forward them your invoices directly for reimbursement. By using my affiliate links, you support my work and get a discount at the same!


This article was originally published on https://www.trevorlasn.com/blog/make-it-work-first-before-you-optimize. It was written by a human and polished using grammar tools for clarity.