---
title: "Meaning & Key Takeaway of: Don’t comment bad code—rewrite it."
description: "\"“Don’t comment bad code—rewrite it.”\" — Brian W. Kernighan"
image: "https://sms4smile.com/quotes/i/179/brian-w-kernighan-90308_code_don-t-comment-bad-code-rewrite-it-299480_2994806.jpg"
---

#  Don’t comment bad code—rewrite it.

![“Don’t comment bad code—rewrite it.” quote by Brian W. Kernighan](https://sms4smile.com/quotes/i/179/brian-w-kernighan-90308_code_don-t-comment-bad-code-rewrite-it-299480_2994806.jpg)   [Download](https://sms4smile.com/quotes/i/179/brian-w-kernighan-90308_code_don-t-comment-bad-code-rewrite-it-299480_2994806.jpg) [Open image](https://sms4smile.com/quotes/i/179/brian-w-kernighan-90308_code_don-t-comment-bad-code-rewrite-it-299480_2994806.jpg)

> ““Don’t comment bad code—rewrite it.””

Brian W. Kernighan

## About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

Rewrite bad code instead of merely commenting on it.

**In simple terms:** Fix code, don’t just annotate.

Key Takeaway

Prioritize clean, functional code.

Themes

software development code quality best practices programming

Mood

practical direct concise

Type

Code:1 Comment:1 Software-craftmanship:1 Software engineering:1 Technology:1 Bad Code:1 Code Rewrite:1 Comment Bad:1

When to use this quote

- code reviews
- maintenance
- team collaboration
- learning new languages

Key Concepts

refactoring code hygiene software craftsmanship

Questions to Reflect On

- When is it better to comment rather than rewrite?
- How do you decide the cost of refactoring?

A Different Perspective

Time spent rewriting may delay delivery; balance with project deadlines.

★ ★ ★ ★ ★   No ratings yet

[Code](https://sms4smile.com/quotes/about/code/) [Software engineering](https://sms4smile.com/quotes/about/software-engineering/) [Technology](https://sms4smile.com/quotes/about/technology/)

## Related quotes

> [Don't document bad code - rewrite it.](https://sms4smile.com/quotes/brian-kernighan/don-t-document-bad-code-rewrite-it/)

[Brian Kernighan](https://sms4smile.com/quotes/author/brian-kernighan/)

> [“Truth can only be found in one place: the code.”](https://sms4smile.com/quotes/robert-c-martin/truth-can-only-be-found-in-one-place-the-code/)

[Robert C. Martin](https://sms4smile.com/quotes/author/robert-c-martin/)

> [“Whether a comment is bad, or good you are still inspiring people to read and write.”](https://sms4smile.com/quotes/john-hamrick/whether-a-comment-is-bad-or-good-you-are-still-inspiring-people-to/)

John Hamrick

> [If you were ever forced to comment on something bad such as dirt on garment, or a bad odour, then do so tactfully .…](https://sms4smile.com/quotes/dr-al-arifi/if-you-were-ever-forced-to-comment-on-something-bad-such-as-dirt-on/)

[Dr Al-Arifi](https://sms4smile.com/quotes/author/dr-al-arifi/)

> [“Code without tests is bad code. It doesn't matter how well written it is; it doesn't matter how pretty or object-oriented or well-encapsulated it…](https://sms4smile.com/quotes/michael-feathers/code-without-tests-is-bad-code-it-doesn-t-matter-how-well-written-it/)

Michael Feathers

> [“What makes us erratic, what makes us slow down, is the accidental difficulty. We call this difficulty “bad code”.”](https://sms4smile.com/quotes/anonymous/what-makes-us-erratic-what-makes-us-slow-down-is-the-accidental/)

[Anonymous](https://sms4smile.com/quotes/author/anonymous/)

> [“Clean code is not written by following a set of rules. You don’t become a software craftsman by learning a list of heuristics. Professionalism…](https://sms4smile.com/quotes/robert-c-martin/clean-code-is-not-written-by-following-a-set-of-rules-you-don-t/)

[Robert C. Martin](https://sms4smile.com/quotes/author/robert-c-martin/)

> [“Software will give you respect, but hardware will give you the Power.”](https://sms4smile.com/quotes/akshat-paul/software-will-give-you-respect-but-hardware-will-give-you-the-power/)

Akshat Paul

> [“Redundant comments are just places to collect lies and misinformation.”](https://sms4smile.com/quotes/robert-c-martin/redundant-comments-are-just-places-to-collect-lies-and-misinformation/)

[Robert C. Martin](https://sms4smile.com/quotes/author/robert-c-martin/)

> [Hiring people to write code to sell is not the same as hiring people to design and build durable, usable, dependable software.](https://sms4smile.com/quotes/larry-constantine/hiring-people-to-write-code-to-sell-is-not-the-same-as-hiring-people/)

[Larry Constantine](https://sms4smile.com/quotes/author/larry-constantine/)

> [It's OK to figure out murder mysteries, but you shouldn't need to figure out code. You should be able to read it.](https://sms4smile.com/quotes/steve-mcconnell/it-s-ok-to-figure-out-murder-mysteries-but-you-shouldn-t-need-to/)

[Steve McConnell](https://sms4smile.com/quotes/author/steve-mcconnell/)

> [All programming is maintenance programming, because you are rarely writing original code.](https://sms4smile.com/quotes/dave-thomas/all-programming-is-maintenance-programming-because-you-are-rarely/)

[Dave Thomas](https://sms4smile.com/quotes/author/dave-thomas/)

> [An API that isn't comprehensible isn't usable.](https://sms4smile.com/quotes/james-gosling/an-api-that-isn-t-comprehensible-isn-t-usable/)

[James Gosling](https://sms4smile.com/quotes/author/james-gosling/)

> [“However, a real implementation may still have to include code to handle the case where something happens that was assumed to be impossible, even…](https://sms4smile.com/quotes/martin-kleppmann/however-a-real-implementation-may-still-have-to-include-code-to/)

[Martin Kleppmann](https://sms4smile.com/quotes/author/martin-kleppmann/)

> [It's hard enough to find an error in your code when you're looking for it; it's even harder when you've assumed your code is…](https://sms4smile.com/quotes/steve-mcconnell/it-s-hard-enough-to-find-an-error-in-your-code-when-you-re-looking/)

[Steve McConnell](https://sms4smile.com/quotes/author/steve-mcconnell/)

## More by Brian W. Kernighan

> [“To quote one company that makes beacon systems, “beacons are ushering in the indoor mobile marketing revolution.”](https://sms4smile.com/quotes/brian-w-kernighan/to-quote-one-company-that-makes-beacon-systems-beacons-are-ushering/)

Brian W. Kernighan

Explore all 2 Brian W. Kernighan quotes

## More Code quotes

> [At the deepest level, all living things that have ever been looked at have the same DNA code. And many of the same genes.](https://sms4smile.com/quotes/richard-dawkins/at-the-deepest-level-all-living-things-that-have-ever-been-looked-at/)

[Richard Dawkins](https://sms4smile.com/quotes/author/richard-dawkins/)

> [It is no secret that I have read 'The Da Vinci Code' several times. I genuinely believe that 'The Da Vinci Code' and 'Angels…](https://sms4smile.com/quotes/ashwin-sanghi/it-is-no-secret-that-i-have-read-the-da-vinci-code-several-times-i/)

[Ashwin Sanghi](https://sms4smile.com/quotes/author/ashwin-sanghi/)

> [Programmers are always surrounded by complexity; we cannot avoid it… If our basic tool, the language in which we design and code our programs,…](https://sms4smile.com/quotes/tony-hoare/programmers-are-always-surrounded-by-complexity-we-cannot-avoid-it-if/)

[Tony Hoare](https://sms4smile.com/quotes/author/tony-hoare/)

> [One of my most productive days was throwing away 1,000 lines of code.](https://sms4smile.com/quotes/ken-thompson/one-of-my-most-productive-days-was-throwing-away-1-000-lines-of-code/)

[Ken Thompson](https://sms4smile.com/quotes/author/ken-thompson/)

> [Writing code means always having to say you're sorry.](https://sms4smile.com/quotes/paul-ford/writing-code-means-always-having-to-say-you-re-sorry/)

[Paul Ford](https://sms4smile.com/quotes/author/paul-ford/)

> [It would be a piece of ingenuousness to accuse the man of today of his lack of moral code. The accusation would leave him…](https://sms4smile.com/quotes/jose-ortega-y-gasset/it-would-be-a-piece-of-ingenuousness-to-accuse-the-man-of-today-of/)

[Jose Ortega y Gasset](https://sms4smile.com/quotes/author/jose-ortega-y-gasset/)

> [I loved 'Chicago Code;' I watched that a lot. It was great because it really captured the city - I'm from Chicago, too.](https://sms4smile.com/quotes/jessy-schram/i-loved-chicago-code-i-watched-that-a-lot-it-was-great-because-it/)

[Jessy Schram](https://sms4smile.com/quotes/author/jessy-schram/)

> [I kind of pride myself on coming onto things that are well-oiled machines and finding a way to bring what I bring and fit…](https://sms4smile.com/quotes/rob-lowe/i-kind-of-pride-myself-on-coming-onto-things-that-are-well-oiled/)

[Rob Lowe](https://sms4smile.com/quotes/author/rob-lowe/)

> [When we're done simplifying the tax code, getting the lobbyist carve outs our of the tax code, lowering our rates and letting people have…](https://sms4smile.com/quotes/paul-ryan/when-we-re-done-simplifying-the-tax-code-getting-the-lobbyist-carve/)

[Paul Ryan](https://sms4smile.com/quotes/author/paul-ryan/)

> [The tax code is 10 times the size of the Bible with none of the good news.](https://sms4smile.com/quotes/paul-ryan/the-tax-code-is-10-times-the-size-of-the-bible-with-none-of-the-good/)

[Paul Ryan](https://sms4smile.com/quotes/author/paul-ryan/)

> [The Cheney team had, for example, technological supremacy over the National Security Council staff. That is to say, they could read their e-mails. I…](https://sms4smile.com/quotes/lawrence-wilkerson/the-cheney-team-had-for-example-technological-supremacy-over-the/)

[Lawrence Wilkerson](https://sms4smile.com/quotes/author/lawrence-wilkerson/)

> [ \[T\]he tax code has been piling up, year after year, a symbol of everything gone wrong in America, of arrogant rulers and lost freedom,… ](https://sms4smile.com/quotes/dick-armey/t-he-tax-code-has-been-piling-up-year-after-year-a-symbol-of/)

[Dick Armey](https://sms4smile.com/quotes/author/dick-armey/)

> [In open source, you really have to be near the watershed to have an impact on the source code. Customers want to be near…](https://sms4smile.com/quotes/peter-fenton/in-open-source-you-really-have-to-be-near-the-watershed-to-have-an/)

[Peter Fenton](https://sms4smile.com/quotes/author/peter-fenton/)

> [We can use our art to become political, to become something you want to talk about. We make clothes, but we have the chance…](https://sms4smile.com/quotes/olivier-rousteing/we-can-use-our-art-to-become-political-to-become-something-you-want/)

[Olivier Rousteing](https://sms4smile.com/quotes/author/olivier-rousteing/)

> [Your zip code or your income level should not dictate your access to healthy drinking water.](https://sms4smile.com/quotes/alex-padilla/your-zip-code-or-your-income-level-should-not-dictate-your-access-to/)

[Alex Padilla](https://sms4smile.com/quotes/author/alex-padilla/)

[Browse all 1,662 Code quotes ](https://sms4smile.com/quotes/about/code/)

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Quotation",
            "text": "“Don’t comment bad code—rewrite it.”",
            "creator": {
                "@type": "Person",
                "name": "Brian W. Kernighan"
            },
            "isPartOf": {
                "@id": "https://sms4smile.com/quotes/#website"
            },
            "url": "https://sms4smile.com/quotes/brian-w-kernighan/don-t-comment-bad-code-rewrite-it/",
            "about": {
                "@type": "Thing",
                "name": "Code"
            },
            "@id": "https://sms4smile.com/quotes/brian-w-kernighan/don-t-comment-bad-code-rewrite-it/#quotation",
            "image": {
                "@type": "ImageObject",
                "@id": "https://sms4smile.com/quotes/i/179/brian-w-kernighan-90308_code_don-t-comment-bad-code-rewrite-it-299480_2994806.jpg",
                "contentUrl": "https://sms4smile.com/quotes/i/179/brian-w-kernighan-90308_code_don-t-comment-bad-code-rewrite-it-299480_2994806.jpg",
                "url": "https://sms4smile.com/quotes/i/179/brian-w-kernighan-90308_code_don-t-comment-bad-code-rewrite-it-299480_2994806.jpg",
                "width": 1080,
                "height": 1080,
                "caption": "“Don’t comment bad code—rewrite it.” — Brian W. Kernighan",
                "creditText": "SMS4Smile Quotes",
                "creator": {
                    "@id": "https://sms4smile.com/quotes/#organization"
                }
            }
        },
        {
            "@type": "BreadcrumbList",
            "itemListElement": [
                {
                    "@type": "ListItem",
                    "position": 1,
                    "name": "Home",
                    "item": "https://sms4smile.com/"
                },
                {
                    "@type": "ListItem",
                    "position": 2,
                    "name": "Quotes",
                    "item": "https://sms4smile.com/quotes/"
                },
                {
                    "@type": "ListItem",
                    "position": 3,
                    "name": "Brian W. Kernighan",
                    "item": "https://sms4smile.com/quotes/author/brian-w-kernighan/"
                },
                {
                    "@type": "ListItem",
                    "position": 4,
                    "name": "“Don’t comment bad code—rewrite it.”",
                    "item": "https://sms4smile.com/quotes/brian-w-kernighan/don-t-comment-bad-code-rewrite-it/"
                }
            ],
            "@id": "https://sms4smile.com/quotes/brian-w-kernighan/don-t-comment-bad-code-rewrite-it/#breadcrumb"
        },
        {
            "@type": "WebSite",
            "@id": "https://sms4smile.com/quotes/#website",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "publisher": {
                "@id": "https://sms4smile.com/quotes/#organization"
            }
        },
        {
            "@type": "Organization",
            "@id": "https://sms4smile.com/quotes/#organization",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "logo": {
                "@type": "ImageObject",
                "url": "https://sms4smile.com/quotes/wp-content/themes/sq/assets/icons/icon-512.png",
                "width": 512,
                "height": 512
            }
        }
    ]
}
```
