İçeriğe Atla
Mustafa Erbay
Technology · 4 min read · görüntülenme Türkçe oku
100%

The Best Code Is the Code You Don't Write

A truth distilled from 20 years of experience: Every line of code written is a cost, and every line not written is a gain. How can we avoid unnecessary.

The word 'CODE' written on paper with a pen striking through it, on a white background. A minimalist and simple visual.

While working for years in a production ERP, we always calculated the effort spent to add a feature. However, at that time, we couldn’t fully grasp that every line of code we added would essentially remain in our pocket like a promissory note, multiplying the burden of maintenance, testing, and operations. Over the years, I’ve seen that the best code is the code you don’t write; because that code has zero errors, zero maintenance, and zero additional cost.

Understanding this simple truth fundamentally changes many strategic decisions in software development and system architecture. Every new feature or solution brings complexity, and the cost of this complexity is paid not only during development but throughout the project’s entire lifecycle. That’s why, when I encounter a problem, my first thought is, “How can I solve this without writing code?”

What Are the Invisible Costs of Code?

Every line of code we write, while seemingly offering only functionality at first glance, actually hides a series of invisible costs. These costs multiply exponentially as the project grows and are often overlooked.

When we write a new reporting module or extend an existing integration, we initially see that the functionality works smoothly. However, over time, issues such as the interaction of this new code with other modules, its potential impact on performance, or its resilience to future changes emerge. Additional responsibilities like test automation, logging, monitoring, and even security vulnerabilities increase with every new code block.

Last year, for one of my side products, I decided to add a complex filtering and formatting feature for users to export specific data sets. The coding took a few days, but subsequent performance issues, incorrectly formatted data, and the inability to provide the flexibility users wanted forced me to redesign the feature from scratch. I wish I had questioned more thoroughly whether such a complex feature was truly necessary in the first place, or if I could have offered a simpler export option with existing tools.

Why Does Simplicity Seem So Hard?

Producing simple solutions is often the most difficult; because it requires not only technical knowledge but also discipline and vision. As many developers and architects, we often fall into the trap of “more features, the better” or “complex solutions are smarter.”

I think there are several reasons for this. First, the developer’s “ego.” Writing a complex algorithm or integrating a new technology is often satisfying and makes us feel like “experts.” Second, the fear of uncertainty. When trying to anticipate possible future needs, we tend to add more features than necessary, just “in case.” Third is the urge to “reinvent the wheel.” Instead of using an existing library or service, we believe we can write the same functionality ourselves and produce a better solution. However, most of the time, an open-source and community-supported solution is more robust and easier to maintain than what we write.

Not Writing Code Is a Strategy: When to Stop?

Not writing code is not just laziness, but a strategic decision. This decision should be made by considering project goals, available resources, and long-term sustainability.

My primary rule: If I can solve a problem with an existing tool, service, or a simple configuration change, I never write new code. For example, setting up a reverse proxy and rate limiting using Nginx is much faster, more secure, and easier to maintain than writing the same functionality from scratch as a Python service. Or there’s no need to develop a new microservice when a simple logging can be done with a PostgreSQL trigger. My second rule: If the code to be written does not reduce existing complexity or provide significant business value, one must learn to say “no” to that code. This “no” applies not only to writing code but also to unnecessary meetings, feature requests, and any activity that distracts from the project’s focus.

Once, in a client project, a request came in for users to export specific reports in their desired format and columns. The team proposed writing a dynamic reporting engine for this. However, I argued that this request could actually be solved much faster and with less code using a standard BI tool (with SQL queries and a simple user interface). As a result, we integrated an existing open-source BI tool, which significantly saved both development time and future maintenance costs. This was an example of not only avoiding writing code but also preventing complexity from the outset by choosing the right tool.

Conclusion: Not Writing Code Is an Art

One of the most valuable lessons I’ve learned in my career is that software development is not just about writing code. The real skill is to write the right amount of code, of the right quality, at the right time, and sometimes, not to write any at all. This is a constant struggle of balance and trade-offs.

Our duty as developers is not only to provide functionality but also to ensure the long-term health and sustainability of the system. This often requires the courage to say “no,” to prefer simple solutions, and to foresee the potential costs that every new line of code will bring. Remember, the fastest, least error-prone, and easiest-to-maintain code is the code that never existed.

So, in your career, has there been a code block you wished you hadn’t written, or a solution you were glad you didn’t write? What are your experiences on this topic?

Paylaş:

Bu yazı faydalı oldu mu?

Yükleniyor...

Bu yazı nasıldı?

Frequently Asked Questions

Common questions readers have about this article.

How did you learn that every line of code written is a cost?
I learned the truth that 'Every line of code written is a cost, and every line not written is a gain' from 20 years of experience working for years in a production ERP. We couldn't fully grasp that every line of code we added would essentially remain in our pocket like a promissory note, multiplying the burden of maintenance, testing, and operations. But over the years, I've seen that the best code is the code you don't write; because that code has zero errors, zero maintenance, and zero additional cost.
What strategies do you use to avoid unnecessary complexity?
When I encounter a problem, my first thought is, 'How can I solve this without writing code?' When adding a new feature or solution, I also consider the cost of the complexity it will bring. Therefore, for every new feature or solution, I try to avoid unnecessary complexity by calculating the costs it will entail.
What are the invisible costs of code and how can you calculate them?
The invisible costs of code multiply exponentially as the project grows and are often overlooked. When we write a new reporting module or extend an existing integration, we initially see that the functionality works smoothly. However, over time, issues such as the interaction of this new code with other modules, its potential impact on performance, or its resilience to future changes emerge. To calculate these costs, I can evaluate the code's maintainability, error rate, performance impact, and resistance to future changes to determine the total cost.
What are the advantages of not writing code and how can you benefit from them?
The advantages of not writing code are zero errors, zero maintenance, and zero additional cost. To leverage these advantages, I first try to solve problems without writing code. If writing code is necessary for a problem, then I try to write the code in the simplest and most effective way. Additionally, I can calculate the total cost by evaluating the code's maintainability, error rate, performance impact, and resistance to future changes, and I try to avoid unnecessary complexity.
ME

Mustafa Erbay

Sistem Mimarisi · Network Uzmanı · Altyapı, Güvenlik ve Yazılım

2006'dan bu yana sistem mimarisi, network, sunucu altyapıları, büyük yapıların kurulumu, yazılım ve sistem güvenliği ekseninde çalışıyorum. Bu blogda sahada karşılığı olan teknik deneyimlerimi paylaşıyorum.

Kişisel Notlar

Bu notlar sadece sizde saklanır. Tarayıcınızda yerel olarak tutulur.

Hazır 0 karakter

Comments

Server-side AI Moderation

Comments are AI-moderated server-side and stored permanently.

?
0/2000

Server-side AI moderation

✉️ Free · No spam · Unsubscribe anytime

Curated digest, hand-picked by me — not the AI

Once a week: the most important post of the week, behind-the-scenes notes, and a "what I actually used this week" section. Less noise, more signal.

  • 📌
    Best of the week Single most-worth-reading post
  • 🔧
    Toolbox notes Real tools I used this week
  • 🧠
    Behind-the-scenes Notes that don't make it to blog

We don't spam. Unsubscribe anytime. · Tracked only by Umami (self-hosted, no Google).

Your Reading Stats

0

Posts Read

0m

Reading Time

0

Day Streak

-

Favorite Category

Related Posts