<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged cleancode</title>
<link>https://coderlegion.com/tag/cleancode</link>
<description>Powered by Question2Answer</description>
<item>
<title>My Journey as a Software Engineer: Building Solutions, Solving Problems, and Never Stopping Learning</title>
<link>https://coderlegion.com/30767/journey-software-engineer-building-solutions-solving-problems-never-stopping-learning</link>
<description>&lt;p&gt;Software engineering is more than writing code. It is about understanding problems, thinking logically, designing solutions, and building software that makes people's lives easier.&lt;/p&gt;
&lt;p&gt;As a software engineer, I enjoy turning ideas into practical applications. Every project brings a new challenge, whether it is fixing a difficult bug, improving application performance, designing a better database structure, or finding a simpler way to solve a complex problem.&lt;/p&gt;
&lt;p&gt;For me, the most interesting part of software development is the process of figuring out how things work and discovering better ways to build them.&lt;/p&gt;
&lt;h3 id=&quot;coding-is-only-one-part-of-software-engineering&quot;&gt;Coding Is Only One Part of Software Engineering&lt;/h3&gt;
&lt;p&gt;When people think about software engineers, they often imagine someone sitting in front of a computer and writing code all day. In reality, software development involves much more than that.&lt;/p&gt;
&lt;p&gt;Before writing code, we need to understand the problem. We need to ask the right questions, identify requirements, consider different approaches, and choose a solution that fits the situation.&lt;/p&gt;
&lt;p&gt;Sometimes, the hardest part of a project is not implementing a feature. It is understanding what the feature should actually do.&lt;/p&gt;
&lt;p&gt;A good software engineer does not simply ask, &quot;How can I write this code?&quot; Instead, the more important question is, &quot;What is the best way to solve this problem?&quot;&lt;/p&gt;
&lt;p&gt;That difference can have a major impact on the quality of the final product.&lt;/p&gt;
&lt;h3 id=&quot;learning-to-write-clean-and-maintainable-code&quot;&gt;Learning to Write Clean and Maintainable Code&lt;/h3&gt;
&lt;p&gt;Writing code that works is important, but writing code that other developers can understand and maintain is equally valuable.&lt;/p&gt;
&lt;p&gt;In the beginning, it can be tempting to focus only on getting the expected result. However, as applications grow, poorly organized code becomes harder to debug, test, and improve.&lt;/p&gt;
&lt;p&gt;Clean code helps developers understand the purpose of a function, follow the flow of an application, and make changes without introducing unnecessary problems.&lt;/p&gt;
&lt;p&gt;Some practices I consider important in software development include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Choosing meaningful names for variables, functions, and classes.&lt;/li&gt;
&lt;li&gt;Keeping functions focused on specific responsibilities.&lt;/li&gt;
&lt;li&gt;Avoiding unnecessary duplication.&lt;/li&gt;
&lt;li&gt;Organizing projects into understandable structures.&lt;/li&gt;
&lt;li&gt;Handling errors properly instead of ignoring them.&lt;/li&gt;
&lt;li&gt;Writing tests for important functionality.&lt;/li&gt;
&lt;li&gt;Refactoring code when a better approach becomes clear.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Clean code does not mean making every solution complicated with design patterns or unnecessary abstractions. It means making the code as simple and understandable as the problem allows.&lt;/p&gt;
&lt;p&gt;The goal is not just to make code work today. It is to make it easier to work with tomorrow.&lt;/p&gt;
&lt;h3 id=&quot;debugging-where-real-learning-happens&quot;&gt;Debugging: Where Real Learning Happens&lt;/h3&gt;
&lt;p&gt;Every developer encounters bugs. Sometimes, an application crashes unexpectedly. Sometimes, a feature works perfectly in one situation but fails in another. Other times, the problem comes from a database query, an API response, or an assumption that turns out to be incorrect.&lt;/p&gt;
&lt;p&gt;Debugging can be frustrating, especially when the cause of a problem is not immediately obvious.&lt;/p&gt;
&lt;p&gt;However, debugging is also one of the best opportunities to improve as an engineer.&lt;/p&gt;
&lt;p&gt;Instead of randomly changing code, I believe in following a structured approach:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Understand the problem.&lt;/strong&gt; Reproduce the issue and identify what should happen versus what actually happens.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Investigate the cause.&lt;/strong&gt; Review relevant code, logs, inputs, database records, and API responses.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test assumptions.&lt;/strong&gt; Avoid guessing. Check each possible explanation using evidence.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Apply a focused fix.&lt;/strong&gt; Solve the underlying problem rather than hiding the symptoms.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Verify the result.&lt;/strong&gt; Test the fix and make sure it does not break existing functionality.&lt;/p&gt;
&lt;p&gt;This process helps build a deeper understanding of how applications behave. Over time, each difficult bug becomes an opportunity to develop stronger problem-solving skills.&lt;/p&gt;
&lt;h3 id=&quot;choosing-the-right-technology-for-the-problem&quot;&gt;Choosing the Right Technology for the Problem&lt;/h3&gt;
&lt;p&gt;The software industry changes quickly. New programming languages, frameworks, libraries, and development tools appear regularly.&lt;/p&gt;
&lt;p&gt;It is easy to feel that a developer must learn every new technology to remain relevant. I believe a better approach is to focus on strong fundamentals while exploring technologies that solve real problems.&lt;/p&gt;
&lt;p&gt;Understanding data structures, algorithms, databases, networking, APIs, security, and software architecture provides a foundation that remains useful across different technology stacks.&lt;/p&gt;
&lt;p&gt;Frameworks may change, but the ability to analyze requirements, design reliable systems, and reason about code continues to matter.&lt;/p&gt;
&lt;p&gt;When choosing a technology, I would consider factors such as project requirements, performance, maintainability, security, available expertise, and long-term support.&lt;/p&gt;
&lt;p&gt;The newest tool is not always the best tool. The right choice is the one that fits the problem and the people who will maintain the solution.&lt;/p&gt;
&lt;h3 id=&quot;building-software-that-solves-real-problems&quot;&gt;Building Software That Solves Real Problems&lt;/h3&gt;
&lt;p&gt;One of the most rewarding parts of software engineering is seeing an idea become something useful.&lt;/p&gt;
&lt;p&gt;A well-designed application can automate repetitive work, organize information, improve business processes, reduce errors, or help people make better decisions.&lt;/p&gt;
&lt;p&gt;But useful software does not necessarily need to be large or complicated.&lt;/p&gt;
&lt;p&gt;A small script that saves someone hours of repetitive work can be just as valuable as a large application. A simple dashboard that makes important information easier to understand can have a meaningful impact on a business.&lt;/p&gt;
&lt;p&gt;I believe developers should focus on the value their software provides rather than measuring success only by the number of features, lines of code, or technologies used.&lt;/p&gt;
&lt;p&gt;The best solutions often come from understanding users, identifying unnecessary complexity, and solving the actual problem with the simplest effective approach.&lt;/p&gt;
&lt;h3 id=&quot;the-importance-of-testing-and-code-quality&quot;&gt;The Importance of Testing and Code Quality&lt;/h3&gt;
&lt;p&gt;A feature that works once is not necessarily a reliable feature.&lt;/p&gt;
&lt;p&gt;Software needs to handle different inputs, unexpected situations, invalid data, network failures, and changes in its environment. Without proper testing, even a small update can introduce problems elsewhere in an application.&lt;/p&gt;
&lt;p&gt;Testing helps developers identify issues before users experience them. It also provides confidence when modifying existing functionality.&lt;/p&gt;
&lt;p&gt;Depending on the project, useful practices can include unit testing, integration testing, API testing, code reviews, and automated deployment checks.&lt;/p&gt;
&lt;p&gt;Code quality also involves security, performance, accessibility, and maintainability. These considerations should not be treated as optional improvements that only matter when a project becomes large.&lt;/p&gt;
&lt;p&gt;Building good habits early makes it easier to develop software that people can depend on.&lt;/p&gt;
&lt;h3 id=&quot;adapting-to-ai-and-modern-development-tools&quot;&gt;Adapting to AI and Modern Development Tools&lt;/h3&gt;
&lt;p&gt;Artificial intelligence is changing the way developers approach everyday work. AI-powered tools can help explain unfamiliar code, suggest implementations, generate test cases, identify possible bugs, and speed up repetitive tasks.&lt;/p&gt;
&lt;p&gt;I see these tools as useful assistants, but not replacements for engineering judgment.&lt;/p&gt;
&lt;p&gt;Generated code still needs to be reviewed. Suggested solutions may contain security issues, incorrect assumptions, inefficient logic, or unnecessary complexity.&lt;/p&gt;
&lt;p&gt;A developer must understand what the code does, why it works, and whether it satisfies the actual requirements.&lt;/p&gt;
&lt;p&gt;The most effective approach is to combine modern tools with fundamental engineering skills. Use automation where it helps, but continue developing the ability to reason independently and evaluate the results.&lt;/p&gt;
&lt;p&gt;Technology can make certain tasks faster, but understanding the problem remains essential.&lt;/p&gt;
&lt;h3 id=&quot;continuous-learning-is-part-of-the-job&quot;&gt;Continuous Learning Is Part of the Job&lt;/h3&gt;
&lt;p&gt;Software engineering is a field where learning never really ends.&lt;/p&gt;
&lt;p&gt;Even experienced developers encounter unfamiliar systems, new requirements, unexpected technical limitations, and technologies they have never used before.&lt;/p&gt;
&lt;p&gt;I believe continuous learning works best when it is connected to practical experience. Reading documentation and watching tutorials can provide useful knowledge, but building projects helps turn that knowledge into real skills.&lt;/p&gt;
&lt;p&gt;Working on side projects, experimenting with new tools, reading other developers' code, reviewing mistakes, and discussing technical ideas with the community can all contribute to professional growth.&lt;/p&gt;
&lt;p&gt;Not every experiment will succeed. Some approaches will need to be redesigned, and some solutions will reveal better alternatives after implementation.&lt;/p&gt;
&lt;p&gt;That is part of the process.&lt;/p&gt;
&lt;p&gt;The important thing is to remain curious, learn from mistakes, and keep improving.&lt;/p&gt;
&lt;h3 id=&quot;my-perspective-on-becoming-a-better-software-engineer&quot;&gt;My Perspective on Becoming a Better Software Engineer&lt;/h3&gt;
&lt;p&gt;For me, becoming a better software engineer is not about knowing everything. It is about developing the ability to learn, think critically, solve problems, and make thoughtful technical decisions.&lt;/p&gt;
&lt;p&gt;I want to keep improving the way I approach problems, write code, structure applications, and evaluate different solutions.&lt;/p&gt;
&lt;p&gt;I also believe sharing knowledge is an important part of the developer community. A lesson learned while solving a difficult problem might help another developer avoid the same mistake. A different perspective might reveal a simpler solution that I had not considered.&lt;/p&gt;
&lt;p&gt;That is one reason I value connecting with other developers and learning from their experiences.&lt;/p&gt;
&lt;p&gt;Every project has something to teach us. Every bug can reveal something about a system. Every new challenge gives us an opportunity to improve.&lt;/p&gt;
&lt;h3 id=&quot;final-thoughts&quot;&gt;Final Thoughts&lt;/h3&gt;
&lt;p&gt;Software engineering is a continuous process of building, testing, learning, and improving.&lt;/p&gt;
&lt;p&gt;Writing code is important, but understanding the problem, choosing the right approach, maintaining quality, and considering the people who use the software are equally important.&lt;/p&gt;
&lt;p&gt;My goal is to continue growing as a software engineer by building practical solutions, strengthening my technical knowledge, exploring useful technologies, and sharing what I learn along the way.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Good software is not just about making something work. It is about making something useful, reliable, understandable, and easier to improve.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I would love to hear from other developers: What has helped you grow the most as a software engineer building projects, solving difficult bugs, learning new technologies, or collaborating with other developers?&lt;/p&gt;
&lt;p&gt;Let's keep learning, building, and sharing our experiences.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/30767/journey-software-engineer-building-solutions-solving-problems-never-stopping-learning</guid>
<pubDate>Mon, 12 Oct 2026 05:42:57 +0000</pubDate>
</item>
<item>
<title>Demystifying Dependency Injection: Writing Code That Doesn't Break When Things Change</title>
<link>https://coderlegion.com/25252/demystifying-dependency-injection-writing-code-that-doesnt-break-when-things-change</link>
<description>&lt;h3 id=&quot;what-is-dependency-injection-&quot;&gt;What is Dependency Injection?&lt;/h3&gt;
&lt;p&gt;Dependency Injection is a software design pattern where a program component receives the external resources or tools it needs to function from the outside, rather than creating them itself. In simpler terms, instead of a program hardcoding its own helpers internally, those helpers are 'injected' or passed into it when it starts up. This simple shift in responsibility makes your code incredibly flexible, highly reusable, and easy to modify without breaking existing features.&lt;/p&gt;
&lt;h3 id=&quot;the-hybrid-car-battery-analogy&quot;&gt;The Hybrid Car Battery Analogy&lt;/h3&gt;
&lt;p&gt;To understand this concept, imagine you are building a modern hybrid car. If you permanently solder a proprietary brand of battery directly to the car's frame and engine, you have a tightly coupled system. If that battery eventually degrades, or if a cheaper, more efficient battery is manufactured next year, you are in trouble. You would have to dismantle the entire car just to swap out the battery.&lt;/p&gt;
&lt;p&gt;Instead, car manufacturers design a standardized battery compartment with a universal plug. The car's engine does not care about the internal chemistry or brand of the battery, as long as it fits the plug and delivers the expected voltage. The battery is 'injected' into the car from the outside. If you need to change the battery, you simply unplug the old one and slide in the new one. The car remains untouched.&lt;/p&gt;
&lt;h3 id=&quot;why-dependency-injection-matters-every-day&quot;&gt;Why Dependency Injection Matters Every Day&lt;/h3&gt;
&lt;p&gt;In professional software engineering, tight coupling is a primary cause of technical debt and broken deployments. Without Dependency Injection, developers cannot easily test their code in isolation. For instance, if a checkout system creates its own connection to a payment provider like Stripe inside its code, you cannot run automated tests on the checkout system without accidentally triggering real API calls and charging real credit cards.&lt;/p&gt;
&lt;p&gt;By using Dependency Injection, engineers can swap out the real payment service for a fake 'mock' service during testing. This allows test suites to run in milliseconds without relying on external servers or risking financial errors. Furthermore, when business requirements inevitably pivot—such as switching your payment processor from Stripe to PayPal—you only have to write a new adapter and inject it at startup, rather than rewriting the core checkout logic. This prevents bugs from creeping into unrelated parts of your codebase.&lt;/p&gt;
&lt;h3 id=&quot;dependency-injection-in-action&quot;&gt;Dependency Injection in Action&lt;/h3&gt;
&lt;p&gt;Let's look at how this looks in JavaScript code. First, we will examine code that does &lt;em&gt;not&lt;/em&gt; use Dependency Injection, followed by the improved version that does.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;// WITHOUT DEPENDENCY INJECTION (Tightly Coupled)
class CheckoutProcess {
  constructor() {
    // The checkout process is locked into Stripe; we cannot easily change or mock this
    this.paymentService = new StripeProcessor();
  }

  completeOrder(order) {
    this.paymentService.charge(order.amount);
  }
}

// WITH DEPENDENCY INJECTION (Loosely Coupled)
class DecoupledCheckoutProcess {
  constructor(paymentService) {
    // The payment service is injected from the outside
    this.paymentService = paymentService;
  }

  completeOrder(order) {
    this.paymentService.charge(order.amount);
  }
}

// Usage in production:
const stripe = new StripeProcessor();
const productionCheckout = new DecoupledCheckoutProcess(stripe);

// Usage in automated testing (injecting a fake helper instead):
const fakeMockProcessor = {
  charge: (amount) =&amp;gt; console.log('Simulated charge of $' + amount)
};
const testCheckout = new DecoupledCheckoutProcess(fakeMockProcessor);
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;the-takeaway&quot;&gt;The Takeaway&lt;/h3&gt;
&lt;p&gt;Ultimately, Dependency Injection changes how you think about software architecture by turning hardcoded, rigid applications into collections of plug-and-play modules. By separating how a tool is configured from how that tool is actually used, you create a codebase that is inherently stable, highly testable, and ready to adapt to whatever changes your users or business stakeholders demand tomorrow.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;resources&quot;&gt;Resources&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/Saurav-TB-Pandey/react-hook-lab&quot;&gt;react-hook-lab&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;react-hook-lab:&lt;/strong&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.npmjs.com/package/react-hook-lab&quot;&gt;npm package&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Connect with me on LinkedIn:&lt;/strong&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.linkedin.com/in/pandeysaurav/&quot;&gt;Saurav Pandey&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;Originally published on my blog. You can &lt;a rel=&quot;nofollow&quot; href=&quot;https://sauravtbpandey.blogspot.com/2026/08/how-dependency-injection-makes-your.html&quot;&gt;read the alternative breakdown here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;Originally published on my blog. You can &lt;a rel=&quot;nofollow&quot; href=&quot;https://dev.to/saurav_tb_pandey/demystifying-dependency-injection-writing-code-that-doesnt-break-when-things-change-1mnd&quot;&gt;read the alternative breakdown here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/25252/demystifying-dependency-injection-writing-code-that-doesnt-break-when-things-change</guid>
<pubDate>Fri, 04 Sep 2026 06:30:09 +0000</pubDate>
</item>
<item>
<title>Your Code Works. But Can Someone Else Understand It?</title>
<link>https://coderlegion.com/24762/your-code-works-but-can-someone-else-understand-it</link>
<description>&lt;p&gt;We often celebrate code that works.&lt;/p&gt;
&lt;p&gt;The feature is complete.&lt;br&gt;
The tests pass.&lt;br&gt;
The deployment succeeds.&lt;/p&gt;
&lt;p&gt;So we move on.&lt;/p&gt;
&lt;p&gt;But there is another question developers should ask:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;“Will another developer understand this code six months from now?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Because code isn't written only for computers.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;It's also written for humans.&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;the-hidden-cost-of-confusing-code&quot;&gt;The hidden cost of confusing code&lt;/h4&gt;
&lt;p&gt;Consider a function with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;unclear variable names&lt;/li&gt;
&lt;li&gt;complicated conditions&lt;/li&gt;
&lt;li&gt;deeply nested logic&lt;/li&gt;
&lt;li&gt;unnecessary abstractions&lt;/li&gt;
&lt;li&gt;comments explaining &lt;em&gt;what&lt;/em&gt; the code does instead of &lt;em&gt;why&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It may work perfectly today.&lt;/p&gt;
&lt;p&gt;But when someone needs to modify it later, they first have to understand it.&lt;/p&gt;
&lt;p&gt;That understanding has a cost.&lt;/p&gt;
&lt;p&gt;And in a large codebase, that cost becomes expensive.&lt;/p&gt;
&lt;h4 id=&quot;readability-is-a-productivity-feature&quot;&gt;Readability is a productivity feature&lt;/h4&gt;
&lt;p&gt;Readable code doesn't mean every line needs a comment.&lt;/p&gt;
&lt;p&gt;Often, simple structure is better than more documentation.&lt;/p&gt;
&lt;p&gt;Instead of:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;tmp&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;use names that explain intent.&lt;/p&gt;
&lt;p&gt;Instead of one 100-line function, ask whether it can be divided into smaller responsibilities.&lt;/p&gt;
&lt;p&gt;Instead of clever code, prefer code that another developer can understand quickly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The best code is often the code that doesn't require a meeting to explain.&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;think-about-your-future-self&quot;&gt;Think about your future self&lt;/h4&gt;
&lt;p&gt;Here's a simple test:&lt;/p&gt;
&lt;p&gt;Open something you wrote 6 months ago.&lt;/p&gt;
&lt;p&gt;Ask yourself:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;“If I had to modify this today, how long would it take me to understand it?”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If the answer is:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;“Why did I write it like this?”&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You're not alone. &lt;/p&gt;
&lt;p&gt;That's one of the best reminders that maintainability matters.&lt;/p&gt;
&lt;h4 id=&quot;before-you-finish-your-next-feature&quot;&gt;Before you finish your next feature&lt;/h4&gt;
&lt;p&gt;Take 10 minutes and ask:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can I make this easier to read?&lt;/li&gt;
&lt;li&gt;Are the names clear?&lt;/li&gt;
&lt;li&gt;Is each function doing one understandable thing?&lt;/li&gt;
&lt;li&gt;Can I remove unnecessary complexity?&lt;/li&gt;
&lt;li&gt;Would a new developer understand the intent?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Those 10 minutes today can save hours later.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code that works is good.&lt;br&gt;
Code that is easy to understand is valuable.&lt;br&gt;
Code that remains understandable months later is excellent engineering.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;What is the first thing you look for when reviewing someone else's code?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sumita&lt;br&gt;
Web Developer&lt;/strong&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/24762/your-code-works-but-can-someone-else-understand-it</guid>
<pubDate>Mon, 17 Aug 2026 12:17:23 +0000</pubDate>
</item>
<item>
<title>The Feature Is Done… So Why Is the Project Still Getting Slower?</title>
<link>https://coderlegion.com/24439/the-feature-is-done-so-why-is-the-project-still-getting-slower</link>
<description>&lt;h2 id=&quot;the-feature-is-done-so-why-is-the-project-still-getting-slower-&quot;&gt;The Feature Is Done… So Why Is the Project Still Getting Slower?&lt;/h2&gt;
&lt;p&gt;One of the biggest problems in software development isn't writing bad code.&lt;/p&gt;
&lt;p&gt;It's continuously adding &lt;strong&gt;&quot;small&quot; features without accounting for their accumulated cost.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A new filter here.&lt;/p&gt;
&lt;p&gt;Another API endpoint there.&lt;/p&gt;
&lt;p&gt;One more database query.&lt;/p&gt;
&lt;p&gt;A new notification system.&lt;/p&gt;
&lt;p&gt;A few extra configuration options.&lt;/p&gt;
&lt;p&gt;Individually, none of these seem dangerous.&lt;/p&gt;
&lt;p&gt;But eventually, the application becomes harder to understand, harder to test, and slower to change.&lt;/p&gt;
&lt;h3 id=&quot;every-feature-has-a-maintenance-cost&quot;&gt;Every Feature Has a Maintenance Cost&lt;/h3&gt;
&lt;p&gt;When a feature is requested, teams usually ask:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&quot;How long will it take to build?&quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A better question is:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&quot;How much complexity will this feature add to the system?&quot;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A feature can introduce:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;New database tables&lt;/li&gt;
&lt;li&gt;New API contracts&lt;/li&gt;
&lt;li&gt;Additional dependencies&lt;/li&gt;
&lt;li&gt;More edge cases&lt;/li&gt;
&lt;li&gt;More tests&lt;/li&gt;
&lt;li&gt;More monitoring&lt;/li&gt;
&lt;li&gt;More documentation&lt;/li&gt;
&lt;li&gt;More support requests&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The implementation might take two days.&lt;/p&gt;
&lt;p&gt;The maintenance cost might last for years.&lt;/p&gt;
&lt;h3 id=&quot;complexity-compounds&quot;&gt;Complexity Compounds&lt;/h3&gt;
&lt;p&gt;Imagine your application starts with 10 important components.&lt;/p&gt;
&lt;p&gt;Then you add:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Payments&lt;/li&gt;
&lt;li&gt;Notifications&lt;/li&gt;
&lt;li&gt;Reporting&lt;/li&gt;
&lt;li&gt;Search&lt;/li&gt;
&lt;li&gt;Analytics&lt;/li&gt;
&lt;li&gt;Integrations&lt;/li&gt;
&lt;li&gt;Permissions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Each new feature interacts with existing functionality.&lt;/p&gt;
&lt;p&gt;Soon you're not managing 20 independent features.&lt;/p&gt;
&lt;p&gt;You're managing &lt;strong&gt;the relationships between them.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;That's where complexity becomes expensive.&lt;/p&gt;
&lt;p&gt;A small change in one area can unexpectedly affect another.&lt;/p&gt;
&lt;h3 id=&quot;the-hidden-cost-of-flexible-systems&quot;&gt;The Hidden Cost of &quot;Flexible&quot; Systems&lt;/h3&gt;
&lt;p&gt;Developers often try to make systems flexible.&lt;/p&gt;
&lt;p&gt;That's usually a good instinct.&lt;/p&gt;
&lt;p&gt;But flexibility can become another form of complexity.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Simple:

createUser(name, email)

Flexible:

createUser({
  name,
  email,
  role,
  permissions,
  organization,
  metadata,
  preferences,
  notificationRules,
  featureFlags,
  customFields
})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The second version looks powerful.&lt;/p&gt;
&lt;p&gt;But every additional option creates more combinations that developers need to understand and test.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Flexibility isn't free.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;features-also-create-permanent-decisions&quot;&gt;Features Also Create Permanent Decisions&lt;/h3&gt;
&lt;p&gt;A feature isn't just code.&lt;/p&gt;
&lt;p&gt;It creates decisions.&lt;/p&gt;
&lt;p&gt;Once an API is released, users may depend on it.&lt;/p&gt;
&lt;p&gt;Once a database structure is created, changing it can become difficult.&lt;/p&gt;
&lt;p&gt;Once a configuration option exists, someone will eventually use it.&lt;/p&gt;
&lt;p&gt;Once a behavior becomes public, removing it can become a breaking change.&lt;/p&gt;
&lt;p&gt;That's why some &quot;temporary&quot; solutions live for years.&lt;/p&gt;
&lt;h3 id=&quot;before-adding-a-feature-ask-three-questions&quot;&gt;Before Adding a Feature, Ask Three Questions&lt;/h3&gt;
&lt;h4 id=&quot;1-who-actually-needs-it-&quot;&gt;1. Who actually needs it?&lt;/h4&gt;
&lt;p&gt;If only one person requested it, understand the real problem first.&lt;/p&gt;
&lt;p&gt;Sometimes the requested feature is just one possible solution.&lt;/p&gt;
&lt;h4 id=&quot;2-what-existing-behavior-will-it-affect-&quot;&gt;2. What existing behavior will it affect?&lt;/h4&gt;
&lt;p&gt;Look beyond the new code.&lt;/p&gt;
&lt;p&gt;Check:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;APIs&lt;/li&gt;
&lt;li&gt;Database&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Caching&lt;/li&gt;
&lt;li&gt;Background jobs&lt;/li&gt;
&lt;li&gt;Monitoring&lt;/li&gt;
&lt;li&gt;Existing users&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;3-can-we-solve-the-problem-with-less-code-&quot;&gt;3. Can we solve the problem with less code?&lt;/h4&gt;
&lt;p&gt;The best feature isn't always the biggest implementation.&lt;/p&gt;
&lt;p&gt;Sometimes the right solution is:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remove complexity instead of adding functionality.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;the-most-valuable-feature-might-be-removing-one&quot;&gt;The Most Valuable Feature Might Be Removing One&lt;/h3&gt;
&lt;p&gt;Software teams often measure progress by what they add.&lt;/p&gt;
&lt;p&gt;But deleting something can create enormous value.&lt;/p&gt;
&lt;p&gt;Removing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An unused endpoint&lt;/li&gt;
&lt;li&gt;An obsolete dependency&lt;/li&gt;
&lt;li&gt;An old feature flag&lt;/li&gt;
&lt;li&gt;A duplicate service&lt;/li&gt;
&lt;li&gt;A complicated configuration&lt;/li&gt;
&lt;li&gt;Dead code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;can make the entire system easier to maintain.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Less software is often easier software.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;don-t-confuse-activity-with-progress&quot;&gt;Don't Confuse Activity With Progress&lt;/h3&gt;
&lt;p&gt;A team can ship dozens of features and still make the product worse.&lt;/p&gt;
&lt;p&gt;More code doesn't automatically mean more value.&lt;/p&gt;
&lt;p&gt;More tickets closed doesn't automatically mean better software.&lt;/p&gt;
&lt;p&gt;More configuration doesn't automatically mean more flexibility.&lt;/p&gt;
&lt;p&gt;The goal isn't to maximize the amount of software we create.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The goal is to maximize useful outcomes while keeping the system understandable.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;final-thought&quot;&gt;Final Thought&lt;/h3&gt;
&lt;p&gt;Every feature has two costs:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The cost of building it.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;And:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The cost of carrying it forever.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Good developers think about both.&lt;/p&gt;
&lt;p&gt;Before adding another feature, ask whether you're solving a real problem—or simply making the system more complicated.&lt;/p&gt;
&lt;p&gt;Because the hardest code to maintain isn't necessarily bad code.&lt;/p&gt;
&lt;p&gt;Sometimes it's perfectly good code that &lt;strong&gt;should never have existed in the first place.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sumita &lt;br&gt;
 Web Developer&lt;/strong&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/24439/the-feature-is-done-so-why-is-the-project-still-getting-slower</guid>
<pubDate>Tue, 11 Aug 2026 10:15:38 +0000</pubDate>
</item>
<item>
<title>The Architectural Trap: Accessing CONST Attributes Across a Series of Classes</title>
<link>https://coderlegion.com/22934/the-architectural-trap-accessing-const-attributes-across-a-series-of-classes</link>
<description>&lt;p&gt;When building scalable systems, we often need a collection of classes to expose a fixed, read-only configuration value. Whether it is a unique API_ENDPOINT, a DATABASE_TABLE name, or a specific PERMISSIONS_MASK, handling constants across a series of classes looks simple on day one but can quickly turn into an architectural nightmare.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Setting the Foundation: How to Make It&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In modern object-oriented programming, the standard way to declare a constant on a class is by leveraging the static readonly modifiers. This ensures the attribute belongs to the class itself, rather than an instance, and cannot be mutated at runtime.&lt;/p&gt;
&lt;p&gt;TypeScript&lt;br&gt;
class BillingService {&lt;br&gt;
  static readonly SERVICE_TYPE = &quot;BILLING&quot;;&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;class InventoryService {&lt;br&gt;
  static readonly SERVICE_TYPE = &quot;INVENTORY&quot;;&lt;br&gt;
}&lt;br&gt;
This works perfectly when you know exactly which class you are dealing with at compile time. You simply call BillingService.SERVICE_TYPE and move on.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Architectural Breakdown: What Will Be the Problems&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The clean code facade breaks the moment you attempt to handle these classes dynamically. In production environments, you rarely hardcode class names; instead, you process them as an array or a series of registry keys.&lt;/p&gt;
&lt;p&gt;Loss of Type Safety: If you pass a series of these classes into a processing function, standard type systems will treat them as generic constructor functions, wiping out access to the static property unless you resort to unsafe type casting.&lt;/p&gt;
&lt;p&gt;Polymorphism Failure: Subclasses do not inherently enforce or override static properties cleanly through standard interfaces. You cannot enforce a static readonly property on an interface, meaning a developer could easily forget to define the constant on a new service class, causing silent runtime failures.&lt;/p&gt;
&lt;p&gt;Instance vs. Class Metadata Confusion: If your architecture receives an instance of the class rather than the class definition itself, accessing the static attribute requires jumping through hoops like instance.constructor.SERVICE_TYPE, which breaks clean abstraction barriers.&lt;/p&gt;
&lt;p&gt;The Modern Solution: Enforcing Metaclasses and Registry Maps&lt;br&gt;
To resolve this elegantly, we must combine strongly typed class constructors with structural interfaces to enforce static attributes at the compiler level.&lt;/p&gt;
&lt;p&gt;Define a Constructor Interface: Create a specialized type that explicitly mandates the presence of the static constant on the class constructor itself.&lt;/p&gt;
&lt;p&gt;Leverage a Centralized Registry: Pass the series of classes through a strongly typed registry array, ensuring the compiler validates every single class before the application even boots.&lt;/p&gt;
&lt;p&gt;TypeScript&lt;br&gt;
// Enforce the static attribute via a Constructor Interface&lt;br&gt;
interface ServiceConstructor {&lt;br&gt;
  new (...args: any[]): any;&lt;br&gt;
  readonly SERVICE_TYPE: string; // The magic line that enforces the static property&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;// A processing loop that safely extracts the CONST attribute&lt;br&gt;
function initializeServices(services: ServiceConstructor[]) {&lt;br&gt;
  services.forEach((ServiceClass) =&amp;gt; {&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Perfectly type-safe, auto-completed, and validated
const serviceName = ServiceClass.SERVICE_TYPE;
console.log(`Deploying system module: ${serviceName}`);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  });&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;// Registering the series of classes&lt;br&gt;
initializeServices([BillingService, InventoryService]);&lt;br&gt;
By shifting the validation to the type engine, you eliminate runtime tracking bugs entirely and make your codebase highly resilient to future extensions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Visit our official site: www.nextbigcreative.com&lt;/strong&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/22934/the-architectural-trap-accessing-const-attributes-across-a-series-of-classes</guid>
<pubDate>Sat, 18 Jul 2026 06:19:57 +0000</pubDate>
</item>
<item>
<title>How to Format SQL Queries for Better Readability</title>
<link>https://coderlegion.com/22157/how-to-format-sql-queries-for-better-readability</link>
<description>&lt;p&gt;You know the feeling. Someone shares a query in Slack, or you open a &lt;code&gt;.sql&lt;/code&gt; file left behind by a developer who's long gone, and it's just... one giant wall of text. Lowercase here, uppercase there, no line breaks, five joins crammed into a single sentence. You end up scrolling sideways just to figure out what table a column came from.&lt;/p&gt;
&lt;p&gt;That's not a &quot;them&quot; problem. Every SQL developer has written a query like that under deadline pressure. But queries get read far more often than they get written, and a badly formatted one costs everyone — including future you — real time.&lt;/p&gt;
&lt;p&gt;This guide walks through practical, no-nonsense SQL formatting best practices you can start using today. Every rule comes with a before-and-after example, so you can see exactly why the &quot;after&quot; version is easier to work with.&lt;/p&gt;
&lt;h3 id=&quot;why-sql-readability-matters&quot;&gt;Why SQL Readability Matters&lt;/h3&gt;
&lt;p&gt;SQL isn't a private notebook. It's a shared language between developers, analysts, and database administrators — often people who didn't write the original query and have no context for it.&lt;/p&gt;
&lt;p&gt;Readable SQL matters because:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;You'll debug faster.&lt;/strong&gt; When a report breaks at 2 AM, you don't want to spend twenty minutes just figuring out what a query does before you can even start fixing it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Code reviews go quicker.&lt;/strong&gt; A reviewer can catch a logic error in seconds when the structure is clear. They can't catch anything in a 400-character single line.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Onboarding is smoother.&lt;/strong&gt; New team members inherit your queries. Clean formatting is a small kindness that saves them hours.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mistakes get caught earlier.&lt;/strong&gt; Misplaced &lt;code&gt;AND&lt;/code&gt;/&lt;code&gt;OR&lt;/code&gt; logic, missing join conditions, and typo'd column names all hide more easily in dense, unformatted SQL.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here's a quick taste of what a difference formatting makes, even for a simple &lt;code&gt;SELECT&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;select id,name,email,created_at from users where status='active' and created_at&amp;gt;'2023-01-01' order by created_at desc;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;After:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT
    id,
    name,
    email,
    created_at
FROM users
WHERE status = 'active'
    AND created_at &amp;gt; '2023-01-01'
ORDER BY created_at DESC;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Same query, same result set — but the second version tells you what's happening at a glance. Each column has its own line, each clause starts on its own line, and the keywords stand out from the data. That's the whole game.&lt;/p&gt;
&lt;h3 id=&quot;why-poorly-formatted-sql-becomes-hard-to-maintain&quot;&gt;Why Poorly Formatted SQL Becomes Hard to Maintain&lt;/h3&gt;
&lt;p&gt;Unformatted SQL doesn't just look messy — it actively works against you over time.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Git diffs turn into noise.&lt;/strong&gt; If your whole query lives on one line, changing a single condition rewrites the entire line in version control, making it impossible to see what actually changed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Logic errors hide in plain sight.&lt;/strong&gt; A missing parenthesis or a misplaced &lt;code&gt;OR&lt;/code&gt; is easy to miss when everything blends together.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nested queries lose their shape.&lt;/strong&gt; Without indentation, you can't tell which &lt;code&gt;SELECT&lt;/code&gt; belongs to which level of nesting.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Every edit gets riskier.&lt;/strong&gt; When you can't quickly understand a query, you're more likely to introduce a bug while changing it.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;Common Mistake:&lt;/strong&gt; Mixing tabs and spaces in the same file. It looks fine in your editor but turns into a jagged mess in anyone else's, since editors render tab width differently.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;the-real-benefits-of-consistent-sql-formatting&quot;&gt;The Real Benefits of Consistent SQL Formatting&lt;/h3&gt;
&lt;p&gt;Consistent formatting compounds over time. A few concrete payoffs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Faster reviews.&lt;/strong&gt; Reviewers spend their attention on logic, not on decoding structure.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Predictable structure.&lt;/strong&gt; Once you know the pattern, you can scan any query on the team and know where to look for the &lt;code&gt;WHERE&lt;/code&gt; clause, the joins, or the aggregation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cleaner diffs.&lt;/strong&gt; One clause or column per line means version control shows exactly what changed — nothing more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fewer &quot;wait, what does this do?&quot; moments&lt;/strong&gt; during incident response, when you least want to be puzzling over syntax.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;common-sql-formatting-mistakes-developers-make&quot;&gt;Common SQL Formatting Mistakes Developers Make&lt;/h3&gt;
&lt;p&gt;Before we get into the fixes, here's what tends to go wrong most often:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Writing the entire query on a single line.&lt;/li&gt;
&lt;li&gt;Random, inconsistent indentation from line to line.&lt;/li&gt;
&lt;li&gt;Inconsistent capitalization — &lt;code&gt;Select&lt;/code&gt;, &lt;code&gt;SELECT&lt;/code&gt;, and &lt;code&gt;select&lt;/code&gt; all in the same file.&lt;/li&gt;
&lt;li&gt;Vague, meaningless aliases like &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt;, &lt;code&gt;t1&lt;/code&gt;, &lt;code&gt;t2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;No spacing around operators (&lt;code&gt;total&amp;gt;100&lt;/code&gt; instead of &lt;code&gt;total &amp;gt; 100&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Mixing comma-first and comma-last styles in the same codebase.&lt;/li&gt;
&lt;li&gt;Deeply nested subqueries with no indentation to show the hierarchy.&lt;/li&gt;
&lt;li&gt;Skipping comments on non-obvious business logic.&lt;/li&gt;
&lt;li&gt;Lines so long you have to scroll horizontally to read them.&lt;/li&gt;
&lt;li&gt;Join conditions that aren't aligned or grouped clearly.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If a few of those look familiar, don't worry — the rest of this guide fixes each one.&lt;/p&gt;
&lt;h3 id=&quot;proper-indentation-techniques&quot;&gt;Proper Indentation Techniques&lt;/h3&gt;
&lt;p&gt;Indentation is the backbone of readable SQL. The rule is simple: &lt;strong&gt;subordinate clauses and conditions get indented under the keyword they belong to.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pick either 2 or 4 spaces (never tabs, since they render inconsistently across editors and terminals) and stick with it everywhere.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;select * from orders where (status='pending' or status='processing') and customer_id in (select id from customers where region='west' and active=1);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;After:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT *
FROM orders
WHERE (status = 'pending' OR status = 'processing')
    AND customer_id IN (
        SELECT id
        FROM customers
        WHERE region = 'west'
            AND active = 1
    );
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; Indent each subquery one level deeper than its parent. That way, nesting depth is something you can see, not something you have to mentally track.&lt;/p&gt;
&lt;h3 id=&quot;formatting-select-statements&quot;&gt;Formatting SELECT Statements&lt;/h3&gt;
&lt;p&gt;Once you have more than two or three columns, put each one on its own line. It's easier to scan, and it means adding or removing a column later only touches one line in your diff.&lt;/p&gt;
&lt;p&gt;You'll see two common styles for commas:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Comma-last&lt;/strong&gt; (most common, reads like prose):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT
    id,
    name,
    email
FROM users;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Comma-first&lt;/strong&gt; (makes missing or trailing commas easy to spot):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT
    id
    , name
    , email
FROM users;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both are valid. What matters is picking one and using it consistently across your team — mixing the two in the same codebase is what actually causes confusion.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; Avoid &lt;code&gt;SELECT *&lt;/code&gt; outside of quick, exploratory queries. An explicit column list is easier to read, easier to review, and won't silently break your application if someone adds a column to the table later.&lt;/p&gt;
&lt;h3 id=&quot;formatting-where-clauses&quot;&gt;Formatting WHERE Clauses&lt;/h3&gt;
&lt;p&gt;Every condition gets its own line. Boolean operators (&lt;code&gt;AND&lt;/code&gt;, &lt;code&gt;OR&lt;/code&gt;) go at the start of the line, indented under &lt;code&gt;WHERE&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT * FROM orders WHERE status='shipped' AND total&amp;gt;100 AND customer_id IS NOT NULL AND created_at BETWEEN '2024-01-01' AND '2024-12-31' AND region IN ('west','east','central');
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;After:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT *
FROM orders
WHERE status = 'shipped'
    AND total &amp;gt; 100
    AND customer_id IS NOT NULL
    AND created_at BETWEEN '2024-01-01' AND '2024-12-31'
    AND region IN ('west', 'east', 'central');
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you can scan down the left edge and read the filter logic like a checklist, instead of parsing one long run-on sentence.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; When you're mixing &lt;code&gt;AND&lt;/code&gt; and &lt;code&gt;OR&lt;/code&gt; in the same clause, always use parentheses — even when operator precedence would technically get it right without them. It removes any doubt for the next reader.&lt;/p&gt;
&lt;h3 id=&quot;formatting-joins&quot;&gt;Formatting JOINs&lt;/h3&gt;
&lt;p&gt;Always use explicit &lt;code&gt;JOIN ... ON&lt;/code&gt; syntax instead of old-style comma joins. Put each join on its own line, with the &lt;code&gt;ON&lt;/code&gt; condition right after it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;select o.id, c.name, p.title, o.total from orders o, customers c, products p, order_items oi where o.customer_id=c.id and oi.order_id=o.id and oi.product_id=p.id and o.status='completed';
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;After:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT
    o.id,
    c.name,
    p.title,
    o.total
FROM orders o
INNER JOIN customers c ON c.id = o.customer_id
INNER JOIN order_items oi ON oi.order_id = o.id
INNER JOIN products p ON p.id = oi.product_id
WHERE o.status = 'completed';
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Explicit joins separate &quot;how tables connect&quot; from &quot;what rows I want,&quot; which makes the whole query easier to trace top to bottom. You can also add or remove a join without touching the &lt;code&gt;WHERE&lt;/code&gt; clause at all.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;Common Mistake:&lt;/strong&gt; Comma joins put join logic and filter logic in the same place. Forget one join condition, and you've accidentally created a cartesian product — a silent bug that can quietly multiply your row count.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;formatting-group-by-order-by-and-having&quot;&gt;Formatting GROUP BY, ORDER BY, and HAVING&lt;/h3&gt;
&lt;p&gt;Keep every major clause — &lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;FROM&lt;/code&gt;, &lt;code&gt;WHERE&lt;/code&gt;, &lt;code&gt;GROUP BY&lt;/code&gt;, &lt;code&gt;HAVING&lt;/code&gt;, &lt;code&gt;ORDER BY&lt;/code&gt; — starting at the same indentation level (column zero). This &quot;clause skeleton&quot; lets you see the shape of a query in about two seconds.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;select customer_id, count(*) as order_count, sum(total) as total_spent from orders where status='completed' group by customer_id having sum(total)&amp;gt;500 order by total_spent desc;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;After:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT
    customer_id,
    COUNT(*) AS order_count,
    SUM(total) AS total_spent
FROM orders
WHERE status = 'completed'
GROUP BY customer_id
HAVING SUM(total) &amp;gt; 500
ORDER BY total_spent DESC;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you're grouping or ordering by several columns, break those out too:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;GROUP BY
    customer_id,
    region,
    order_year
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;formatting-nested-queries-and-subqueries&quot;&gt;Formatting Nested Queries and Subqueries&lt;/h3&gt;
&lt;p&gt;Each level of nesting gets its own indentation level. This is where formatting discipline pays off the most, because nested logic is exactly where bugs like to hide.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;select name from products where id in (select product_id from order_items where order_id in (select id from orders where customer_id=42));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;After:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT name
FROM products
WHERE id IN (
    SELECT product_id
    FROM order_items
    WHERE order_id IN (
        SELECT id
        FROM orders
        WHERE customer_id = 42
    )
);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; If you find yourself nesting more than two or three levels deep, that's usually a sign to reach for a CTE instead. It's the same logic, but far easier to read top to bottom.&lt;/p&gt;
&lt;h3 id=&quot;formatting-common-table-expressions-ctes-&quot;&gt;Formatting Common Table Expressions (CTEs)&lt;/h3&gt;
&lt;p&gt;CTEs turn nested, hard-to-follow subqueries into named, sequential steps. Here's the same logic from above, rewritten as a CTE:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;WITH customer_orders AS (
    SELECT id
    FROM orders
    WHERE customer_id = 42
),
ordered_items AS (
    SELECT product_id
    FROM order_items
    WHERE order_id IN (SELECT id FROM customer_orders)
)
SELECT name
FROM products
WHERE id IN (SELECT product_id FROM ordered_items);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A few formatting habits that make CTEs easier to work with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Name each CTE for what it represents, not &lt;code&gt;cte1&lt;/code&gt;, &lt;code&gt;cte2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Indent the body of each CTE one level in, and keep the final &lt;code&gt;SELECT&lt;/code&gt; unindented so it's obvious that's the main query.&lt;/li&gt;
&lt;li&gt;Put a blank line between CTEs when you have more than one — it gives your eyes a place to rest between logical steps.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;aliasing-tables-and-columns-clearly&quot;&gt;Aliasing Tables and Columns Clearly&lt;/h3&gt;
&lt;p&gt;Once you're joining more than one table, aliases stop being optional in practice. Use short, meaningful aliases — &lt;code&gt;o&lt;/code&gt; for &lt;code&gt;orders&lt;/code&gt;, &lt;code&gt;c&lt;/code&gt; for &lt;code&gt;customers&lt;/code&gt; — rather than arbitrary letters like &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; that force the reader to scroll back up to the &lt;code&gt;FROM&lt;/code&gt; clause to remember what's what.&lt;/p&gt;
&lt;p&gt;Also alias every computed or aggregated column with &lt;code&gt;AS&lt;/code&gt;, so the result set is self-explanatory:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT
    o.id,
    COUNT(oi.id) AS item_count,
    SUM(oi.price * oi.quantity) AS order_total
FROM orders o
INNER JOIN order_items oi ON oi.order_id = o.id
GROUP BY o.id;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Without &lt;code&gt;AS order_total&lt;/code&gt;, that column would show up as some generated, meaningless expression in your output.&lt;/p&gt;
&lt;h3 id=&quot;consistent-capitalization-strategies&quot;&gt;Consistent Capitalization Strategies&lt;/h3&gt;
&lt;p&gt;The most common convention: &lt;strong&gt;uppercase for SQL keywords, lowercase or snake_case for identifiers.&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT customer_id, order_date
FROM orders
WHERE status = 'completed';
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Some teams — particularly in the modern data/analytics engineering world — prefer everything lowercase, including keywords:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;select customer_id, order_date
from orders
where status = 'completed';
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both are legitimate SQL style guide choices. What actually matters is picking one for your team and applying it everywhere, so readers don't have to context-switch between styles from file to file.&lt;/p&gt;
&lt;h3 id=&quot;spacing-conventions&quot;&gt;Spacing Conventions&lt;/h3&gt;
&lt;p&gt;Small, consistent spacing habits go a long way:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Space around comparison and arithmetic operators: &lt;code&gt;total &amp;gt; 100&lt;/code&gt;, not &lt;code&gt;total&amp;gt;100&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Space after every comma: &lt;code&gt;id, name, email&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;No space between a function name and its parenthesis: &lt;code&gt;COUNT(*)&lt;/code&gt;, not &lt;code&gt;COUNT (*)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;One space before and after &lt;code&gt;AS&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- Avoid
SELECT id,name,COUNT (*) AS cnt FROM orders WHERE total&amp;gt;=100;

-- Prefer
SELECT id, name, COUNT(*) AS cnt
FROM orders
WHERE total &amp;gt;= 100;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;line-breaks&quot;&gt;Line Breaks&lt;/h3&gt;
&lt;p&gt;Use a new line for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Every major clause (&lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;FROM&lt;/code&gt;, &lt;code&gt;WHERE&lt;/code&gt;, &lt;code&gt;JOIN&lt;/code&gt;, &lt;code&gt;GROUP BY&lt;/code&gt;, &lt;code&gt;ORDER BY&lt;/code&gt;, &lt;code&gt;HAVING&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Every column, once you have more than two or three.&lt;/li&gt;
&lt;li&gt;Every &lt;code&gt;JOIN&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Each &lt;code&gt;CTE&lt;/code&gt;, with a blank line separating them for visual breathing room.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The goal isn't &quot;more line breaks are always better&quot; — it's giving each logical piece of the query its own visual space so your eyes can jump straight to the part you need.&lt;/p&gt;
&lt;h3 id=&quot;formatting-case-statements&quot;&gt;Formatting CASE Statements&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;CASE&lt;/code&gt; expressions get unreadable fast when crammed onto one line. Break each &lt;code&gt;WHEN&lt;/code&gt; onto its own line, indented under &lt;code&gt;CASE&lt;/code&gt;, with &lt;code&gt;END&lt;/code&gt; aligned back at the &lt;code&gt;CASE&lt;/code&gt; level.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;select id, case when total&amp;gt;1000 then 'high' when total&amp;gt;500 then 'medium' else 'low' end as tier from orders;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;After:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT
    id,
    CASE
        WHEN total &amp;gt; 1000 THEN 'high'
        WHEN total &amp;gt; 500 THEN 'medium'
        ELSE 'low'
    END AS tier
FROM orders;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This layout makes it trivial to scan the conditions in order and confirm the logic is doing what you expect — especially useful when there are five or six &lt;code&gt;WHEN&lt;/code&gt; branches instead of two.&lt;/p&gt;
&lt;h3 id=&quot;formatting-window-functions-briefly-&quot;&gt;Formatting Window Functions (Briefly)&lt;/h3&gt;
&lt;p&gt;Window functions can get long fast once you add &lt;code&gt;PARTITION BY&lt;/code&gt; and &lt;code&gt;ORDER BY&lt;/code&gt; inside the &lt;code&gt;OVER()&lt;/code&gt; clause. Break those onto their own indented lines so the window definition doesn't blend into the rest of the &lt;code&gt;SELECT&lt;/code&gt; list:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT
    customer_id,
    order_date,
    total,
    SUM(total) OVER (
        PARTITION BY customer_id
        ORDER BY order_date
    ) AS running_total
FROM orders;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This keeps the &quot;what am I calculating&quot; (&lt;code&gt;SUM(total)&lt;/code&gt;) visually separate from the &quot;how is it grouped and ordered&quot; (the &lt;code&gt;OVER()&lt;/code&gt; clause) — two different ideas that shouldn't be squeezed into one dense line.&lt;/p&gt;
&lt;h3 id=&quot;commenting-sql-code-effectively&quot;&gt;Commenting SQL Code Effectively&lt;/h3&gt;
&lt;p&gt;Good comments explain &lt;strong&gt;why&lt;/strong&gt;, not &lt;strong&gt;what&lt;/strong&gt;. The SQL itself already tells the reader what's happening; your comments should fill in context that isn't obvious from the syntax alone.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- Excludes test accounts flagged by the fraud team in March 2024
SELECT *
FROM users
WHERE is_test_account = 0
    AND created_at &amp;gt; '2024-03-01';
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use &lt;code&gt;--&lt;/code&gt; for short, single-line notes and &lt;code&gt;/* ... */&lt;/code&gt; for longer explanations above a complex section of logic.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;Common Mistake:&lt;/strong&gt; Leaving a strange-looking filter or condition uncommented. Six months from now, nobody — including you — will remember why &lt;code&gt;region != 'archived'&lt;/code&gt; needed to be there, and someone will waste an hour rediscovering it (or worse, delete it and break something).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;team-coding-standards-and-sql-style-guides&quot;&gt;Team Coding Standards and SQL Style Guides&lt;/h3&gt;
&lt;p&gt;Formatting debates burn a surprising amount of time in code review — &quot;tabs vs. spaces,&quot; &quot;comma-first vs. comma-last,&quot; &quot;uppercase vs. lowercase.&quot; A short, documented SQL style guide settles these once, instead of relitigating them in every pull request.&lt;/p&gt;
&lt;p&gt;A useful team style guide covers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Capitalization rules for keywords and identifiers.&lt;/li&gt;
&lt;li&gt;Indentation size (2 or 4 spaces).&lt;/li&gt;
&lt;li&gt;Comma placement.&lt;/li&gt;
&lt;li&gt;Alias naming conventions.&lt;/li&gt;
&lt;li&gt;Table and column naming conventions (snake_case is the most common default).&lt;/li&gt;
&lt;li&gt;How and when to use CTEs versus subqueries.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Keep it short — a single &lt;code&gt;STYLE.md&lt;/code&gt; file in your repository is often enough. The goal isn't a rulebook; it's a shared reference so reviewers can say &quot;see the style guide&quot; instead of relitigating formatting from scratch every time.&lt;/p&gt;
&lt;h3 id=&quot;when-automatic-formatting-is-useful&quot;&gt;When Automatic Formatting Is Useful&lt;/h3&gt;
&lt;p&gt;Manually reformatting a long legacy query, or something a teammate pasted in from a spreadsheet export, is tedious — and it's easy to introduce a typo while you're at it.&lt;/p&gt;
&lt;p&gt;That's where automatic formatting tools earn their keep. An online &lt;a rel=&quot;nofollow&quot; href=&quot;https://99tools.net/sql-formatter-beautifier/&quot;&gt;SQL Formatter&lt;/a&gt; can take a dense, single-line query and instantly restructure the indentation, casing, and spacing for you. It's especially handy for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cleaning up inherited or legacy scripts you didn't write.&lt;/li&gt;
&lt;li&gt;Standardizing formatting across a team without manual nitpicking in every review.&lt;/li&gt;
&lt;li&gt;Quickly making sense of a query someone pasted into a chat message.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Automatic formatting is a great starting point, but it's still worth understanding the underlying rules yourself. That way you can fine-tune the output, format queries on the fly at the terminal, and actually catch logic issues instead of just relying on a tool to make things look tidy.&lt;/p&gt;
&lt;h3 id=&quot;common-formatting-conventions-followed-by-professional-developers&quot;&gt;Common Formatting Conventions Followed by Professional Developers&lt;/h3&gt;
&lt;p&gt;If you want a quick checklist to build habits around, most professional SQL style guides agree on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Uppercase keywords, lowercase snake_case identifiers.&lt;/li&gt;
&lt;li&gt;2 or 4 space indentation — never tabs.&lt;/li&gt;
&lt;li&gt;One clause per line.&lt;/li&gt;
&lt;li&gt;One column per line once you're past two or three columns.&lt;/li&gt;
&lt;li&gt;Explicit &lt;code&gt;JOIN&lt;/code&gt; syntax, never comma joins.&lt;/li&gt;
&lt;li&gt;Meaningful, consistent table aliases.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AS&lt;/code&gt; for every derived or aggregated column.&lt;/li&gt;
&lt;li&gt;Parentheses around mixed &lt;code&gt;AND&lt;/code&gt;/&lt;code&gt;OR&lt;/code&gt; logic, even when not strictly required.&lt;/li&gt;
&lt;li&gt;Trailing semicolons on every statement.&lt;/li&gt;
&lt;li&gt;Comments that explain business context, not syntax.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;frequently-asked-questions&quot;&gt;Frequently Asked Questions&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Does SQL formatting affect query performance?&lt;/strong&gt;&lt;br&gt;
No. Whitespace, line breaks, and capitalization don't change how the database engine parses or executes a query. Formatting is entirely for the benefit of the humans reading the code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Should SQL keywords always be uppercase?&lt;/strong&gt;&lt;br&gt;
It's not required, but it's a widely used convention because it visually separates syntax (&lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;WHERE&lt;/code&gt;, &lt;code&gt;JOIN&lt;/code&gt;) from your actual data — table and column names. Pick uppercase or lowercase and apply it consistently.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What's the difference between comma-first and comma-last formatting?&lt;/strong&gt;&lt;br&gt;
Comma-last (the comma at the end of a line) reads more like natural prose. Comma-first (the comma at the start of the next line) makes it easier to spot a missing or accidental trailing comma at a glance. Both are valid — consistency across your team matters more than which one you choose.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How many spaces should I use for indentation in SQL?&lt;/strong&gt;&lt;br&gt;
Two or four spaces are both common choices. Four spaces makes nested subqueries more visually distinct; two spaces keeps deeply nested queries from drifting too far to the right. Avoid tabs, since they render at different widths across editors.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Should I always alias tables, even in single-table queries?&lt;/strong&gt;&lt;br&gt;
It's not necessary for a single-table query, but it becomes important as soon as you join a second table, since it removes any ambiguity about which table a column belongs to.&lt;/p&gt;
&lt;p&gt;*&lt;em&gt;Is it okay to use SELECT &lt;/em&gt; in formatted SQL?**&lt;br&gt;
It works fine for quick, exploratory queries, but it's generally discouraged in production code or reports. An explicit column list is easier to review and won't silently change if someone adds a column to the underlying table later.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How do I format SQL in a way that's friendly to version control?&lt;/strong&gt;&lt;br&gt;
Keep each clause and each column on its own line. That way, a small change — like adding one more column — shows up as a single-line diff instead of rewriting an entire block, which makes reviews much faster.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Can I mix tabs and spaces in the same SQL file?&lt;/strong&gt;&lt;br&gt;
No. Mixed tabs and spaces render inconsistently across different editors and terminals, and it's one of the most common causes of formatting drift on a team. Pick one and configure your editor to enforce it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Do CTEs perform better than subqueries?&lt;/strong&gt;&lt;br&gt;
Not inherently — performance depends on the specific database engine and how it optimizes the query plan. CTEs are primarily a readability tool that lets you break complex logic into named, sequential, easy-to-follow steps.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What's the best way to enforce consistent formatting across a team?&lt;/strong&gt;&lt;br&gt;
Write down your conventions in a short style guide, use an automatic formatter as a shared starting point, and check formatting during code review (or with a pre-commit hook) so it doesn't slip through.&lt;/p&gt;
&lt;h3 id=&quot;wrapping-up&quot;&gt;Wrapping Up&lt;/h3&gt;
&lt;p&gt;SQL formatting isn't about being precious over style — it's a maintenance investment that pays off every time someone (including you) has to read, debug, or extend a query later.&lt;/p&gt;
&lt;p&gt;A few habits carry most of the value:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;One clause per line, one column per line.&lt;/li&gt;
&lt;li&gt;Consistent capitalization and indentation.&lt;/li&gt;
&lt;li&gt;Explicit joins with clear, meaningful aliases.&lt;/li&gt;
&lt;li&gt;Comments that explain the &quot;why,&quot; not the &quot;what.&quot;&lt;/li&gt;
&lt;li&gt;Parentheses whenever &lt;code&gt;AND&lt;/code&gt; and &lt;code&gt;OR&lt;/code&gt; mix.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Build these into your daily workflow and your queries — and your team's — get easier to review, debug, and hand off over time. And when you're short on time or inheriting a messy legacy query, running it through an online SQL Formatter first gives you a clean, consistent starting point you can fine-tune by hand from there.&lt;/p&gt;
</description>
<category>Tutorials</category>
<guid isPermaLink="true">https://coderlegion.com/22157/how-to-format-sql-queries-for-better-readability</guid>
<pubDate>Thu, 09 Jul 2026 12:43:06 +0000</pubDate>
</item>
<item>
<title>Why &quot;Your Code Is LLM&quot; Became the Go-To Insult in Tech</title>
<link>https://coderlegion.com/20513/why-your-code-is-llm-became-the-go-to-insult-in-tech</link>
<description>&lt;p&gt;And why tests, comments, and sensible function names aren't proof of AI—they're proof of a professional.&lt;/p&gt;
&lt;p&gt;Hey.&lt;/p&gt;
&lt;p&gt;I want to break down, surgically and in detail, why calling someone's code &quot;LLM-written&quot; has become a way to devalue programmer's work. And how I've dealt with it myself.&lt;/p&gt;
&lt;p&gt;I'm alexvoste. Yeah, that dev. Instead of explaining my credentials in every post, just swing by my CoderLegion profile and see who I am. It's all there.&lt;/p&gt;
&lt;h3 id=&quot;the-real-problem&quot;&gt;The Real Problem&lt;/h3&gt;
&lt;p&gt;Lately, everyone's started calling other people's code &quot;AI-written.&quot; And it sucks. Seriously.&lt;/p&gt;
&lt;p&gt;You write code. You polish it until it gleams. Everything works. Tests pass:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;go test ./... -cover
go test -race ./...
go test -v ./...
golangci-lint run ./...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Seems fine, right? You run the tests—all green. The code does exactly what you wanted.&lt;/p&gt;
&lt;p&gt;Then someone drops: &quot;This looks like an LLM wrote it.&quot;&lt;/p&gt;
&lt;p&gt;On what grounds? Because the functions have readable names. Because there are comments. Because tests exist.&lt;/p&gt;
&lt;p&gt;When did readable code become a red flag for AI?&lt;/p&gt;
&lt;h3 id=&quot;naming-functions-why-clear-is-good-not-ai-&quot;&gt;Naming Functions: Why Clear is Good, Not &quot;AI&quot;&lt;/h3&gt;
&lt;p&gt;Back in the day, things were simpler. You don't just write code for yourself—you write it for others to understand. Logically, some time passes, and you come back thinking: &quot;What the hell did I even write here?&quot;&lt;/p&gt;
&lt;p&gt;That's wasted time. Wasted on code review. On comprehension.&lt;/p&gt;
&lt;p&gt;Without proper comments and decent function names, a programmer stops being a creator or engineer. You become an archaeologist. You're sitting there with a toothbrush, digging through petrified logic and log fragments, trying to figure out what the original author meant. Often, that's you from six months ago.&lt;/p&gt;
&lt;p&gt;My philosophy: functions should be named after what they do.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bad:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-c&quot;&gt;int printmsg(char *s);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Good:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-c&quot;&gt;int printMessageOnVGA(char *message);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In Go:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-go&quot;&gt;// Bad
func printMsg(s string) string {}

// Good
func PrintMessageOnVGA(message string) string {}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It's a basic ask: make it possible to understand what a function does without a migraine.&lt;/p&gt;
&lt;p&gt;When did writing clear, readable code become the exclusive domain of neural networks?&lt;/p&gt;
&lt;h3 id=&quot;comments-a-separate-art-form&quot;&gt;Comments: A Separate Art Form&lt;/h3&gt;
&lt;p&gt;Know who usually says &quot;comments are proof of LLM&quot;? People who write using AI. Or people who've never maintained legacy code.&lt;/p&gt;
&lt;p&gt;Here's an example of code without comments:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-go&quot;&gt;package main

import (
    &quot;fmt&quot;
    &quot;unsafe&quot;
)

func main() {
    b := []byte{0x23, 0x5D, 0x11, 0x08, 0x46, 0x61, 0x20, 0x0A}
    v := *(*uint64)(unsafe.Pointer(&amp;amp;b[0]))
    r := (v &amp;gt;&amp;gt; 16) | (v &amp;lt;&amp;lt; 48)
    m := r ^ 0x2A2B2C2D2E2F3031
    res := []byte{byte((m &amp;gt;&amp;gt; 24) &amp;amp; 0xFF), byte(m &amp;amp; 0xFF)}
    fmt.Printf(&quot;%s\n&quot;, res)
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At first glance—incomprehensible. Yeah, you &lt;em&gt;can&lt;/em&gt; analyze it, figure it out. But imagine: you're working on a long-term project, digging through legacy code, you dive into a function—and you burn hours trying to understand. Trust me, this example is still pretty small. It gets way messier.&lt;/p&gt;
&lt;p&gt;In situations like this, a comment matters. It explains the logic. It saves hours of suffering.&lt;/p&gt;
&lt;p&gt;But there's a flip side. Too many unnecessary comments are bad:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-go&quot;&gt;// Here we print message on VGA.
func PrintMessageOnVGA(message string) {
    fmt.Println(message)
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Why this comment? We already got it from the function name. That looks unprofessional. Extra comments suck. But &lt;em&gt;no&lt;/em&gt; comments in complex places? Even worse.&lt;/p&gt;
&lt;p&gt;And now everyone's convinced: comments = AI.&lt;/p&gt;
&lt;p&gt;So a developer writes nontrivial, complex code—and for being honest about explaining it, gets slapped with the &quot;LLM&quot; label.&lt;/p&gt;
&lt;p&gt;Hopefully someday devs will see how absurd this is and stop jumping to these conclusions.&lt;/p&gt;
&lt;h3 id=&quot;let-s-get-real-who-are-these-people-&quot;&gt;Let's Get Real: Who Are These People?&lt;/h3&gt;
&lt;p&gt;Who are these folks who think &quot;comments and tests = proof of AI&quot;?&lt;/p&gt;
&lt;p&gt;Usually guys whose own code looks like a plate of spaghetti. Variable names are single letters: a, b, c1, temp_foo. Functions stretch for 800 lines. The only &quot;tests&quot; in the project are running it by hand and saying a prayer.&lt;/p&gt;
&lt;p&gt;For them, quality work became so alien they genuinely believe humans &lt;em&gt;can't&lt;/em&gt; write clean code. It's not that &lt;em&gt;my&lt;/em&gt; code is &quot;AI-level,&quot; it's that &lt;em&gt;their&lt;/em&gt; standards tanked below the baseboards.&lt;/p&gt;
&lt;p&gt;Tech adopted a weird &quot;special snowflake syndrome.&quot; Some people think their messy, convoluted, only-they-understand code is proof of their &quot;human soul&quot; and genius. Like, &quot;I see it this way, it's &lt;em&gt;art&lt;/em&gt;!&quot;&lt;/p&gt;
&lt;p&gt;Nah, buddy. In systems programming, in production, where millions in transactions run or hardware gets managed—your &quot;art&quot; is a potential money pit and sleepless nights for your team. Clean code isn't soulless. It's respect for your colleagues. And for yourself, first and foremost.&lt;/p&gt;
&lt;h3 id=&quot;quick-fact-check-the-linux-kernel-code&quot;&gt;Quick Fact Check: The Linux Kernel Code&lt;/h3&gt;
&lt;p&gt;Are those comments also written by an LLM? Weird how nobody screams &quot;AI-generated&quot; about that.&lt;/p&gt;
&lt;p&gt;Linux kernel code is readable. It has comments. Function names make sense. Nobody loses their mind yelling it's LLM. Because it's engineering work, not &quot;art for art's sake.&quot;&lt;/p&gt;
&lt;p&gt;Plus, when that guy accusing everyone of using AI hits a real legacy project, what's he gonna do? Start stabbing at devs screaming their code is LLM-written? Or finally say thanks that the code is clean and understandable?&lt;/p&gt;
&lt;p&gt;Rhetorical question.&lt;/p&gt;
&lt;h3 id=&quot;tests-why-i-write-them-and-yeah-i-actually-write-them-&quot;&gt;Tests: Why I Write Them (And Yeah, I Actually Write Them)&lt;/h3&gt;
&lt;p&gt;Do you write tests? I do.&lt;/p&gt;
&lt;p&gt;Why do I do it with such heavy coverage? Simple answer:&lt;/p&gt;
&lt;p&gt;Code should have test coverage—at least moderate. 60+ percent? Already solid.&lt;/p&gt;
&lt;p&gt;Tests exist so your platform, app, software, or tool behaves correctly in different scenarios. How else will you spot a leak or security hole? Spend hours debugging yourself? Yeah, didn't think so.&lt;/p&gt;
&lt;p&gt;But a new folk wisdom appeared: &quot;Only LLMs write tests.&quot;&lt;/p&gt;
&lt;p&gt;Since when?&lt;/p&gt;
&lt;p&gt;If everyone in tech complains that writing tests is tedious—that doesn't mean nobody does it. It means good engineers power through the laziness and do their job right.&lt;/p&gt;
&lt;h3 id=&quot;my-take-no-bs-&quot;&gt;My Take (No BS)&lt;/h3&gt;
&lt;p&gt;I'm not defending myself. I'm not gonna say &quot;guys, I don't use AI, you're wrong.&quot; Nah. Opposite.&lt;/p&gt;
&lt;p&gt;I'll admit it straight: I use AI. But only where it's actually useful:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Translation to another language&lt;/li&gt;
&lt;li&gt;Article drafts&lt;/li&gt;
&lt;li&gt;Basic tests (which then get shredded in code review)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Heavy, thorough code review? You can see it from a mile away. But here's the thing—that's not the point.&lt;/p&gt;
&lt;p&gt;Tests cover the code? Task done.&lt;br&gt;
No leaks? No holes? Perfect.&lt;/p&gt;
&lt;h3 id=&quot;the-takeaway-1&quot;&gt;The Takeaway&lt;/h3&gt;
&lt;p&gt;If someone tells you your code looks like LLM output—don't apologize. It's not shameful. AI's a tool.&lt;/p&gt;
&lt;p&gt;But don't let them silence you.&lt;/p&gt;
&lt;p&gt;Your code is yours. Your style, your tests, your comments, your function names—that's your professional fingerprint.&lt;/p&gt;
&lt;p&gt;And if someone calls it &quot;LLM output&quot;? That's their perception problem, not your work problem.&lt;/p&gt;
&lt;p&gt;Write code. Cover it with tests. Name functions clearly. Comment the hard stuff. Don't let anyone devalue what you do.&lt;/p&gt;
&lt;p&gt;And if you run into the next &quot;expert&quot; pointing fingers at LLM? Just drop them a link to this post.&lt;/p&gt;
&lt;h3 id=&quot;one-more-thing&quot;&gt;One More Thing&lt;/h3&gt;
&lt;p&gt;You're a programmer. You do stuff the people criticizing you probably can't. Know why?&lt;/p&gt;
&lt;p&gt;Because it's easier to point at AI than to say:&lt;/p&gt;
&lt;p&gt;&quot;That's solid code. You did good.&quot;&lt;/p&gt;
&lt;p&gt;Yeah, LLMs exist. They're not perfect. But ask yourself—&lt;/p&gt;
&lt;p&gt;Are you really willing to spend hours Googling a question and scrolling through forums forever when you could write:&lt;/p&gt;
&lt;p&gt;&quot;Hey, knock up some tests for me real quick, will ya&quot;?&lt;/p&gt;
&lt;p&gt;You get tests. You tweak them to fit. You polish them by your project's standards. Boom—done.&lt;/p&gt;
&lt;h3 id=&quot;i-ve-been-in-tech-since-before-llms-were-a-thing&quot;&gt;I've Been in Tech Since Before LLMs Were a Thing&lt;/h3&gt;
&lt;p&gt;And you know what? We &lt;em&gt;always&lt;/em&gt; had comments. &lt;em&gt;Always&lt;/em&gt; had sensible function names. You didn't waste time decoding—the devs who wrote the code looked out for you.&lt;/p&gt;
&lt;p&gt;Isn't that the best kind of care?&lt;/p&gt;
&lt;h3 id=&quot;-they-re-writing-so-much-text-must-be-llm-&quot;&gt;&quot;They're Writing So Much Text—Must Be LLM&quot;&lt;/h3&gt;
&lt;p&gt;That's a song of its own.&lt;/p&gt;
&lt;p&gt;Do any of you know 10+ languages fluently? Ready to write professional posts in all of them? Doubt it. If you are—respect.&lt;/p&gt;
&lt;p&gt;An LLM has knowledge of tons of languages packed in. Idioms, constructs, cultural codes. It spits out text easily.&lt;/p&gt;
&lt;p&gt;But here's the thing—&lt;em&gt;you&lt;/em&gt; wrote it. The LLM was just a smart translator. A tool. Not the author.&lt;/p&gt;
&lt;h3 id=&quot;i-didn-t-want-to-hurt-anyone-s-feelings&quot;&gt;I Didn't Want to Hurt Anyone's Feelings&lt;/h3&gt;
&lt;p&gt;But I wanted to push back against these new folk standards that rolled in with the AI era. And if even one person reads this and thinks twice before pointing at someone's code screaming &quot;LLM&quot;—I consider the mission accomplished.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
&lt;p&gt;Hope this helps anyone dealing with the same garbage.&lt;/p&gt;
&lt;p&gt;Drop a comment. Let's talk about this circus we call IT. 👇&lt;/p&gt;
</description>
<category>Discussions</category>
<guid isPermaLink="true">https://coderlegion.com/20513/why-your-code-is-llm-became-the-go-to-insult-in-tech</guid>
<pubDate>Sat, 13 Jun 2026 11:11:23 +0000</pubDate>
</item>
<item>
<title>A recipe for the Perfect Use Case</title>
<link>https://coderlegion.com/18129/a-recipe-for-the-perfect-use-case</link>
<description>&lt;p&gt;Today we’re cooking the perfect Use Case — and &lt;strong&gt;CQRS&lt;/strong&gt; will be our recipe.&lt;/p&gt;
&lt;h3 id=&quot;ingredients&quot;&gt;Ingredients&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Action&lt;/strong&gt; — fire and forget (logout, clear cache)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Query&lt;/strong&gt; — read data (list products)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Command&lt;/strong&gt; — write data (update profile)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exchange&lt;/strong&gt; — transform data (login)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All four types extend a sealed interface:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;sealed interface UseCase&amp;lt;Input, Output&amp;gt; {
    interface Action : UseCase&amp;lt;Unit, Unit&amp;gt;
    interface Query&amp;lt;Output&amp;gt; : UseCase&amp;lt;Unit, Output&amp;gt;
    interface Command&amp;lt;Input&amp;gt; : UseCase&amp;lt;Input, Unit&amp;gt;
    interface Exchange&amp;lt;Input, Output&amp;gt; : UseCase&amp;lt;Input, Output&amp;gt;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=17753012738574751457&quot; alt=&quot;Usecases&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;three-ways-to-season-it&quot;&gt;Three Ways to Season It&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Arrow (Typed Errors)&lt;/strong&gt; — the chef’s choice:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;class GenerateSeed(
    private val seedService: SeedService
) : UseCase.Action {
    override suspend fun Raise&amp;lt;Throwable&amp;gt;.action() =
        seedService.generateSeed().bind()
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Result (Standard Wrapper)&lt;/strong&gt; — zero dependencies:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;class GenerateSeed(private val service: SeedService) : UseCase.Action {
    override suspend fun action() = service.generateSeed().getOrThrow()
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Raw (Direct Execution)&lt;/strong&gt; — zero overhead:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;class GenerateSeed(private val service: SeedService) : UseCase.Action {
    override suspend fun action() = service.generateSeed()
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;why-this-recipe-works&quot;&gt;Why This Recipe Works&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;No more &lt;code&gt;UseCase&amp;lt;Unit, Unit&amp;gt;&lt;/code&gt; noise&lt;/li&gt;
&lt;li&gt;Every use case follows the same structure&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Query&lt;/code&gt; or &lt;code&gt;Command&lt;/code&gt; makes intent obvious&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Full implementation in the &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.github.com/numq/usecase&quot;&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/18129/a-recipe-for-the-perfect-use-case</guid>
<pubDate>Sun, 17 May 2026 04:47:50 +0000</pubDate>
</item>
<item>
<title>Error Handling in NestJS: Best Practices and Examples</title>
<link>https://coderlegion.com/17884/error-handling-in-nestjs-best-practices-and-examples</link>
<description>&lt;p&gt;In any real-world backend application, proper &lt;strong&gt;error handling&lt;/strong&gt; is essential. It ensures that your system doesn't crash unexpectedly, responds clearly to clients, and makes debugging easier for developers. Luckily, &lt;strong&gt;NestJS&lt;/strong&gt; provides powerful tools to do this cleanly and professionally.&lt;/p&gt;
&lt;p&gt;Let’s explore how to handle errors effectively in NestJS using built-in exceptions, global filters, and custom strategies.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;why-is-error-handling-important-&quot;&gt;Why is Error Handling Important?&lt;/h4&gt;
&lt;p&gt;Errors happen: invalid input, missing resources, database failures, unreachable services… A backend that doesn't handle these gracefully will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Crash or hang&lt;/li&gt;
&lt;li&gt;Leak sensitive data&lt;/li&gt;
&lt;li&gt;Return unclear or inconsistent responses&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;NestJS allows us to build resilient APIs that fail smart, not hard.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;-level-1-http-exceptions-built-in-&quot;&gt;✅ Level 1: HTTP Exceptions (Built-in)&lt;/h4&gt;
&lt;p&gt;NestJS offers ready-to-use exception classes like &lt;strong&gt;&lt;em&gt;BadRequestException&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;NotFoundException&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;UnauthorizedException&lt;/em&gt;&lt;/strong&gt;, etc.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@Get(':id')
async findOne(@Param('id') id: string) {
  const user = await this.userService.findById(id);
  if (!user) {
    throw new NotFoundException(`User with ID ${id} not found`);
  }
  return user;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; Nest will automatically respond with a &lt;em&gt;404&lt;/em&gt; and a structured JSON response.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;level-2-global-exception-filter&quot;&gt;Level 2: Global Exception Filter&lt;/h4&gt;
&lt;p&gt;For centralized error handling, you can create a custom exception filter to catch and format all uncaught exceptions globally.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
import {
  ExceptionFilter,
  Catch,
  ArgumentsHost,
  HttpException,
  Logger,
} from '@nestjs/common';

@Catch()
export class AllExceptionsFilter implements ExceptionFilter {
  private readonly logger = new Logger(AllExceptionsFilter.name);

  catch(exception: unknown, host: ArgumentsHost) {
    const ctx = host.switchToHttp();
    const response = ctx.getResponse();

    const status = exception instanceof HttpException
      ? exception.getStatus()
      : 500;

    const message = exception instanceof HttpException
      ? exception.getResponse()
      : 'Internal server error';

    this.logger.error('Exception caught', exception instanceof Error ? exception.stack : '');

    response.status(status).json({
      statusCode: status,
      message,
      timestamp: new Date().toISOString(),
    });
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;enable-it-globally-&quot;&gt;Enable it globally:&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { AllExceptionsFilter } from './common/filters/all-exceptions.filter';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.useGlobalFilters(new AllExceptionsFilter());
  await app.listen(3000);
}
bootstrap();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; Now all unhandled errors are caught and returned with a unified format.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;level-3-custom-exceptions&quot;&gt;Level 3: Custom Exceptions&lt;/h4&gt;
&lt;p&gt;You can define your own domain-specific exceptions for business logic clarity.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
import { BadRequestException } from '@nestjs/common';

export class DuplicatedEmailException extends BadRequestException {
  constructor(email: string) {
    super(`The email ${email} is already registered`);
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use it like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
if (userExists) {
  throw new DuplicatedEmailException(email);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;level-4-automatic-validation-errors-with-class-validator&quot;&gt;Level 4: Automatic Validation Errors with &lt;strong&gt;class-validator&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;When using DTOs with &lt;strong&gt;&lt;em&gt;class-validator&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;ValidationPipe&lt;/em&gt;&lt;/strong&gt;, NestJS handles validation errors out of the box.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
@IsEmail()
email: string;

@MinLength(6)
password: string;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Enable it globally in &lt;strong&gt;main.ts:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;app.useGlobalPipes(new ValidationPipe());
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; This will respond with &lt;strong&gt;&lt;em&gt;400 Bad Request&lt;/em&gt;&lt;/strong&gt; if the input doesn't meet the defined constraints.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;bonus-error-handling-in-microservices&quot;&gt;Bonus: Error Handling in Microservices&lt;/h4&gt;
&lt;p&gt;If you're using NestJS with &lt;strong&gt;Kafka&lt;/strong&gt;, &lt;strong&gt;RabbitMQ&lt;/strong&gt;, or other transport layers, use &lt;strong&gt;&lt;em&gt;RpcException&lt;/em&gt;&lt;/strong&gt; inside your message handlers:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
@MessagePattern('create-user')
async createUser(data: CreateUserDto) {
  try {
    return await this.userService.create(data);
  } catch (error) {
    throw new RpcException('Error creating user');
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This prevents crashes and enables proper retry or dead-letter strategies in your messaging system.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;final-thoughts-1&quot;&gt;Final Thoughts&lt;/h4&gt;
&lt;p&gt;Error handling in NestJS is not just about catching bugs—it's about building services that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Are &lt;strong&gt;user-friendly&lt;/strong&gt; (clear responses)&lt;/li&gt;
&lt;li&gt;Are &lt;strong&gt;developer-friendly&lt;/strong&gt; (structured logs and debugging)&lt;/li&gt;
&lt;li&gt;Follow &lt;strong&gt;clean architecture&lt;/strong&gt; and &lt;strong&gt;domain logic&lt;/strong&gt; boundaries&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By combining exception filters, DTO validation, and custom errors, you’ll write APIs that are &lt;strong&gt;robust&lt;/strong&gt;, &lt;strong&gt;scalable&lt;/strong&gt;, and &lt;strong&gt;production-ready&lt;/strong&gt;.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/17884/error-handling-in-nestjs-best-practices-and-examples</guid>
<pubDate>Thu, 14 May 2026 16:33:59 +0000</pubDate>
</item>
<item>
<title>Corporate Amnesia: What Happens When Your Team Forgets How Its Own Code Works</title>
<link>https://coderlegion.com/17831/corporate-amnesia-what-happens-when-your-team-forgets-how-its-own-code-works</link>
<description>&lt;p&gt;A few months ago, we had to change a small piece of logic.&lt;/p&gt;
&lt;p&gt;It sounded simple.&lt;br&gt;
A minor tweak.&lt;br&gt;
“Shouldn’t take more than a couple of hours.”&lt;/p&gt;
&lt;p&gt;Then someone asked:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;“Do we know how this actually works?”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Silence.&lt;/p&gt;
&lt;p&gt;No one on the team had written that part.&lt;br&gt;
The last person who touched it had left.&lt;br&gt;
There was no documentation.&lt;br&gt;
Tests were… optimistic.&lt;/p&gt;
&lt;p&gt;What should have been a small change turned into a half-day investigation.&lt;/p&gt;
&lt;p&gt;Not because the problem was hard.&lt;/p&gt;
&lt;p&gt;Because the knowledge was gone.&lt;/p&gt;
&lt;hr&gt;
&lt;h5 id=&quot;tl-dr&quot;&gt;TL;DR&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Teams don’t just lose code quality over time, they lose &lt;strong&gt;understanding&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Documentation alone doesn’t solve it, &lt;strong&gt;readable and maintainable code does&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Preventing knowledge loss is a &lt;strong&gt;business problem&lt;/strong&gt;, not just a technical one.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;table-of-contents&quot;&gt;Table of Contents&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#what-is-corporate-amnesia&quot;&gt;What Is Corporate Amnesia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#how-knowledge-actually-gets-lost&quot;&gt;How Knowledge Actually Gets Lost&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#the-real-cost-its-not-just-time&quot;&gt;The Real Cost (It’s Not Just Time)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#why-documentation-alone-doesnt-save-you&quot;&gt;Why Documentation Alone Doesn’t Save You&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#code-as-the-single-source-of-truth&quot;&gt;Code as the Single Source of Truth&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#a-real-example-it-works-dont-touch-it&quot;&gt;A Real Example: “It Works, Don’t Touch It”&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#how-to-build-a-memoryresilient-codebase&quot;&gt;How to Build a Memory-Resilient Codebase&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#knowledge-handover-checklist&quot;&gt;Knowledge Handover Checklist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#final-thoughts&quot;&gt;Final Thoughts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-is-corporate-amnesia&quot;&gt;What Is Corporate Amnesia&lt;/h3&gt;
&lt;p&gt;Corporate amnesia happens when a team loses the knowledge needed to confidently work on its own system.&lt;/p&gt;
&lt;p&gt;It doesn’t happen all at once.&lt;/p&gt;
&lt;p&gt;It’s gradual.&lt;/p&gt;
&lt;p&gt;A developer leaves.&lt;br&gt;
Another switches teams.&lt;br&gt;
A feature is built quickly and never revisited.&lt;/p&gt;
&lt;p&gt;Over time, fewer and fewer people understand how things actually work.&lt;/p&gt;
&lt;p&gt;Eventually, you end up with a codebase that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;technically works&lt;/li&gt;
&lt;li&gt;but no one fully understands&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And that’s where things start slowing down.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;how-knowledge-actually-gets-lost&quot;&gt;How Knowledge Actually Gets Lost&lt;/h3&gt;
&lt;p&gt;It’s easy to blame turnover.&lt;/p&gt;
&lt;p&gt;But that’s only part of the story.&lt;/p&gt;
&lt;p&gt;Knowledge gets lost when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;decisions are not documented&lt;/li&gt;
&lt;li&gt;code is hard to read or follow&lt;/li&gt;
&lt;li&gt;logic is duplicated instead of centralized&lt;/li&gt;
&lt;li&gt;context lives in people’s heads, not in the system&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And most importantly:&lt;/p&gt;
&lt;p&gt; when teams optimize for delivery, but not for clarity&lt;/p&gt;
&lt;p&gt;Shipping fast is important.&lt;/p&gt;
&lt;p&gt;But if clarity doesn’t follow, knowledge decays.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-real-cost-it-s-not-just-time-&quot;&gt;The Real Cost (It’s Not Just Time)&lt;/h3&gt;
&lt;p&gt;At first, the cost looks like time.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;tasks take longer&lt;/li&gt;
&lt;li&gt;debugging becomes slower&lt;/li&gt;
&lt;li&gt;onboarding is harder&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But the real cost is deeper.&lt;/p&gt;
&lt;p&gt;You start seeing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;hesitation to change existing code&lt;/li&gt;
&lt;li&gt;over-engineering “just to be safe”&lt;/li&gt;
&lt;li&gt;duplicated features instead of modifying existing ones&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And eventually:&lt;/p&gt;
&lt;p&gt; the team stops trusting the codebase&lt;/p&gt;
&lt;p&gt;That’s when velocity drops.&lt;/p&gt;
&lt;p&gt;Not because developers are slower.&lt;/p&gt;
&lt;p&gt;But because the system is harder to work with.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;why-documentation-alone-doesn-t-save-you&quot;&gt;Why Documentation Alone Doesn’t Save You&lt;/h3&gt;
&lt;p&gt;The instinctive solution is:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;“We need better documentation.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And yes, documentation helps.&lt;/p&gt;
&lt;p&gt;But it has a problem.&lt;/p&gt;
&lt;p&gt;It gets outdated.&lt;/p&gt;
&lt;p&gt;Fast.&lt;/p&gt;
&lt;p&gt;Code evolves.&lt;br&gt;
Docs don’t always keep up.&lt;/p&gt;
&lt;p&gt;And after a while, you’re not sure which one to trust.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;code-as-the-single-source-of-truth&quot;&gt;Code as the Single Source of Truth&lt;/h3&gt;
&lt;p&gt;Good teams treat code as documentation.&lt;/p&gt;
&lt;p&gt;Not by writing comments everywhere.&lt;/p&gt;
&lt;p&gt;But by writing code that explains itself.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;function calculateFinalPrice(price, discount, tax) {
  return price - discount + tax
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;vs&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;function calculateFinalPrice(price, discount, tax) {
  const discountedPrice = applyDiscount(price, discount)
  const finalPrice = applyTax(discountedPrice, tax)

  return finalPrice
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both work.&lt;/p&gt;
&lt;p&gt;Only one communicates intent.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Readable code does a few important things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;reduces the need for external documentation&lt;/li&gt;
&lt;li&gt;makes onboarding faster&lt;/li&gt;
&lt;li&gt;preserves knowledge inside the system&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because the goal isn’t to explain the code somewhere else.&lt;/p&gt;
&lt;p&gt;It’s to make the code explain itself.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;a-real-example-it-works-don-t-touch-it-&quot;&gt;A Real Example: “It Works, Don’t Touch It”&lt;/h3&gt;
&lt;p&gt;Every codebase has one.&lt;/p&gt;
&lt;p&gt;A file or module that everyone avoids.&lt;/p&gt;
&lt;p&gt;You open it and see something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;if (type === &quot;A&quot;) {
  // complex logic
} else if (type === &quot;B&quot;) {
  // slightly different logic
} else if (type === &quot;C&quot;) {
  // copied and modified logic
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No clear structure.&lt;br&gt;
No clear intent.&lt;br&gt;
No clear ownership.&lt;/p&gt;
&lt;p&gt;And someone eventually says:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;“It works. Let’s not touch it.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That’s not stability.&lt;/p&gt;
&lt;p&gt;That’s fear.&lt;/p&gt;
&lt;p&gt;And fear is one of the clearest signals of lost knowledge.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;how-to-build-a-memory-resilient-codebase&quot;&gt;How to Build a Memory-Resilient Codebase&lt;/h3&gt;
&lt;p&gt;You can’t prevent people from leaving.&lt;/p&gt;
&lt;p&gt;But you can prevent knowledge from leaving with them.&lt;/p&gt;
&lt;p&gt;A few practices make a big difference:&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;make-decisions-visible&quot;&gt;Make decisions visible&lt;/h4&gt;
&lt;p&gt;Not everything belongs in code.&lt;/p&gt;
&lt;p&gt;But key decisions should be easy to find.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;why something was built a certain way&lt;/li&gt;
&lt;li&gt;trade-offs that were made&lt;/li&gt;
&lt;li&gt;known limitations&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even lightweight notes help.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;optimize-for-readability&quot;&gt;Optimize for readability&lt;/h4&gt;
&lt;p&gt;Readable code is not a luxury.&lt;/p&gt;
&lt;p&gt;It’s a form of knowledge preservation.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;clear naming&lt;/li&gt;
&lt;li&gt;small functions&lt;/li&gt;
&lt;li&gt;explicit logic&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are not style choices.&lt;/p&gt;
&lt;p&gt;They’re long-term investments.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;prefer-structure-over-cleverness&quot;&gt;Prefer structure over cleverness&lt;/h4&gt;
&lt;p&gt;Clever code is hard to remember.&lt;/p&gt;
&lt;p&gt;Simple, structured code is easier to rebuild mentally.&lt;/p&gt;
&lt;p&gt;And that’s what you want.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;share-ownership&quot;&gt;Share ownership&lt;/h4&gt;
&lt;p&gt;If only one person understands a part of the system, that’s a risk.&lt;/p&gt;
&lt;p&gt;Code reviews, pair programming, and rotations help distribute knowledge.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;refactor-before-it-s-too-late&quot;&gt;Refactor before it’s too late&lt;/h4&gt;
&lt;p&gt;The longer you wait, the more knowledge you lose.&lt;/p&gt;
&lt;p&gt;Refactoring is not just about code quality.&lt;/p&gt;
&lt;p&gt;It’s about &lt;strong&gt;keeping understanding alive&lt;/strong&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;knowledge-handover-checklist&quot;&gt;Knowledge Handover Checklist&lt;/h3&gt;
&lt;p&gt;Most teams don’t lose knowledge suddenly.&lt;/p&gt;
&lt;p&gt;They lose it during transitions.&lt;/p&gt;
&lt;p&gt;Someone leaves.&lt;br&gt;
Someone changes role.&lt;br&gt;
Someone moves to another project.&lt;/p&gt;
&lt;p&gt;And the handover?&lt;/p&gt;
&lt;p&gt;Often rushed.&lt;br&gt;
Sometimes skipped.&lt;/p&gt;
&lt;p&gt;If you want to avoid that, you don’t need a long process.&lt;/p&gt;
&lt;p&gt;You need a simple, repeatable checklist.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;before-someone-leaves-or-switches-context-&quot;&gt;Before someone leaves (or switches context)&lt;/h4&gt;
&lt;p&gt;Make sure these things are covered:&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;1. Critical areas are identified&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What parts of the system does this person know best?&lt;/li&gt;
&lt;li&gt;Which components would be risky without them?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; If you don’t know this, that’s already a signal.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;2. Key flows are explained, not just code&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How does the system behave end-to-end?&lt;/li&gt;
&lt;li&gt;What are the important business rules?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Code shows &lt;em&gt;how&lt;/em&gt;.&lt;br&gt;
You also need &lt;em&gt;why&lt;/em&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;3. Known pitfalls are documented&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;edge cases&lt;/li&gt;
&lt;li&gt;fragile areas&lt;/li&gt;
&lt;li&gt;“this breaks if you change X”&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are things you rarely find in code, but always matter.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;4. Decisions and trade-offs are captured&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;why this approach was chosen&lt;/li&gt;
&lt;li&gt;what alternatives were considered&lt;/li&gt;
&lt;li&gt;what constraints existed&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Without this, future changes become guesswork.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;5. Ownership is reassigned clearly&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;who is responsible for this part now?&lt;/li&gt;
&lt;li&gt;who reviews changes?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ambiguity here leads to neglect.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;6. A real walkthrough happens&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Not just docs.&lt;br&gt;
Not just links.&lt;/p&gt;
&lt;p&gt; A real session:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;open the code&lt;/li&gt;
&lt;li&gt;walk through real scenarios&lt;/li&gt;
&lt;li&gt;answer questions live&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is where most knowledge transfer actually happens.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;small-rule-that-makes-a-big-difference&quot;&gt;Small rule that makes a big difference&lt;/h4&gt;
&lt;p&gt;Don’t treat handover as a one-time event.&lt;/p&gt;
&lt;p&gt;Treat it as a &lt;strong&gt;continuous habit&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;share context during development&lt;/li&gt;
&lt;li&gt;explain decisions in PRs&lt;/li&gt;
&lt;li&gt;avoid knowledge silos early&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because the best handover is the one you barely need.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;final-thoughts-2&quot;&gt;Final Thoughts&lt;/h3&gt;
&lt;p&gt;Corporate amnesia doesn’t happen because teams are careless.&lt;/p&gt;
&lt;p&gt;It happens because knowledge isn’t treated as something that needs to be preserved.&lt;/p&gt;
&lt;p&gt;Codebases don’t just store logic.&lt;/p&gt;
&lt;p&gt;They store decisions, context, and understanding.&lt;/p&gt;
&lt;p&gt;And when that disappears, everything becomes harder.&lt;/p&gt;
&lt;p&gt;The goal isn’t to remember everything.&lt;/p&gt;
&lt;p&gt;It’s to make sure the system remembers for you.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;If this resonated with you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Leave a ❤️ reaction&lt;/li&gt;
&lt;li&gt;Share a part of your codebase that nobody wants to touch&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And if you enjoy this kind of content, follow me here on CoderLegion for more.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/17831/corporate-amnesia-what-happens-when-your-team-forgets-how-its-own-code-works</guid>
<pubDate>Thu, 14 May 2026 13:02:28 +0000</pubDate>
</item>
<item>
<title>Keep Code Left: The Art of Readable Logic</title>
<link>https://coderlegion.com/16357/keep-code-left-the-art-of-readable-logic</link>
<description>&lt;p&gt;In 2015, while working at Software Andina, I had the privilege of attending a session that changed the way I look at a source file. At the time, we were frequently visited by developers from the United States who shared their expertise to help us sharpen our craft.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0l8fz5dt6elkdysoi45.png&quot; alt=&quot;Image description&quot;&gt;&lt;/p&gt;
&lt;p&gt;One of those visitors was Mick Andrew, a seasoned developer and Director of Development at Sage. He was a close friend of my boss at the time, John Rutherfurd, and he brought with him a presentation titled &lt;strong&gt;&quot;Keep Code Left&quot; (KCL)&lt;/strong&gt;.  &lt;/p&gt;
&lt;p&gt;The title was deceptively simple, but the philosophy behind it was profound. As developers, we often focus on making code work, but we frequently forget that code is read far more often than it is written. Mick taught us that by following a few &quot;cookbook&quot; rules, we could transform convoluted, deeply nested logic into something clean, linear, and remarkably easy to maintain.&lt;br&gt;
What is Keep Code Left?&lt;/p&gt;
&lt;p&gt;At its core, Keep Code Left is a coding style designed to maximize readability. The name refers to the visual structure of the code: the more your logic is indented (pushed to the right), the harder it becomes for a human brain to track the &quot;state&quot; and the flow of the program.  &lt;/p&gt;
&lt;p&gt;The goals of KCL are straightforward:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;    Simplify Logic&lt;/strong&gt;: Create code that flows linearly rather than branching out.  &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;    Enhance Readability&lt;/strong&gt;: Allow developers to &quot;see the flow&quot; and grasp the goal of a method at a glance.  &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;    Reduce Maintenance Bugs&lt;/strong&gt;: Simple code is harder to break during future updates.  &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;    Streamline Reviews&lt;/strong&gt;: It provides a standard that can be verified during code reviews without needing deep domain knowledge.  &lt;/p&gt;
&lt;p&gt;Since that day in 2015, I have applied these rules to nearly every project I’ve touched. In this post, I’ll break down exactly how to &quot;Keep Code Left&quot; and why your future self (and your team) will thank you for it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why “Keep Code Left” Matters&lt;/strong&gt;&lt;br&gt;
When code becomes deeply nested, several problems appear:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Harder to read line-by-line&lt;/li&gt;
&lt;li&gt;Logic becomes difficult to follow&lt;/li&gt;
&lt;li&gt;Increased risk of bugs&lt;/li&gt;
&lt;li&gt;Slower code reviews&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;KCL aims to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplify logic&lt;/li&gt;
&lt;li&gt;Reduce indentation&lt;/li&gt;
&lt;li&gt;Make flow visible at a glance&lt;/li&gt;
&lt;li&gt;Enable faster and more reliable reviews&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;The Core Principle&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Avoid unnecessary nesting. Prefer early exits and linear flow.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Instead of wrapping logic inside multiple if blocks, you &lt;strong&gt;handle edge cases early and return immediately.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example 1: Nested Code (Bad)&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;public void ProcessOrder(Order order)
{
    if (order != null)
    {
        if (order.IsValid())
        {
            if (order.Items.Count &amp;gt; 0)
            {
                // Process order
                Save(order);
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Problems:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;3 levels of nesting&lt;/li&gt;
&lt;li&gt;Hard to scan quickly&lt;/li&gt;
&lt;li&gt;Main logic is buried&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example 1: Keep Code Left (Better)&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;public void ProcessOrder(Order order)
{
    if (order == null) return;
    if (!order.IsValid()) return;
    if (order.Items.Count == 0) return;

    // Process order
    Save(order);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Flat structure&lt;/li&gt;
&lt;li&gt;Easy to read top-to-bottom&lt;/li&gt;
&lt;li&gt;Main logic is immediately visible&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example 2: Conditional Complexity&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Bad Approach&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;if (user) {
    if (user.isActive) {
        if (!user.isBlocked) {
            sendEmail(user);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;KCL Approach&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;if (!user) return;
if (!user.isActive) return;
if (user.isBlocked) return;

sendEmail(user);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;**Key Techniques of Keep Code Left&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Early Returns&lt;br&gt;
**&lt;br&gt;
Handle invalid cases first:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;def process(data):
    if data is None:
        return
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;2. Guard Clauses&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Protect your logic from bad inputs:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;if (user == null) return;
if (!user.hasPermission()) return;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;3. Reduce Indentation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Every level of indentation increases cognitive load.&lt;/p&gt;
&lt;p&gt;Bad:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;if (a)
{
    if (b)
    {
        if (c)
        {
            DoSomething();
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Better:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;if (!a || !b || !c) return;

DoSomething();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;4. Focus on the “Happy Path”&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The main logic should be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Straightforward&lt;/li&gt;
&lt;li&gt;Easy to locate&lt;/li&gt;
&lt;li&gt;Not buried inside conditions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Impact on Code Reviews&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;KCL is extremely effective in reviews because:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Patterns are easy to detect&lt;/li&gt;
&lt;li&gt;Less domain knowledge is required&lt;/li&gt;
&lt;li&gt;Reviewers can quickly spot:&lt;/li&gt;
&lt;li&gt;Missing checks&lt;/li&gt;
&lt;li&gt;Logical errors&lt;/li&gt;
&lt;li&gt;Anti-patterns&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Mental Model&lt;/strong&gt;&lt;br&gt;
When writing code, ask:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can I exit earlier?&lt;/li&gt;
&lt;li&gt;Can I reduce one level of indentation?&lt;/li&gt;
&lt;li&gt;Is the main logic immediately visible?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Real-World Benefit&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Over time, applying KCL leads to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fewer bugs&lt;/li&gt;
&lt;li&gt;Faster onboarding of new developers&lt;/li&gt;
&lt;li&gt;Cleaner diffs in pull requests&lt;/li&gt;
&lt;li&gt;More maintainable systems&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Keep Code Left (KCL) Guidelines for AI&lt;/strong&gt;&lt;br&gt;
Applying Keep Code Left (KCL) principles when working with AI assistants is important because, by default, they tend to generate code that is correct but unnecessarily nested. This makes the code harder to read, review, and maintain over time. By explicitly enforcing simple rules like early returns and minimal indentation, you guide the AI to produce cleaner, more linear code that aligns better with how humans understand logic. This reduces cognitive load, speeds up code reviews, and improves long-term maintainability.&lt;/p&gt;
&lt;p&gt;Claude.MD Example:&lt;/p&gt;
&lt;h5 id=&quot;example-claude-md&quot;&gt;Example: Claude &lt;code&gt;.md&lt;/code&gt;&lt;/h5&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;md
## KCL Rules
- Use early returns
- Avoid nested if statements
- Keep code flat and readable

### Example

Bad:
if (user) {
    if (user.isActive) {
        process(user);
    }
}

Good:
if (!user) return;
if (!user.isActive) return;

process(user);
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/16357/keep-code-left-the-art-of-readable-logic</guid>
<pubDate>Sat, 02 May 2026 01:46:53 +0000</pubDate>
</item>
<item>
<title>Software Engineering Great Quotes</title>
<link>https://coderlegion.com/13786/software-engineering-great-quotes</link>
<description>&lt;p&gt;&lt;em&gt;A short thought can bring amazing ideas&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;TL;DR: There are some great quotes I've been collecting.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I use them as inspiration or a motto for some articles.&lt;/p&gt;
&lt;p&gt;Here we go:&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;First make the change easy (warning: this might be hard), then make the easy change.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Kent Beck&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Good judgement comes from experience, and experience comes from bad judgement.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Frederick P. Brooks&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Object thinking focuses our attention on the problem space rather than the solution space. Object thinkers take the advice of Plato, Parnas, Fred Brooks, Christopher Alexander, and many others by letting the problem define its own solution&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;David West&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Voluminous documentation is part of the problem, not part of the solution.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Tom DeMarco&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Before you use a method in a legacy system, check to see if there are tests for it. If there aren't, write them. When you do this consistently, you use tests as a medium of communication.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Michael Feathers&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The biggest issue on software teams is making sure everyone understands what everyone else is doing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Martin Fowler&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Object thinking focuses our attention on the problem space rather than the solution space.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;David West&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Programming isn't about what you know; it's about what you can figure out.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Chris Pine&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The best way to start fixing a bug is to make it reproducible. After all, if you can't reproduce it, how will you know if it is ever fixed?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Andrew Hunt&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The danger from computers is not that they will eventually get as smart as men, but that we will meanwhile agree to meet them halfway.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Bernard Avishai&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The only truly secure system is one that is powered off, cast in a block of concrete and sealed in a lead-lined room with armed guards.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Gene Spafford&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;I've finally learned what 'upward compatible' means. It means we get to keep all our old mistakes.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Dennie van Tassel&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If it doesn't work, it doesn't matter how fast it doesn't work.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Mich Ravera&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If you lie to the compiler, it will get its revenge.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Henry Spencer&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Final source code is the real software design.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Jack Reeves&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Make it correct, make it clear, make it concise, make it fast. In that order.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Wes Dyer&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If someone claims to have the perfect programming language, he is either a fool or a salesman or both.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Bjarne Stroustrup&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If you can get today's work done today, but you do it in such a way that you can't possibly get tomorrow's work done tomorrow, then you lose.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Martin Fowler&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;There's nothing more permanent than a temporary hack.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Kyle Simpson&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The purpose of computing is insight, not numbers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Richard Hamming&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Software and cathedrals are much the same. First we build them, then we pray.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Sam Redwine&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Discovery consists of seeing what everyone else has seen and thinking what no one else has thought.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Albert Szent-Gyorgi&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Eighty percent of all input forms ask questions they have no business asking.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Mike Garey&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A primary cause of complexity is that software vendors uncritically adopt almost any feature that users want.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Niklaus Wirth&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Programs, like people, get old. We can't prevent aging, but we can understand its causes, limit its effects and reverse some of the damage.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Mario Fusco&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Bugs lurk in corners and congregate at boundaries.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Boris Beizer&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Simple systems are not feasible because they require infinite testing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Norman Ralph Augustine&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;C is quirky, flawed, and an enormous success.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Dennis M. Ritchie&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Conceptual integrity is the most important consideration in system design.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Frederick P. Brooks&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;I can't be as confident about computer science as I can about biology. Biology easily has 500 years of exciting problems to work on. It's at that level.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Donald Knuth&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Don't worry about design, if you listen to your code a good design will appear...Listen to the technical people. If they are complaining about the difficulty of making changes, then take such complaints seriously and give them time to fix things.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Martin Fowler&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;It is far easier to design a class to be thread-safe than to retrofit it for thread safety later.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Brian Goetz&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Defect-free software doesn't exist.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Wietse Venema&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Just because something is easy to measure doesn't mean it's important.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;David Heinemeier Hansson&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Behavior is the most important thing about software. It is what users depend on. Users like it when we add behavior (provided it is what they really wanted), but if we change or remove behavior they depend on (introduce bugs), they stop trusting us.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Michael Feathers&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Code should be remarkably expressive to avoid most of the comments. There'll be a few exceptions, but we should see comments as an 'failure of expression' until proven wrong.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Robert Martin&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Builder pattern is more verbose than the telescoping constructor pattern, so it should be used only if there are enough parameters, say, four or more.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Joshua Bloch&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Complexity is a sign of technical immaturity. Simplicity of use is the real sign of a well design product whether it is an ATM or a Patriot missile.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Daniel T. Ling&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;We are constantly interfacing with other people's code that might not live up to our high standards and dealing with inputs that may or may not be valid. So we are taught to code defensively. We use assertions to detect bad data and check for consistency.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Andrew Hunt&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Don't use humans for jobs computers can do better - this is a waste of human energy and creativity, the only real resource on this planet, and demeans the human spirit.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;J. Paul Morrison&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;On two occasions, I have been asked [by members of Parliament], &quot;if you put into the machine wrong figures, will the right answers come out?&quot;...I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Charles Babbage&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Forget this world and all its troubles and if possible its multitudinous Charlatans - everything in short but the Enchantress of Numbers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Ada Lovelace&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;While it is a known fact that programmers never make mistakes, it is still a good idea to humor the users by checking for errors at critical points in your program.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Robert D. Schneider&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;First, solve the problem. Then, write the code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;John Johnson&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The main activity of programming is not the origination of new independent programs, but in the integration, modification, and explanation of existing ones.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Terry Winograd&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;This 'users are idiots, and are confused by functionality' mentality of Gnome is a disease. If you think your users are idiots, only idiots will use it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Linus Torvalds&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The best programmers write only easy programs.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Michael A. Jackson&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If Mc Donalds were run like a software company, one out of every hundred Big Macs would give you food poisoning — and the response would be, &quot;We're sorry, here's a coupon for two more&quot;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Mark Minasi&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Tell me and I forget. Teach me and I remember. Involve me and I learn.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Benjamin Franklin&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Programmers are often angry because they're often scared.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Paul Ford&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Rules of Optimization: Rule 1: Don't do it. Rule 2 (for experts only): Don't do it yet.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Michael A. Jackson&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If you think technology can solve your security problems, then you don't understand the problems and you don't understand the technology.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Bruce Schneier&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;This fascination with computer models is something I understand very well. Richard Feynman called it a disease. I fear he is right.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Michael Crichton&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Criticism isn't just disliking things. Arts schools teach the skill &amp;amp; the respect for the work. Computer science schools don't.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Kent Beck&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Brian W. Kernighan&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Feedback is essential to our ability to learn. Without fast, effective feedback, we are guessing. Both the speed and the quality of feedback matter. If feedback is too late, it is useless. If it is misleading or wrong, the decisions that we make will be wrong, too&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Dave Farley&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Defects are not free. Somebody makes them, and gets paid for making them.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Edwards Deming&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The heart of software is its ability to solve domain-related problems for its user. All other features, vital though they may be, support this basic purpose.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Eric Evans&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Errors have occurred. We won't tell you where or why. Lazy programmers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Charlie Gibbs&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Any man can make mistakes, but only an idiot persists in his error.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Marcus Cicero&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If you have to spend effort to decipher code, you should rewrite it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Martin Golding&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;More good code has been written in languages denounced as &quot;bad&quot; than in languages proclaimed &quot;wonderful&quot; — much more.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Bjarne Stroustrup&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;C. A. R. Hoare&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;When I first got into technology I didn't really understand what open source was. Once I started writing software, I realized how important this would be.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Matt Mullenweg&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The problem is, in software design, often the consequences of your decisions don't become apparent for years.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Kent Beck&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Being forced to write comments actually improves code, because it is easier to fix a crock than to explain it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;G. Steele&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;We crave for new sensations but soon become indifferent to them. Wonders of yesterday are today common occurrences.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Nikola Tesla&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Tests should be even more readable then the code they cover&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Shaun Wessel&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A function name should be a verb or a verb phrase, and it needs to be meaningful&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Robert C. Martin&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Pair programmers: Keep each other on task. Brainstorm refinements to the system. Clarify ideas. Take initiative when their partner is stuck, thus lowering frustration. Hold each other accountable to the team's practices.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Kent Beck&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Obsolete comments tend to migrate away from the code they once described. They become floating islands of irrelevance and misdirection in the code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Bob Martin&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If you are choosing a JavaScript library purely based on popularity, I think you deserve what you get.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Tom Dale&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Today, most software exists, not to solve a problem, but to interface with other software.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;I Angell&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;On almost anything someone does in the computer business, you can go back in the literature and prove someone had done it earlier.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Ken Olsen&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Computers are good at following instructions, but not at reading your mind.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Donald Knuth&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The question of whether a computer can think is no more interesting than the question of whether a submarine can swim.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Edsger W. Dijkstra&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A bad system will beat a good person every time.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Edwards Deming&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The fantastic element that explain the appeal of dungeon games to many programmers is neither the fire-breathing monsters nor the milkyskinned, semi-clad sirens; it is the experience of carrying out a task from start to finish without user requirements changing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Thomas Holaday&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Computer science is a restless infant and its progress depends as much on shifts in point of view as on the orderly development of our current concepts.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Alan Perlis&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Sun Microsystems had the right people to make Java into a first-class language, and I believe it was the Sun marketing people who rushed the thing out before it should have gotten out.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Alan Kay&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Code is design&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Ward Cunningham&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A well installed microcode bug will be almost impossible to detect.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Ken Thompson&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Science is what we understand well enough to explain to a computer, Art is all the rest&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Donald Knuth&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The cardinal rule of writing unmaintainable code is to specify each fact in as many places as possible and in as many ways as possible.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Roedy Green&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Programs must be written for people to read, and only incidentally for machines to execute.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Harold Abelson&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Feedback is the breakfast of champions.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Ken Blanchard&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If you make a general statement, a programmer says, 'Yes, but...' while a designer says, 'Yes, and...'&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;André Bensoussan&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Every Time you Encounter a Testability Problem, there's an Underlying Design Problem&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Michael Feathers&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Memory is like an orgasm. It's a lot better if you don't have to fake it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Seymour Cray&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Email is a wonderful thing for people whose role in life is to be on top of things. But not for me; my role is to be on the bottom of things. What I do takes long hours of studying and uninterruptible concentration&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Don Knuth&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A bug is never just a mistake. It represents something bigger.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Sergey Zefirov&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;You can't communicate complexity, only an awareness of it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Alan Perlis&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A distributed system is one in which the failure of a computer you didn't even know existed can render your own computer unusable.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Leslie Lamport&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The greatest obstacle to discovery is not ignorance, but the illusion of knowledge.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Daniel Boorstin&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Programmers are as emotional and irrational as normal people.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Douglas Crockford&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;There is nothing so useless as doing efficiently that which should not be done at all.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Peter Drucker&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Computer science research is different from these more traditional disciplines. It differs from the physical sciences because it seeks not to discover, explain, or exploit the natural world, but instead to study the properties of machines of human creation&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Dennis Ritchie&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;You can mass-produce hardware; you can't mass-produce software; you can't mass-produce the human mind.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Michio Kaku&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Coding is about writing code while programming is coding and thinking&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Leslie Lamport&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Testing leads to failure, and failure leads to understanding.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Burt Rutan&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The lesson is: Even if you know exactly what is going on in your system, measure performance, don't speculate. You'll learn something, and nine times out of ten, it won't be that you were right!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Ron Jeffries&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Software engineering is not the same thing as computer science, though we often confuse the two. We need both software engineers and computer scientists.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Dave Farley&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Languages that try to disallow idiocy become themselves idiotic.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Rob Pike&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Watch the little things; a small leak will sink a great ship.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Benjamin Franklin&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;No one hates software more than software developers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Jeff Atwood&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Come to think of it, there are already a million monkeys on a million typewriters, and Usenet is nothing like Shakespeare.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Blair Houghton&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A good enough first version will take longer to produce with $170K than it would have with $0K.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Jason Fried&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The objective of cleaning is not just to clean, but to feel happiness living within that environment.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Marie Kondo&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;When I write software, I know that it will fail, either due to my own mistake, or due to some other cause.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Wietse Venema&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Objects are there for the picking.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Bertrand Meyer&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Spaghetti code is a program with its logic tangled like spaghetti. Avoid the tangles, and you simplify your life.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Martin Fowler&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Instead of working on a feature until it is &quot;finished&quot;, CI and its big brother CD demand of us to make changes in small steps and have something ready for use after every small step. This changes how we think about the design of our system in some important ways.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Dave Farley&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Don't Live with Broken Windows&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Andy Hunt&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Programmers don't burn out on hard work, they burn out on change-with-the-wind directives and not 'shipping'.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Mark Berry&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;It is hard to write even the smallest piece of code correctly.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Joshua Bloch&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;If you have three pet dogs, give them names. If you have 10,000 head of cattle, don't bother. Nowadays, the idea of giving a name to every file on your computer is ridiculous.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;David Gelernter&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The computer programmer is a creator of universes for which he alone is the lawgiver. No playwright, no stage director, no emperor, however powerful, has exercised such absolute authority to arrange a stage or field of battle.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Joseph Weizenbaum&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;It would be nice if products and programming languages were designed to have only good parts.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Douglas Crockford&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A good programmer is someone who always looks both ways before crossing a one-way street.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Doug Linder&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Alzheimer's Law of Programming: Looking at code you wrote more than two weeks ago is like looking at code you are seeing for the first time.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Dan Hurvitz&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;The amateur software engineer is always in search of magic.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Grady Booch&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Truth can only be found in one place: the code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Robert C. Martin&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;So much complexity in software comes from trying to make one thing do two things.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Ryan Singer&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make all fields final unless they need to be mutable.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Brian Goetz&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Any code of your own that you haven't looked at for six or more months might as well have been written by someone else.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Eagleson's Law&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;One day my daughter came in, looked over my shoulder at some Perl 4 code, and said, &quot;What is that, swearing?&quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Larry Wall&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;I think it's very important to get more women into computing. My slogan is: Computing is too important to be left to men.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Karen Spärck Jones&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Code is like humor. When you have to explain it, it's bad.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Cory House&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Code should be written to be read by humans first, and machines second.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Don Laabs&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Smart data structures and dumb code works a lot better than the other way around.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Eric Raymond&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Legacy code is code without tests.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Michael Feathers&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Simplicity is hard to build, easy to use, and hard to charge for. Complexity is easy to build, hard to use, and easy to charge for.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Chris Sacca&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;I try to think mostly in terms of preconditions, and checking things in the constructor and the beginning of a function.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Brad Fitzpatrick&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;Developer testing is an important step towards accountability. It gives developers a way to demonstrate the quality of the software they produce.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Kent Beck&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;We argue that design practices which take a data-driven approach fail to maximize encapsulation because they focus too quickly on the implementation of objects. We propose an alternative object-oriented design method which takes a responsibility-driven approach.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Rebecca Wirfs-Brock&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;There are two ways to write error-free programs; only the third one works.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Alan J. Perlis&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;blockquote&gt;&lt;p&gt;A true professional doesn't waste the time and money of other people by handing over software that is not reasonably free of obvious bugs; that has not undergone minimal unit testing; that doesn't meet the specifications and requirements; that is gold-plated with unnecessary features; or that looks like junk.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Daniel Read&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Part of the objective of this series of articles is to generate spaces for debate and discussion on software design.&lt;/p&gt;
&lt;p&gt;We look forward to comments and suggestions on this article.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/13786/software-engineering-great-quotes</guid>
<pubDate>Tue, 31 Mar 2026 17:29:28 +0000</pubDate>
</item>
<item>
<title>React Components vs Spaghetti: 5 Signs Your UI Is Becoming Unmaintainable</title>
<link>https://coderlegion.com/13415/react-components-vs-spaghetti-5-signs-your-ui-is-becoming-unmaintainable</link>
<description>&lt;p&gt;Last week I opened a React component… and immediately closed it.&lt;/p&gt;
&lt;p&gt;Not because it was complex.&lt;/p&gt;
&lt;p&gt;But because it felt &lt;em&gt;hostile&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;You know that feeling: the file keeps scrolling, props are flying around, and every small change feels like it might break something completely unrelated.&lt;/p&gt;
&lt;p&gt;That’s not complexity.&lt;/p&gt;
&lt;p&gt;That’s entropy.&lt;/p&gt;
&lt;p&gt;And if you’ve been building UIs for a while, you’ve probably seen it happen slowly, almost invisibly.&lt;/p&gt;
&lt;p&gt;Let’s talk about the signals before things get out of hand.&lt;/p&gt;
&lt;blockquote&gt;&lt;h4 id=&quot;tl-dr-1&quot;&gt;TL;DR&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;If your React components start feeling &lt;strong&gt;hard to read, fragile, or unpredictable&lt;/strong&gt;, your UI is likely becoming unmaintainable.&lt;/li&gt;
&lt;li&gt;The most common signals are &lt;strong&gt;oversized components, props drilling, unclear responsibilities, duplication, and messy conditionals&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You don’t need a rewrite, just &lt;strong&gt;small, consistent refactoring habits&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;table-of-contents-1&quot;&gt;Table of Contents&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#the-problem-with-it-still-works-&quot;&gt;The Problem with “It Still Works”&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#1-the-god-component-too-big-to-understand-&quot;&gt;1. The God Component (Too Big to Understand)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#2-props-drilling-everywhere&quot;&gt;2. Props Drilling Everywhere&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#3-confusing-responsibilities&quot;&gt;3. Confusing Responsibilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#4-ui-logic-duplication&quot;&gt;4. UI Logic Duplication&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#5-conditional-rendering-hell&quot;&gt;5. Conditional Rendering Hell&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#bonus-signs-you-shouldnt-ignore&quot;&gt;Bonus Signs You Shouldn’t Ignore&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#mini-refactoring-from-spaghetti-to-clean&quot;&gt;Mini Refactoring: From Spaghetti to Clean&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#practical-refactoring-rituals&quot;&gt;Practical Refactoring Rituals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#final-thoughts&quot;&gt;Final Thoughts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-problem-with-it-still-works-&quot;&gt;The Problem with “It Still Works”&lt;/h3&gt;
&lt;p&gt;Most messy UIs don’t start messy.&lt;/p&gt;
&lt;p&gt;They start small, clear, even elegant.&lt;/p&gt;
&lt;p&gt;Then a feature gets added.&lt;/p&gt;
&lt;p&gt;Then another one.&lt;/p&gt;
&lt;p&gt;Then a quick fix before a deadline.&lt;/p&gt;
&lt;p&gt;Nothing dramatic, just small decisions that make sense in the moment.&lt;/p&gt;
&lt;p&gt;Until one day you open a file and realize you don’t really &lt;em&gt;understand it anymore&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;That’s the moment where “it still works” becomes dangerous.&lt;/p&gt;
&lt;p&gt;Because now every change carries risk.&lt;/p&gt;
&lt;p&gt;And the cost of touching the code becomes higher than leaving it alone.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;1-the-god-component-too-big-to-understand-&quot;&gt;1. The God Component (Too Big to Understand)&lt;/h3&gt;
&lt;p&gt;There’s usually one file in every project that everyone avoids.&lt;/p&gt;
&lt;p&gt;It’s big. Really big.&lt;/p&gt;
&lt;p&gt;It handles data, UI, state, events, and probably a few side effects too.&lt;/p&gt;
&lt;p&gt;Something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;export default function Dashboard({ user, posts }: Props) {
  // fetching logic
  // filtering logic
  // UI rendering
  // event handlers
  // conditionals everywhere

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;{user.name}&amp;lt;/h1&amp;gt;
      {/* hundreds of lines */}
    &amp;lt;/div&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The issue isn’t just the size.&lt;/p&gt;
&lt;p&gt;It’s the lack of boundaries.&lt;/p&gt;
&lt;p&gt;When everything lives in the same place, nothing is clearly defined.&lt;/p&gt;
&lt;p&gt;You don’t know what’s safe to change and what might break something else.&lt;/p&gt;
&lt;p&gt;A useful rule I rely on is simple:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;If you can’t describe a component in one sentence, it’s doing too much.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Breaking it down doesn’t mean over-engineering.&lt;/p&gt;
&lt;p&gt;It means restoring clarity.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;export function Dashboard() {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;UserHeader/&amp;gt;
      &amp;lt;PostList/&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now each piece has a purpose.&lt;/p&gt;
&lt;p&gt;And more importantly, a limit.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;2-props-drilling-everywhere&quot;&gt;2. Props Drilling Everywhere&lt;/h3&gt;
&lt;p&gt;Props drilling usually starts innocently.&lt;/p&gt;
&lt;p&gt;You pass &lt;code&gt;user&lt;/code&gt; from a parent to a child, then to another child, then another.&lt;/p&gt;
&lt;p&gt;Until you end up here:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;&amp;lt;Dashboard user={user}&amp;gt;
  &amp;lt;Sidebar user={user}&amp;gt;
    &amp;lt;UserAvatar user={user}/&amp;gt;
  &amp;lt;/Sidebar&amp;gt;
&amp;lt;/Dashboard&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At this point, some components are just acting as pipelines.&lt;/p&gt;
&lt;p&gt;They don’t use the data, they just pass it along.&lt;/p&gt;
&lt;p&gt;That creates a subtle kind of friction.&lt;/p&gt;
&lt;p&gt;Every layer becomes aware of something it doesn’t actually care about.&lt;/p&gt;
&lt;p&gt;And any change to that data ripples through the entire tree.&lt;/p&gt;
&lt;p&gt;The obvious solution is often:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;“Let’s use Context.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And that’s valid… but only to a point.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Context is not a silver bullet.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Overusing it can make your app harder to reason about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;data becomes less explicit&lt;/li&gt;
&lt;li&gt;re-renders become harder to control&lt;/li&gt;
&lt;li&gt;tracing where values come from gets tricky&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A better approach is to use it &lt;strong&gt;intentionally&lt;/strong&gt;, when it actually solves a real problem:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;truly global data (auth, theme, user)&lt;/li&gt;
&lt;li&gt;deeply shared state&lt;/li&gt;
&lt;li&gt;repeated props drilling across many levels&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Combined with a custom hook, it stays clean:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;function useUser() {
  return useContext(UserContext)
}

function UserAvatar() {
  const user = useUser()
  return &amp;lt;img src={user.avatar} /&amp;gt;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the dependency lives exactly where it’s needed.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;3-confusing-responsibilities&quot;&gt;3. Confusing Responsibilities&lt;/h3&gt;
&lt;p&gt;Sometimes the problem isn’t visible at a glance.&lt;/p&gt;
&lt;p&gt;It’s not about how much code there is, but about &lt;em&gt;what kind&lt;/em&gt; of work is happening in the same place.&lt;/p&gt;
&lt;p&gt;A single component handling:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;data fetching&lt;/li&gt;
&lt;li&gt;state management&lt;/li&gt;
&lt;li&gt;transformation&lt;/li&gt;
&lt;li&gt;rendering&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;…is doing too many different jobs.&lt;/p&gt;
&lt;p&gt;The result is cognitive overload.&lt;/p&gt;
&lt;p&gt;You open the file and constantly switch context:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;“Am I reading UI? Or logic? Or data?”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That friction slows everything down.&lt;/p&gt;
&lt;p&gt;Separating responsibilities makes the code easier to navigate and easier to trust.&lt;/p&gt;
&lt;p&gt;A simple split already helps a lot:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;function usePosts() {
  // fetch + transform
}

function PostList() {
  const posts = usePosts()
  return (...)
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the component reads like a story again, not a puzzle.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;4-ui-logic-duplication&quot;&gt;4. UI Logic Duplication&lt;/h3&gt;
&lt;p&gt;Duplication doesn’t always look like copy-paste.&lt;/p&gt;
&lt;p&gt;Sometimes it shows up as repeated patterns:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;if (isLoading) return &amp;lt;Spinner /&amp;gt;
if (error) return &amp;lt;Error /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You write it once.&lt;/p&gt;
&lt;p&gt;Then again.&lt;/p&gt;
&lt;p&gt;Then again.&lt;/p&gt;
&lt;p&gt;At some point, changing that behavior means updating multiple places.&lt;/p&gt;
&lt;p&gt;That’s when it becomes expensive.&lt;/p&gt;
&lt;p&gt;Extracting shared logic is less about abstraction and more about &lt;strong&gt;centralizing decisions&lt;/strong&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;function DataState({ loading, error, children }: Props) {
  if (loading) return &amp;lt;Spinner /&amp;gt;
  if (error) return &amp;lt;Error /&amp;gt;
  return children
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the behavior lives in one place.&lt;/p&gt;
&lt;p&gt;And your UI becomes more consistent by default.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;5-conditional-rendering-hell&quot;&gt;5. Conditional Rendering Hell&lt;/h3&gt;
&lt;p&gt;Conditional rendering is fine.&lt;/p&gt;
&lt;p&gt;Until it isn’t.&lt;/p&gt;
&lt;p&gt;We’ve all written something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;return isAdmin
  ? isActive
    ? &amp;lt;AdminPanel /&amp;gt;
    : &amp;lt;InactiveAdmin /&amp;gt;
  : &amp;lt;UserPanel /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It works.&lt;/p&gt;
&lt;p&gt;But it’s not easy to read.&lt;/p&gt;
&lt;p&gt;The problem isn’t React.&lt;/p&gt;
&lt;p&gt;It’s that too much logic is living inside JSX.&lt;/p&gt;
&lt;p&gt;A first step is to move that logic out:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;function renderContent() {
  if (isAdmin &amp;amp;&amp;amp; isActive) return &amp;lt;AdminPanel /&amp;gt;
  if (isAdmin) return &amp;lt;InactiveAdmin /&amp;gt;
  return &amp;lt;UserPanel /&amp;gt;
}

return renderContent()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Already much better.&lt;/p&gt;
&lt;h4 id=&quot;using-guard-clauses&quot;&gt;Using Guard Clauses&lt;/h4&gt;
&lt;p&gt;Guard clauses can make this even clearer, when used carefully.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;if (!isAdmin) {
  return &amp;lt;UserPanel /&amp;gt;
}

if (!isActive) {
  return &amp;lt;InactiveAdmin /&amp;gt;
}

return &amp;lt;AdminPanel /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This removes nesting and keeps the flow linear.&lt;/p&gt;
&lt;p&gt;The key is balance.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use guard clauses when they simplify the flow&lt;/li&gt;
&lt;li&gt;avoid stacking too many negative conditions&lt;/li&gt;
&lt;li&gt;keep the logic readable from top to bottom&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The goal isn’t fewer lines.&lt;/p&gt;
&lt;p&gt;It’s clarity.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;bonus-signs-you-shouldn-t-ignore&quot;&gt;Bonus Signs You Shouldn’t Ignore&lt;/h3&gt;
&lt;p&gt;Sometimes the signals are less technical and more instinctive.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You hesitate before opening a file&lt;/li&gt;
&lt;li&gt;You’re afraid to change something&lt;/li&gt;
&lt;li&gt;Fixing a bug feels risky&lt;/li&gt;
&lt;li&gt;You’ve said “let’s not touch this” more than once&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are all valid warnings.&lt;/p&gt;
&lt;p&gt;And they usually show up before bigger problems.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;mini-refactoring-from-spaghetti-to-clean&quot;&gt;Mini Refactoring: From Spaghetti to Clean&lt;/h3&gt;
&lt;p&gt;A while ago I ran into a component like this.&lt;/p&gt;
&lt;p&gt;It wasn’t broken.&lt;/p&gt;
&lt;p&gt;It wasn’t even that complex.&lt;/p&gt;
&lt;p&gt;But it had that feeling:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;“There’s just a bit too much going on here.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4 id=&quot;-before&quot;&gt;❌ Before&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;export default function Dashboard({ user, posts }: Props) {
  const [filter, setFilter] = useState(&quot;all&quot;)

  const filteredPosts = posts.filter(p =&amp;gt;
    filter === &quot;all&quot; ? true : p.type === filter
  )

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;{user.name}&amp;lt;/h1&amp;gt;

      &amp;lt;select onChange={e =&amp;gt; setFilter(e.target.value)}&amp;gt;
        &amp;lt;option value=&quot;all&quot;&amp;gt;All&amp;lt;/option&amp;gt;
        &amp;lt;option value=&quot;tech&quot;&amp;gt;Tech&amp;lt;/option&amp;gt;
      &amp;lt;/select&amp;gt;

      {filteredPosts.length === 0 ? (
        &amp;lt;p&amp;gt;No posts&amp;lt;/p&amp;gt;
      ) : (
        filteredPosts.map(p =&amp;gt; &amp;lt;div key={p.id}&amp;gt;{p.title}&amp;lt;/div&amp;gt;)
      )}
    &amp;lt;/div&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nothing wrong, technically.&lt;/p&gt;
&lt;p&gt;But everything is mixed together:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;state&lt;/li&gt;
&lt;li&gt;logic&lt;/li&gt;
&lt;li&gt;UI&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So I started small.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;step-1-isolate-the-logic&quot;&gt;Step 1: isolate the logic&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;function useFilteredPosts(posts: Post[]) {
  const [filter, setFilter] = useState(&quot;all&quot;)

  const filtered = posts.filter(post =&amp;gt;
    filter === &quot;all&quot; ? true : post.type === filter
  )

  return { filter, setFilter, filtered }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the component doesn’t care &lt;em&gt;how&lt;/em&gt; filtering works.&lt;/p&gt;
&lt;hr&gt;
&lt;h4 id=&quot;step-2-extract-reusable-ui&quot;&gt;Step 2: extract reusable UI&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;function PostFilter({ value, onChange }: Props) {
  return (
    &amp;lt;select value={value} onChange={e =&amp;gt; onChange(e.target.value)}&amp;gt;
      &amp;lt;option value=&quot;all&quot;&amp;gt;All&amp;lt;/option&amp;gt;
      &amp;lt;option value=&quot;tech&quot;&amp;gt;Tech&amp;lt;/option&amp;gt;
    &amp;lt;/select&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;h4 id=&quot;step-3-compose-everything&quot;&gt;Step 3: compose everything&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-tsx&quot;&gt;export default function Dashboard({ user, posts }: Props) {
  const { filter, setFilter, filtered } = useFilteredPosts(posts)

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;{user.name}&amp;lt;/h1&amp;gt;

      &amp;lt;PostFilter value={filter} onChange={setFilter} /&amp;gt;

      {filtered.length === 0 ? (
        &amp;lt;p&amp;gt;No posts&amp;lt;/p&amp;gt;
      ) : (
        filtered.map(p =&amp;gt; &amp;lt;div key={p.id}&amp;gt;{p.title}&amp;lt;/div&amp;gt;)
      )}
    &amp;lt;/div&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Same feature.&lt;/p&gt;
&lt;p&gt;Completely different feeling.&lt;/p&gt;
&lt;p&gt;That’s the real goal of refactoring.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;practical-refactoring-rituals&quot;&gt;Practical Refactoring Rituals&lt;/h3&gt;
&lt;p&gt;You don’t need a full rewrite to fix spaghetti code.&lt;/p&gt;
&lt;p&gt;You need habits.&lt;/p&gt;
&lt;p&gt;Refactoring works best when it’s part of your workflow, not something you postpone.&lt;/p&gt;
&lt;p&gt;A few simple ones:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;extract things early, when they start feeling “off”&lt;/li&gt;
&lt;li&gt;keep components focused on one responsibility&lt;/li&gt;
&lt;li&gt;move growing logic into hooks&lt;/li&gt;
&lt;li&gt;spend time naming things clearly&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;None of these are revolutionary.&lt;/p&gt;
&lt;p&gt;But together, they make your codebase easier to work with.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;final-thoughts-3&quot;&gt;Final Thoughts&lt;/h3&gt;
&lt;p&gt;Spaghetti UI isn’t a failure.&lt;/p&gt;
&lt;p&gt;It’s what happens when real features meet real constraints.&lt;/p&gt;
&lt;p&gt;But if you ignore it, it slowly turns your codebase into something you avoid instead of something you trust.&lt;/p&gt;
&lt;p&gt;The good news is, you don’t need perfection.&lt;/p&gt;
&lt;p&gt;Just small improvements, applied consistently.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;If this article resonated with you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Leave a ❤️ reaction&lt;/li&gt;
&lt;li&gt;Drop a like&lt;/li&gt;
&lt;li&gt;Share the worst component you’ve ever written (or seen) in the comments&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And if you enjoy this kind of content, follow me here for more.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/13415/react-components-vs-spaghetti-5-signs-your-ui-is-becoming-unmaintainable</guid>
<pubDate>Tue, 24 Mar 2026 09:52:34 +0000</pubDate>
</item>
<item>
<title>Code doesn’t quit, but people do: Clean Code, Technical Debt, and the Bus Factor</title>
<link>https://coderlegion.com/12939/code-doesnt-quit-but-people-do-clean-code-technical-debt-and-the-bus-factor</link>
<description>&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Technical debt isn’t just a developer inconvenience, it’s a &lt;strong&gt;business risk with compound interest&lt;/strong&gt;. When developers leave, they often take the &lt;em&gt;“why”&lt;/em&gt; behind the code with them.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;p&gt;Clean Code isn’t about perfection: it’s about &lt;strong&gt;preserving knowledge inside the system&lt;/strong&gt;, instead of inside someone’s head.  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Not long ago I finished my MBA and, looking at my work from a more business-oriented perspective, I came to an interesting realization: &lt;strong&gt;developers&lt;/strong&gt; and &lt;strong&gt;stakeholders&lt;/strong&gt; are actually afraid of the exact same thing, they just describe it using different words.&lt;/p&gt;
&lt;p&gt;Welcome to the &lt;strong&gt;Bus Factor&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This article explores how &lt;strong&gt;Clean Code, technical debt, and knowledge transfer&lt;/strong&gt; affect real business risks like developer turnover, onboarding speed, and team scalability.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;a-small-mba-realization&quot;&gt;A small MBA realization&lt;/h3&gt;
&lt;p&gt;I recently closed my &lt;strong&gt;MBA&lt;/strong&gt;, and among all the talk of spreadsheets and market positioning, I had a &quot;Eureka&quot; moment.  &lt;/p&gt;
&lt;p&gt;I realized that &lt;strong&gt;developers and business stakeholders often speak completely different languages&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We (the devs) talk about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Refactoring and patterns  &lt;/li&gt;
&lt;li&gt;Technical debt  &lt;/li&gt;
&lt;li&gt;Code quality  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Meanwhile, the business side talks about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Risk mitigation  &lt;/li&gt;
&lt;li&gt;Turnover and ROI  &lt;/li&gt;
&lt;li&gt;Scalability and productivity  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Different slides, different meetings, different coffee. But the kicker: &lt;strong&gt;we are actually afraid of the exact same thing&lt;/strong&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-bus-factor&quot;&gt;The Bus Factor&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Bus Factor&lt;/strong&gt; answers a slightly dark question:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;How many people can leave before the project becomes a serious risk?&lt;/em&gt;  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If the answer is &lt;strong&gt;one&lt;/strong&gt;, I have bad news for you. Your project has a Bus Factor of 1, and your company is basically running a &lt;strong&gt;software hostage situation&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This happens more often than we'd like to admit.&lt;/p&gt;
&lt;p&gt;One developer knows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How the authentication flow actually works  &lt;/li&gt;
&lt;li&gt;Why the billing logic requires three retries and a silent prayer  &lt;/li&gt;
&lt;li&gt;What that &quot;temporary hack&quot; from 2019 is still doing there  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And suddenly that developer leaves.&lt;/p&gt;
&lt;p&gt;New job.&lt;br&gt;
New city.&lt;br&gt;
Maybe a goat farm in New Zealand.&lt;/p&gt;
&lt;p&gt;And just like that…&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;the company loses part of its brain.&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;corporate-amnesia&quot;&gt;Corporate Amnesia&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Corporate Amnesia&lt;/strong&gt; happens when developers leave, taking with them &lt;strong&gt;institutional knowledge&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Context:&lt;/strong&gt; Why this technology or design was chosen  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Constraints:&lt;/strong&gt; Hidden pitfalls and fragile areas of the code  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Trade-offs:&lt;/strong&gt; Decisions and compromises made over time  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even the best documentation can become outdated if not constantly maintained.  &lt;/p&gt;
&lt;p&gt;If the codebase looks like a &lt;strong&gt;museum of experimental spaghetti&lt;/strong&gt;, all that knowledge is diluted or lost. The product exists, but nobody fully understands &lt;em&gt;how&lt;/em&gt; it works anymore. &lt;/p&gt;
&lt;p&gt;That is not just a technical problem, that's a &lt;strong&gt;serious financial risk&lt;/strong&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-ghost-of-developers-past&quot;&gt;The Ghost of Developers Past&lt;/h3&gt;
&lt;p&gt;Every developer has experienced this:&lt;/p&gt;
&lt;p&gt;You open a file.&lt;br&gt;
You scroll.&lt;br&gt;
And scroll again.  &lt;/p&gt;
&lt;p&gt;Then you find it: A &lt;strong&gt;500-line &lt;code&gt;useEffect()&lt;/code&gt;&lt;/strong&gt;, with no comments and variables like &lt;code&gt;temp&lt;/code&gt;, &lt;code&gt;data2&lt;/code&gt;, and &lt;code&gt;finalFinalVersion&lt;/code&gt;.  &lt;/p&gt;
&lt;p&gt;Git history? The author left the company two years ago. Possibly raising goats in New Zealand.  &lt;/p&gt;
&lt;p&gt;You’re staring at a &lt;strong&gt;haunted codehouse&lt;/strong&gt;: too risky to delete, impossible to touch safely.&lt;br&gt;
This is the &lt;strong&gt;Ghost of Developers Past&lt;/strong&gt;, silently costing thousands in lost productivity every day.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;clean-code-as-knowledge-transfer&quot;&gt;Clean Code as Knowledge Transfer&lt;/h3&gt;
&lt;p&gt;This is where Clean Code changes perspective.&lt;/p&gt;
&lt;p&gt;Clean Code is not aesthetic, it’s &lt;strong&gt;strategic communication&lt;/strong&gt;.  &lt;/p&gt;
&lt;p&gt;When code is clean, knowledge stays in the system even when people leave. Every future developer understands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What the code does  &lt;/li&gt;
&lt;li&gt;Why it exists  &lt;/li&gt;
&lt;li&gt;How it interacts with the system &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;without scheduling a meeting with archaeology experts. &lt;/p&gt;
&lt;p&gt;Let's take this example: &lt;/p&gt;
&lt;h4 id=&quot;-the-cryptic-way&quot;&gt;❌ The Cryptic Way&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;function processData(d){
  let t = d.filter(x =&amp;gt; x.a)
  let r = []
  for(let i=0; i&amp;lt;t.length; i++){
    if(t[i].b &amp;gt; 10){
      r.push(t[i])
    }
  }
  return r
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;-the-clean-way&quot;&gt;✅ The Clean Way&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;function getActiveUsersWithHighScore(users) {
  const ACTIVE_THRESHOLD = 10;
  
  return users
    .filter(user =&amp;gt; user.isActive)
    .filter(user =&amp;gt; user.score &amp;gt; ACTIVE_THRESHOLD);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The logic is the same, but the second version &lt;strong&gt;communicates the intent&lt;/strong&gt;. Knowledge is preserved inside the code, not just in a developer’s head.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;refactoring-as-insurance&quot;&gt;Refactoring as Insurance&lt;/h3&gt;
&lt;p&gt;There's a common argument in many companies:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&quot;We don't have time for refactoring&quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But from a business perspective, the real question should be different:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&quot;How expensive will it be when nobody understands this code anymore?&quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Every hour spent turning a &lt;strong&gt;Frankenstein function&lt;/strong&gt; into something readable is not wasted time.&lt;/p&gt;
&lt;p&gt;It's an investment in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Onboarding Speed:&lt;/strong&gt; New hires become productive in days instead of months  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Team Autonomy:&lt;/strong&gt; Anyone can safely modify any part of the system  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resilience:&lt;/strong&gt; When developers leave, the project survives  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In other words: refactoring is literally an &lt;strong&gt;insurance against corporate amnesia&lt;/strong&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;code-is-documentation&quot;&gt;Code is Documentation&lt;/h3&gt;
&lt;p&gt;Code is the best documentation when written well. Clear naming, small focused functions, and understandable architecture &lt;strong&gt;preserve knowledge&lt;/strong&gt;.  &lt;/p&gt;
&lt;p&gt;Unlike static docs, clean code doesn’t get outdated by neglectit evolves with the system.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;clean-code-in-the-age-of-ai&quot;&gt;Clean Code in the age of AI&lt;/h3&gt;
&lt;p&gt;Today we are entering a new phase of software development.&lt;/p&gt;
&lt;p&gt;AI tools, like code assistants, can generate functions, components, and even entire modules in seconds.&lt;/p&gt;
&lt;p&gt;This changes productivity, but it also &lt;strong&gt;raises the stakes for code quality&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If AI generates code on top of a messy architecture, it simply &lt;strong&gt;accelerates chaos&lt;/strong&gt;, but when the codebase is clean and well structured, AI becomes incredibly powerful:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;it understands the architecture faster&lt;/li&gt;
&lt;li&gt;it generates better suggestions&lt;/li&gt;
&lt;li&gt;it reduces development time without increasing complexity&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In other words, &lt;strong&gt;Clean Code becomes the foundation for effective AI-assisted development&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Bad code slows humans and bad code slows AI too.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;mini-takeaway&quot;&gt;Mini takeaway&lt;/h3&gt;
&lt;p&gt;If there's one takeaway:  &lt;/p&gt;
&lt;p&gt;&amp;gt;&lt;strong&gt;Clean Code isn’t about elegance, it’s about organizational memory.&lt;/strong&gt;  &lt;/p&gt;
&lt;p&gt;The longer your project exists, the more valuable this becomes.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;final-thought-1&quot;&gt;Final thought&lt;/h3&gt;
&lt;p&gt;After my MBA, one thing became clear: &lt;strong&gt;Clean Code is a business strategy&lt;/strong&gt;. It protects against knowledge loss, reduces onboarding friction, and makes teams resilient to change.  &lt;/p&gt;
&lt;p&gt;Since developers change jobs more often than code changes repositories, clean code is &lt;strong&gt;one of the best investments a company can make&lt;/strong&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;one-question-for-you&quot;&gt;One question for you&lt;/h3&gt;
&lt;p&gt;How much of your system lives:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Inside the &lt;strong&gt;codebase&lt;/strong&gt;  &lt;/li&gt;
&lt;li&gt;Inside someone's &lt;strong&gt;head&lt;/strong&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Share your thoughts in the comments!&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/12939/code-doesnt-quit-but-people-do-clean-code-technical-debt-and-the-bus-factor</guid>
<pubDate>Mon, 16 Mar 2026 13:06:53 +0000</pubDate>
</item>
<item>
<title>Stop Writing Messy States: Why I Swapped useEffect for React Router Loaders</title>
<link>https://coderlegion.com/12179/stop-writing-messy-states-why-i-swapped-useeffect-for-react-router-loaders</link>
<description>&lt;p&gt;We have all been there... You create a new component, and the first thing you do is set up the trinity of data fetching state:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;loading&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;error&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;data&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Then, you write the inevitable &lt;code&gt;useEffect&lt;/code&gt; hook. It usually looks something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);

useEffect(() =&amp;gt; {
  const fetchData = async () =&amp;gt; {
    try {
      const response = await fetch(url);
      if (!response.ok) throw new Error('Network response was not ok');
      const result = await response.json();
      setUser(result);
    } catch (err) {
      setError(err);
    } finally {
      setLoading(false);
    }
  };
  fetchData();
}, [url]);

if (loading) return &amp;lt;Spinner /&amp;gt;;
if (error) return &amp;lt;ErrorMessage /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;The Problem:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Boilerplate&lt;/strong&gt;: We just wrote 20 lines of code just to get data from A to B.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Render-then-Fetch&lt;/strong&gt;: The component has to mount (render) first before the effect kicks in to start fetching. This causes a &lt;a rel=&quot;nofollow&quot; href=&quot;https://remix.run/blog/remixing-react-router&quot;&gt;waterfall effect&lt;/a&gt; and slower perceived performance.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;State Management Hell&lt;/strong&gt;: You are manually managing loading and error states in every single component that needs data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;The Solution: React Router Loaders introduced in v6&lt;/h2&gt;
&lt;p&gt;React Router v6.4+ introduced a paradigm shift: &lt;strong&gt;Loaders&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;Loaders&lt;/strong&gt; are a part of the &lt;a rel=&quot;nofollow&quot; href=&quot;https://reactrouter.com/6.30.2/routers/picking-a-router#data-apis&quot;&gt;Data APIs&lt;/a&gt; which lets you handle data fetching, actions/mutations and error handling directly in your route definitions&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The idea is simple: &lt;strong&gt;Fetch-then-Render&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Instead of the component asking for data after it mounts, the Router fetches the data before it renders the component. If the data isn't ready, the component doesn't load. If there is an error, the Router handles it elsewhere.&lt;/p&gt;
&lt;p&gt;Here is how to clean up your code in 3 steps:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;It's assumed you're working on a react application with react-router installed&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Step 1: Setup Router that supports Data APIs&lt;/h3&gt;
&lt;p&gt;This will involve reconfiguring the router setup see &lt;a rel=&quot;nofollow&quot; href=&quot;https://reactrouter.com/6.30.2/routers/picking-a-router&quot;&gt;Picking a Router&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;//App.jsx

// From this
import {BrowserRouter, Routes, Route} from &quot;react-router&quot;
import UserProfile from &quot;./user&quot;

function App() {
  return (
   &amp;lt;BrowserRouter&amp;gt;
      &amp;lt;Routes&amp;gt;
        &amp;lt;Route path=&quot;/&quot; element={&amp;lt;UserProfile /&amp;gt;} /&amp;gt;
      &amp;lt;/Routes&amp;gt;
    &amp;lt;/BrowserRouter&amp;gt;
  )
}

//To this
import {RouterProvider, createBrowserRouter} from &quot;react-router&quot;
import UserProfile from &quot;/user&quot;

const router = createBrowserRouter([
  {
    path: '/user',
    element: &amp;lt;UserProfile /&amp;gt;
  }
])

function App() {
  return (
    &amp;lt;RouterProvider router={router} /&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Step 2: Write a loader function&lt;/h3&gt;
&lt;p&gt;You define a function that fetches your data.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;// utils.js
export const userLoader = async () =&amp;gt; {
  const res = await fetch('https://api.example.com/user');

  if (!res.ok) {
    throw Error(&quot;Could not fetch user details&quot;);
  }

  return res.json();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Step 3: Connect it to the Route&lt;/h3&gt;
&lt;p&gt;In your Router configuration (using &lt;code&gt;createBrowserRouter&lt;/code&gt;), you plug the loader directly into the route.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;// App.jsx
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import { userLoader } from './utils';
import UserProfile from './user';
import ErrorPage from './errorPage';

const router = createBrowserRouter([
  {
    path: '/user',
    element: &amp;lt;UserProfile /&amp;gt;,
    loader: userLoader,       // &amp;lt;--- The magic happens here
    errorElement: &amp;lt;ErrorPage /&amp;gt; // &amp;lt;--- Handles errors automatically!
  }
]);

function App() {
  return &amp;lt;RouterProvider router={router} /&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Step 3: Consume the Data&lt;/h3&gt;
&lt;p&gt;Now, look at how clean your component becomes. No &lt;code&gt;useEffect&lt;/code&gt;, No &lt;code&gt;useState&lt;/code&gt; for loading or errors. Just one hook: &lt;code&gt;useLoaderData&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;// user.jsx
import { useLoaderData } from 'react-router';

export default function UserProfile() {
  const user = useLoaderData(); // Data is already here!

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;{user.name}&amp;lt;/h1&amp;gt;
      &amp;lt;p&amp;gt;{user.email}&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;gt;In the ErrorPage, you can get error message and handle error by grabbing the &lt;code&gt;useRouteError&lt;/code&gt; hook from &quot;react-router&quot;, implementation is similar to &lt;code&gt;useLoaderData&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;Why this is Clean Code?&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Separation of Concerns:&lt;/strong&gt; Your UI component is responsible for UI, not fetching logic. The fetching logic lives in the loader.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic Error Handling:&lt;/strong&gt; If the API fails, React Router catches the error and renders the &lt;code&gt;errorElement&lt;/code&gt; defined in the route. Hence, your component doesn't need to check if (error).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance:&lt;/strong&gt; The browser starts fetching the data as soon as the user clicks the link, in parallel with loading the code for the new page.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;useEffect&lt;/code&gt; is a powerful tool but using it for data fetching in 2025 is often unnecessary complexity. By switching to Loaders, you delete code, prevent bugs, and make your application feel snappier.&lt;/p&gt;
&lt;p&gt;Give your &lt;code&gt;useEffect&lt;/code&gt; a break and let the Router do the heavy lifting.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/12179/stop-writing-messy-states-why-i-swapped-useeffect-for-react-router-loaders</guid>
<pubDate>Wed, 25 Feb 2026 13:47:56 +0000</pubDate>
</item>
<item>
<title>Debugging Bash Scripts Like a Pro</title>
<link>https://coderlegion.com/10621/debugging-bash-scripts-like-a-pro</link>
<description>&lt;p&gt;Bash scripting is one of those skills every developer &lt;em&gt;uses&lt;/em&gt;, but very few truly &lt;em&gt;master&lt;/em&gt;. We write quick scripts to automate tasks, glue systems together, or run background jobs and then one day, something breaks. The script silently fails, produces the wrong output, or behaves differently in production than it did locally.&lt;/p&gt;
&lt;p&gt;That’s where proper debugging comes in.&lt;/p&gt;
&lt;p&gt;Debugging Bash scripts doesn’t have to feel like guesswork or endless &lt;code&gt;echo&lt;/code&gt; statements. With the right techniques, you can understand what your script is doing, why it’s failing, and how to fix it efficiently without losing your sanity.&lt;/p&gt;
&lt;p&gt;This guide walks through practical, professional Bash debugging techniques that still matter in 2026.&lt;/p&gt;
&lt;h3 id=&quot;why-bash-scripts-are-hard-to-debug&quot;&gt;Why Bash Scripts Are Hard to Debug&lt;/h3&gt;
&lt;p&gt;Before diving into tools, it helps to understand &lt;em&gt;why&lt;/em&gt; Bash can be tricky:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bash fails silently by default&lt;/li&gt;
&lt;li&gt;Errors don’t always stop execution&lt;/li&gt;
&lt;li&gt;Variables can expand unexpectedly&lt;/li&gt;
&lt;li&gt;Whitespace and quoting matter more than you think&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Most issues come from assumptions: assuming a command succeeded, assuming a variable exists, or assuming the environment behaves the same everywhere.&lt;/p&gt;
&lt;p&gt;Good debugging habits eliminate those assumptions.&lt;/p&gt;
&lt;h3 id=&quot;1-start-with-strict-mode&quot;&gt;1. Start With Strict Mode&lt;/h3&gt;
&lt;p&gt;One of the best things you can do for any Bash script is enable &lt;strong&gt;strict mode&lt;/strong&gt; at the top:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;set -euo pipefail
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here’s what each part does:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-e&lt;/code&gt;: Exit immediately if a command fails&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-u&lt;/code&gt;: Treat unset variables as errors&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-o pipefail&lt;/code&gt;: Catch failures inside pipelines&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This turns silent failures into visible ones and saves hours of confusion later.&lt;/p&gt;
&lt;h3 id=&quot;2-use-set--x-to-trace-execution&quot;&gt;2. Use &lt;code&gt;set -x&lt;/code&gt; to Trace Execution&lt;/h3&gt;
&lt;p&gt;When things get weird, tracing is your best friend.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;set -x
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This tells Bash to print each command &lt;em&gt;after&lt;/em&gt; variable expansion but &lt;em&gt;before&lt;/em&gt; execution. You’ll see exactly what Bash is running.&lt;/p&gt;
&lt;p&gt;To limit noise, enable it only where needed:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;set -x
# suspicious section
set +x
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is especially useful when debugging loops, conditionals, or dynamic commands.&lt;/p&gt;
&lt;h3 id=&quot;3-log-intentionally-not-randomly-&quot;&gt;3. Log Intentionally (Not Randomly)&lt;/h3&gt;
&lt;p&gt;Sprinkling &lt;code&gt;echo &quot;here&quot;&lt;/code&gt; everywhere works… until it doesn’t.&lt;/p&gt;
&lt;p&gt;Instead:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Log meaningful state&lt;/li&gt;
&lt;li&gt;Include variable values&lt;/li&gt;
&lt;li&gt;Be explicit about what the script is doing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;echo &quot;Starting backup for user=$USER at $(date)&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For long-running scripts, consider logging to a file:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;exec &amp;gt;&amp;gt; /var/log/myscript.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now stdout and stderr are captured for later inspection.&lt;/p&gt;
&lt;h3 id=&quot;4-check-exit-codes-explicitly&quot;&gt;4. Check Exit Codes Explicitly&lt;/h3&gt;
&lt;p&gt;Not every failure throws an error.&lt;/p&gt;
&lt;p&gt;Instead of assuming success:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;command
if [ $? -ne 0 ]; then
  echo &quot;Command failed&quot;
  exit 1
fi
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or more idiomatically:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;command || {
  echo &quot;Command failed&quot;
  exit 1
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This makes failure paths obvious and predictable.&lt;/p&gt;
&lt;h3 id=&quot;5-quote-everything-yes-everything-&quot;&gt;5. Quote Everything (Yes, Everything)&lt;/h3&gt;
&lt;p&gt;Unquoted variables are one of the most common sources of bugs.&lt;/p&gt;
&lt;p&gt;Bad:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;rm $FILE
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Good:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;rm &quot;$FILE&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Without quotes, Bash performs word splitting and glob expansion—leading to broken logic or destructive behavior.&lt;/p&gt;
&lt;p&gt;If a script behaves inconsistently, always check your quoting first.&lt;/p&gt;
&lt;h3 id=&quot;6-debug-conditionals-and-tests-carefully&quot;&gt;6. Debug Conditionals and Tests Carefully&lt;/h3&gt;
&lt;p&gt;Bash conditionals are powerful but subtle.&lt;/p&gt;
&lt;p&gt;Prefer &lt;code&gt;[[ ... ]]&lt;/code&gt; over &lt;code&gt;[ ... ]&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;if [[ &quot;$value&quot; == &quot;yes&quot; ]]; then
  ...
fi
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use &lt;code&gt;-z&lt;/code&gt; and &lt;code&gt;-n&lt;/code&gt; for string checks:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;[[ -z &quot;$VAR&quot; ]] &amp;amp;&amp;amp; echo &quot;VAR is empty&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When conditionals fail unexpectedly, echo the evaluated values to confirm assumptions.&lt;/p&gt;
&lt;h3 id=&quot;7-validate-inputs-early&quot;&gt;7. Validate Inputs Early&lt;/h3&gt;
&lt;p&gt;Many bugs come from unexpected input.&lt;/p&gt;
&lt;p&gt;Always validate arguments:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;if [[ $# -lt 1 ]]; then
  echo &quot;Usage: $0 &amp;lt;filename&amp;gt;&quot;
  exit 1
fi
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Fail fast. It’s much easier to debug a script that refuses to run than one that runs incorrectly.&lt;/p&gt;
&lt;h3 id=&quot;8-use-shellcheck-seriously-&quot;&gt;8. Use ShellCheck (Seriously)&lt;/h3&gt;
&lt;p&gt;If you only adopt &lt;em&gt;one&lt;/em&gt; habit from this article, make it this.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ShellCheck&lt;/strong&gt; is a static analysis tool that catches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Quoting mistakes&lt;/li&gt;
&lt;li&gt;Undefined variables&lt;/li&gt;
&lt;li&gt;Logical errors&lt;/li&gt;
&lt;li&gt;Common Bash pitfalls&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run it locally or in CI:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;shellcheck myscript.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It’s like having a Bash expert review your script every time.&lt;/p&gt;
&lt;h3 id=&quot;9-test-in-a-clean-environment&quot;&gt;9. Test in a Clean Environment&lt;/h3&gt;
&lt;p&gt;Scripts often work locally and fail elsewhere because:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Environment variables differ&lt;/li&gt;
&lt;li&gt;Paths aren’t the same&lt;/li&gt;
&lt;li&gt;Permissions change&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Test scripts with:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;env -i bash myscript.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This strips the environment and reveals hidden dependencies you didn’t realize your script had.&lt;/p&gt;
&lt;h3 id=&quot;10-know-when-bash-isn-t-the-right-tool&quot;&gt;10. Know When Bash Isn’t the Right Tool&lt;/h3&gt;
&lt;p&gt;Debugging isn’t just about fixing bugs it’s also about recognizing limits.&lt;/p&gt;
&lt;p&gt;If your script:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Grows beyond a few hundred lines&lt;/li&gt;
&lt;li&gt;Needs complex state or data structures&lt;/li&gt;
&lt;li&gt;Requires extensive error handling&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That’s not a Bash failure it’s a signal. Moving to Python, Go, or another language may reduce complexity &lt;em&gt;and&lt;/em&gt; debugging time.&lt;/p&gt;
&lt;h3 id=&quot;final-thoughts-4&quot;&gt;Final Thoughts&lt;/h3&gt;
&lt;p&gt;Professional Bash debugging isn’t about memorizing tricks it’s about mindset.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Assume things will fail&lt;/li&gt;
&lt;li&gt;Make failures visible&lt;/li&gt;
&lt;li&gt;Log intentionally&lt;/li&gt;
&lt;li&gt;Validate aggressively&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Bash remains incredibly relevant in 2026, especially for automation, servers, and glue code. When you know how to debug it properly, it stops being fragile and starts becoming powerful.&lt;/p&gt;
&lt;p&gt;If this helped you level up your Bash skills, share it with another developer and keep scripting smarter.&lt;/p&gt;
</description>
<category>Tutorials</category>
<guid isPermaLink="true">https://coderlegion.com/10621/debugging-bash-scripts-like-a-pro</guid>
<pubDate>Wed, 28 Jan 2026 09:13:31 +0000</pubDate>
</item>
<item>
<title>Code Utopia in 2026: The Four Pillars of Production-Ready Code</title>
<link>https://coderlegion.com/9940/code-utopia-in-2026-the-four-pillars-of-production-ready-code</link>
<description>&lt;p&gt;As we kick off 2026, the pace of software development has never been faster—or more demanding. AI-assisted coding tools are ubiquitous, cloud-native architectures dominate, and users expect applications that are instant, intuitive, and unbreakable. Yet many codebases still feel chaotic: technical debt piles up, outages surprise us, and security vulnerabilities lurk in the shadows.&lt;br&gt;
True production-ready code—the kind that powers reliable, scalable products people depend on—requires intentional discipline. In my experience building full-stack AI systems and shipping them to production, four pillars consistently separate maintainable, high-impact code from the rest:&lt;br&gt;
Structure • Function • Performance • Security&lt;br&gt;
Master these, and you approach what I call codebase utopia: a system that’s clean, predictable, fast, and resilient—even as it evolves over years.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Structure: The Foundation Everything Rests On&lt;/strong&gt;&lt;br&gt;
Well-structured code is readable, modular, and extensible. Without it, even the most brilliant features become unmaintainable.&lt;/p&gt;
&lt;p&gt;Follow established principles like SOLID and separation of concerns.&lt;br&gt;
Use consistent architecture patterns (e.g., clean/hexagonal architecture, feature-sliced design in frontend).&lt;br&gt;
Enforce naming conventions, directory layout, and code formatting automatically (Prettier, Black, Ruff, or ESLint).&lt;/p&gt;
&lt;p&gt;In 2026, AI tools like Claude code, Google Antigravity, Cursor or GitHub Copilot make refactoring easier than ever, but they still need a solid structure to suggest meaningful improvements. A poorly structured codebase confuses both humans and AI.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Function: Does It Do What It Should—Correctly and Completely?&lt;/strong&gt;&lt;br&gt;
Functional correctness is non-negotiable. The code must deliver the intended behavior under all expected (and many unexpected) conditions.&lt;/p&gt;
&lt;p&gt;Write comprehensive tests: unit, integration, and end-to-end.&lt;br&gt;
Adopt test-driven development (TDD) or at least property-based testing for critical paths.&lt;br&gt;
Validate inputs rigorously and handle edge cases explicitly.&lt;/p&gt;
&lt;p&gt;Modern frameworks (FastAPI, Next.js) and tools (Pydantic, Zod) make runtime validation almost effortless. In production systems—especially those using LLMs or RAG pipelines—functional correctness also means guarding against hallucination or malformed outputs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. Performance: Fast Today, Scalable Tomorrow&lt;/strong&gt;&lt;br&gt;
Users abandon slow apps, and inefficient code burns money in the cloud.&lt;/p&gt;
&lt;p&gt;Profile early and often (PyInstrument, React DevTools, Google Cloud Profiler).&lt;br&gt;
Optimize hot paths: choose the right data structures, cache aggressively, and leverage vectorized operations (Pandas → Polars is a common 2026 win).&lt;br&gt;
Design for horizontal scaling from the start—stateless services, efficient database queries, and async where appropriate.&lt;/p&gt;
&lt;p&gt;With AI workloads exploding, efficient token usage and smart batching in LLM calls have become a new performance frontier.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4. Security: Build Trust by Default&lt;/strong&gt;&lt;br&gt;
Security is no longer an afterthought—it’s baked in.&lt;/p&gt;
&lt;p&gt;Apply secure-by-design principles: least privilege, defense in depth.&lt;br&gt;
Use vetted libraries, keep dependencies updated (dependabot, renovate).&lt;br&gt;
Implement authentication/authorization properly (OAuth2, JWT with short expiry), sanitize inputs, and protect against common vectors (OWASP Top 10).&lt;/p&gt;
&lt;p&gt;In the age of autonomous agents and RAG systems pulling external data, security also means validating retrieved context and preventing prompt injection.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Often-Missing Fifth Pillar: Observability&lt;/strong&gt;&lt;br&gt;
While the four pillars above are essential, one element is frequently overlooked yet critical in 2026 production systems: observability.&lt;br&gt;
Logs, metrics, traces, and alerts (OpenTelemetry, Prometheus, Grafana) let you understand what’s happening inside your running system. Without observability, even perfectly structured, functional, performant, and secure code can fail silently in production. It’s the feedback loop that turns good code into great, long-lived code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Toward Utopia&lt;/strong&gt;&lt;br&gt;
Code utopia isn’t a mythical perfect codebase—it’s one that consistently delivers value with minimal surprise. By prioritizing structure, function, performance, security, and adding strong observability, we can build systems that scale with our ambitions.&lt;br&gt;
What’s your biggest challenge on the road to production-ready code in 2026? Drop a comment—I’d love to hear your thoughts.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/9940/code-utopia-in-2026-the-four-pillars-of-production-ready-code</guid>
<pubDate>Sun, 18 Jan 2026 12:08:22 +0000</pubDate>
</item>
<item>
<title>Upgrade your debugging skills and code like a PRO</title>
<link>https://coderlegion.com/8155/upgrade-your-debugging-skills-and-code-like-a-pro</link>
<description>&lt;p&gt;Wrapping your head around some mysterious bugs can sometimes be very tricky. However, be it 99 or 127 little bugs, systematic debugging can patch them all!&lt;/p&gt;
&lt;p&gt;This is the first part of our small series of tips for junior developers focused on having a systematic routine while debugging the code.&lt;/p&gt;
&lt;p&gt;As we’ve seen with many junior developers - and have gone through it by ourselves as well - when we end up with an error, we panic and start doing random quick changes in our code to see if anything would make the error message go away. However, this approach does not fix any bugs, but unfortunately brings even more of them into the code. This is because we are trying to quickly cover the obvious symptoms rather than spend time to understand the root cause. Consequently, the problem is solved only partially and our quick fix can lead to other issues. The whole process then becomes a never-ending circle where fixing one thing crashes another one.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Instead, it’s much better to calm down, take a deep breath, and start with &lt;strong&gt;a systematic approach.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first step to successful debugging is reading the error message. We know, it's obvious. However, &lt;strong&gt;properly reading the message&lt;/strong&gt; can tell you what file the error is coming from. Specifically, it can tell you what line the error is coming from. This provides you with a great starting point to examine and ultimately fix the problem. This is the first and most important step with which you should start every debugging as it will save you a lot of time as well as your mental health.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=7393801266079476125&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;If you are not finding the error by reading the error message, the next thing you should do is to systematically eliminate possible sources of the error. This means, start at the beginning, take a &lt;strong&gt;small part of your code&lt;/strong&gt; and make sure &lt;strong&gt;it behaves correctly&lt;/strong&gt;. Once confirmed, start adding other smaller parts to it and check again that it works as you would expect. Unit testing can greatly help you with this process of elimination. By systematically sorting the good parts of the code from the bad ones guarantees that you will find the cause of the problem and make the debugging much quicker.&lt;/p&gt;
&lt;p&gt;It’s also important to be fresh and not to get stuck with the small part of the code forever. We know it can be frustrating to be stuck on one problem and not seeing the solution but really &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.codeac.io/blog/how-to-save-time-while-debugging.html&quot;&gt;don’t waste your time on thinking: “It’s impossible”&lt;/a&gt;! Sometimes it’s just better to ask google or your colleagues. :)&lt;/p&gt;
&lt;p&gt;Once the code is working it’s a good idea to look at it as part of a bigger picture and make sure that code metrics such as &lt;em&gt;Cyclomatic Complexity&lt;/em&gt;, &lt;em&gt;Coupling Between Objects&lt;/em&gt;, etc. are at a reasonable level. By doing so you are making the code more readable and maintainable which helps to prevent many bugs or makes finding and fixing them faster.&lt;/p&gt;
&lt;p&gt;Codeac helps you guard all the important metrics and many others to give you &lt;strong&gt;actionable feedback and insight&lt;/strong&gt; about the current state of your codebase. This will help you keep track of your code quality and will help you to be an even better developer!&lt;/p&gt;
&lt;p&gt;Outstanding developers make the process mentioned above as part of their routine. This means every time a bug occurs, they stay calm, and know exactly what has to be done thanks to the step by step approach. So remember, read the error message thoroughly to locate the issue, if it doesn't help start working with a small functional part of the code and add more to it while making sure the code still works. And finally, don’t hesitate to ask your colleagues when you get stuck. After all, we all want the same thing - working code that’s clean and without any bugs.&lt;/p&gt;
</description>
<category>Career Roadmaps</category>
<guid isPermaLink="true">https://coderlegion.com/8155/upgrade-your-debugging-skills-and-code-like-a-pro</guid>
<pubDate>Thu, 04 Dec 2025 10:41:46 +0000</pubDate>
</item>
<item>
<title>Current software design problems addressed in a minimalist way.</title>
<link>https://coderlegion.com/6102/current-software-design-problems-addressed-in-a-minimalist-way</link>
<description>&lt;h2 id=&quot;what-is-wrong-with-software-&quot;&gt;What is (wrong with) software?&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Software is eating the world. If you work, live, and love software, you usually do not stop to think about its meaning&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;TL;DR: Current software design problems addressed in a minimalist way.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In university and industry, you often find the following definition of software:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Software is a set of instructions that with certain input data generates output data.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is the definition of a &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Computer_program&quot;&gt;computer program&lt;/a&gt; according to &lt;em&gt;Wikipedia&lt;/em&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;A &lt;strong&gt;computer program&lt;/strong&gt; is a collection of &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Instruction_set&quot;&gt;instructions&lt;/a&gt; that can be &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Execution_(computing)&quot;&gt;executed&lt;/a&gt; by a &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Computer&quot;&gt;computer&lt;/a&gt; to perform a specific task.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Many decades ago, computer scientists understood that software is much more than a program.&lt;/p&gt;
&lt;p&gt;They still lack clear definitions of what is software.&lt;/p&gt;
&lt;p&gt;Again, according to &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Software&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;Computer software&lt;/strong&gt;, or simply &lt;strong&gt;software&lt;/strong&gt;, is a collection of &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Data_(computing)&quot;&gt;data&lt;/a&gt; or &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Computer&quot;&gt;computer&lt;/a&gt; instructions that tell the computer how to work. This is in contrast to &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Computer_hardware&quot;&gt;physical hardware&lt;/a&gt;, from which the system is built and  performs the work.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This definition works by contrast (everything that is not hardware) or by omission (everything you cannot kick but can only curse).&lt;/p&gt;
&lt;p&gt;Yet, the only purpose of building software is:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;To mimic something that happens in a possible reality.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This was essential during the origins of modern programming languages like &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Simula&quot;&gt;Simula&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Simula was the first object-oriented programming language to include classification.&lt;/p&gt;
&lt;p&gt;In the language, it was clear from the name that the goal of software construction was to &lt;strong&gt;build a simulator.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is the case for most computer software applications today.&lt;/p&gt;
&lt;p&gt;Returning to the origins you can define the software as the construction of a:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;(M)odel: (A)bstract (P)artial and (P)rogrammable (E)xplaining (R)eality.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;why-is-it-a-m-odel-&quot;&gt;Why is it a (M)odel?&lt;/h3&gt;
&lt;p&gt;The model is the outcome of observing a certain aspect of reality.&lt;/p&gt;
&lt;p&gt;Built under a certain lens, perspective, and paradigm.&lt;/p&gt;
&lt;p&gt;It is not the revealed truth.&lt;/p&gt;
&lt;p&gt;It is the best possible conception at a given moment with the available knowledge.&lt;/p&gt;
&lt;p&gt;Since &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.tutorhunt.com/resource/10969/&quot;&gt;Plato&lt;/a&gt;’s time, human beings have tried to build good models of reality.&lt;/p&gt;
&lt;h3 id=&quot;why-is-it-a-a-bstract-&quot;&gt;Why is it a (A)bstract?&lt;/h3&gt;
&lt;p&gt;You can only understand and observe it with instruments such as a black box based on its behavior in the face of your stimuli.&lt;/p&gt;
&lt;p&gt;Like Schrödinger’s &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat&quot;&gt;cat&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You cannot know what state it is in without disturbing it with our measuring instruments.&lt;/p&gt;
&lt;p&gt;The use case technique is an excellent tool to describe a model in a declarative way.&lt;/p&gt;
&lt;p&gt;If you are not a declarative programmer, you might &lt;a rel=&quot;nofollow&quot; href=&quot;https://chatbotslife.com/most-programmers-are-losing-our-jobs-very-soon-77adf846beb1&quot;&gt;lose your job&lt;/a&gt; very soon.&lt;/p&gt;
&lt;h3 id=&quot;why-is-it-p-rogrammable-&quot;&gt;Why is it (P)rogrammable?&lt;/h3&gt;
&lt;p&gt;It has to run in some type of &lt;strong&gt;simulator&lt;/strong&gt; that reproduces the desired conditions. &lt;/p&gt;
&lt;p&gt;It can be a &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Turing_machine&quot;&gt;Turing model&lt;/a&gt; (current commercial computers), a &lt;a rel=&quot;nofollow&quot; href=&quot;https://maximilianocontieri.com/explain-in-5-levels-of-difficulty-quantum-computing&quot;&gt;quantum computer&lt;/a&gt;, or any type of simulator capable of evolving with the model.&lt;/p&gt;
&lt;h3 id=&quot;why-is-it-p-artial-&quot;&gt;Why is it (P)artial?&lt;/h3&gt;
&lt;p&gt;You need to make a partial cut of the reality for the problem you are modeling.&lt;/p&gt;
&lt;p&gt;This is common to scientific models.&lt;/p&gt;
&lt;p&gt;You take simplifications on aspects that are not relevant to isolate the problem.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=13591100686297003540&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;A 1:1 scale map of the earth would not make sense.&lt;/p&gt;
&lt;h3 id=&quot;why-is-it-e-xplanatory-&quot;&gt;Why is it (E)xplanatory?&lt;/h3&gt;
&lt;p&gt;The model must be declarative enough to let you observe its evolution.&lt;/p&gt;
&lt;p&gt;It allows you to reason about and predict behaviors in the reality you are modeling.&lt;/p&gt;
&lt;h3 id=&quot;why-is-it-about-r-eality-&quot;&gt;Why is it about (R)eality?&lt;/h3&gt;
&lt;p&gt;Because it has to reproduce conditions that occur in an observable environment.&lt;/p&gt;
&lt;p&gt;The ultimate goal is to forecast the real world, like any simulation.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Once you define the software, you can begin to infer good modeling and design practices.&lt;/p&gt;
&lt;h3 id=&quot;starting-point&quot;&gt;Starting Point&lt;/h3&gt;
&lt;p&gt;You have the axiomatic definition presented in this article.&lt;/p&gt;
&lt;p&gt;From it, you will infer &lt;strong&gt;principles&lt;/strong&gt;, &lt;strong&gt;heuristics&lt;/strong&gt;, and &lt;strong&gt;rules&lt;/strong&gt; to build excellent software models.&lt;/p&gt;
&lt;p&gt;%[https://maximilianocontieri.com/the-one-and-only-software-design-principle]&lt;/p&gt;
&lt;h2 id=&quot;acknowledgements&quot;&gt;Acknowledgements&lt;/h2&gt;
&lt;p&gt;These concepts are based on the thoughts of David West, Máximo Prieto and Hernán Wilkinson.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Part of the goal of this series of articles is to generate spaces for debate and discussion on software design.&lt;/p&gt;
&lt;p&gt;%[https://maximilianocontieri.com/object-design-checklist]&lt;/p&gt;
&lt;p&gt;I look forward to comments and suggestions on this article. &lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Spanish version: &lt;a rel=&quot;nofollow&quot; href=&quot;https://codigolimpio.substack.com/p/que-esta-mal-en-el-software&quot;&gt;¿Qué es(tá mal en) el software?&lt;/a&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/6102/current-software-design-problems-addressed-in-a-minimalist-way</guid>
<pubDate>Mon, 06 Oct 2025 00:52:48 +0000</pubDate>
</item>
</channel>
</rss>