<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/top-10-clean-code-rules-nbxbqtq1o" -->

---
title: Top 10 Clean Code Rules | daily.dev
description: Guidance for writing clean code includes no code comments, deleting dead code, unit testing boundaries, using positive conditionals, adhering to standard...
canonical: https://daily.dev/posts/top-10-clean-code-rules-nbxbqtq1o
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Top 10 Clean Code Rules | daily.dev
og:description: Guidance for writing clean code includes no code comments, deleting dead code, unit testing boundaries, using positive conditionals, adhering to standard...
og:url: https://daily.dev/posts/top-10-clean-code-rules-nbxbqtq1o
og:image: https://api.daily.dev/og/posts/nBxbQtQ1o.png
og:image:alt: Top 10 Clean Code Rules
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Top 10 Clean Code Rules

**[Community Picks](https://daily.dev/sources/community)** · 2 min read · 2749 upvotes · 124 comments

## Summary

Guidance for writing clean code includes no code comments, deleting dead code, unit testing boundaries, using positive conditionals, adhering to standard guidelines, consistent naming, avoiding complexity, using exceptions instead of return codes, keeping methods small, and applying the Boy Scout rule to always leave the code cleaner than you found it.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.stackademic.com/top-10-clean-code-rules-831fb34caff7>

## Community discussion

Top comments from developers on daily.dev.

**@orcdev** · 139 upvotes

> I don't believe all code comments should be removed, but I've definitely encountered many unnecessary ones throughout my career. :D

**@alissondereg** · 27 upvotes

> I understand the impact of valuing positive conditional over negative, but I really value the [Return Early Pattern](https://medium.com/swlh/return-early-pattern-3d18a41bba8), and in most cases it is a negative conditional such as "Not logged in" or "Not valid credentials". Of course those can be replaced with alternative functions like "isGuest( )" or "isInvalidCredentials( credentials )" but I don't think it's worth the bother

**@itsiskandar** · 7 upvotes

> It's important to not take the book's advice to the extreme though. Refactoring everything is not always good. Do it only where you think is suitable and make you not waste too much time on adjusting the parameter of the function/component in the future.

**@digeomel** · 5 upvotes

> This book has done so much damage already, somebody should write a revised edition!

**@wpspeeddoctor** · 4 upvotes

> I agree and follow most rules. What I don't do are exceptions.
> Additionally, I write procedural code in small functions and use OOP only when it makes sense. Pushing OOP everywhere I think is a big mistake.

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 1 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

[View this post on daily.dev](https://daily.dev/posts/top-10-clean-code-rules-nbxbqtq1o)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Top 10 Clean Code Rules","url":"https://daily.dev/posts/top-10-clean-code-rules-nbxbqtq1o","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/top-10-clean-code-rules-nbxbqtq1o"},"datePublished":"2024-06-19T11:07:26.164Z","dateModified":"2024-06-19T11:08:06.238Z","description":"Guidance for writing clean code includes no code comments, deleting dead code, unit testing boundaries, using positive conditionals, adhering to standard...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/89e67f29c884a6f4ceb2ce0ef8cf9c88?_a=AQAEuiZ","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/89e67f29c884a6f4ceb2ce0ef8cf9c88?_a=AQAEuiZ","isAccessibleForFree":true,"articleSection":"Community Picks","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Community Picks","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1655817725/logos/community","url":"https://daily.dev/sources/community"},"commentCount":124,"discussionUrl":"https://daily.dev/posts/top-10-clean-code-rules-nbxbqtq1o","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2749},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":124}],"keywords":"","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Community Picks","item":"https://daily.dev/sources/community"},{"@type":"ListItem","position":3,"name":"Top 10 Clean Code Rules"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/top-10-clean-code-rules-nbxbqtq1o","comment":[{"@type":"Comment","text":"I don’t believe all code comments should be removed, but I’ve definitely encountered many unnecessary ones throughout my career. :D","datePublished":"2024-06-19T13:29:11.007Z","url":"https://daily.dev/posts/nBxbQtQ1o#c-Pxj2DBdtZ","author":{"@type":"Person","name":"OrcDev","url":"https://daily.dev/orcdev","image":"https://avatars.githubusercontent.com/u/7549148?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":139}},{"@type":"Comment","text":"I understand the impact of valuing positive conditional over negative, but I really value the Return Early Pattern, and in most cases it is a negative conditional such as “Not logged in” or “Not valid credentials”. Of course those can be replaced with alternative functions like “isGuest( )” or “isInvalidCredentials( credentials )” but I don’t think it’s worth the bother","datePublished":"2024-06-20T18:04:06.909Z","url":"https://daily.dev/posts/nBxbQtQ1o#c-nOGowkA2s","author":{"@type":"Person","name":"Alisson","url":"https://daily.dev/alissondereg","image":"https://media.daily.dev/image/upload/s--O0TOmw4y--/f_auto/v1715772965/public/noProfile"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":27}},{"@type":"Comment","text":"It’s important to not take the book’s advice to the extreme though. Refactoring everything is not always good. Do it only where you think is suitable and make you not waste too much time on adjusting the parameter of the function/component in the future.","datePublished":"2024-06-21T07:05:04.557Z","url":"https://daily.dev/posts/nBxbQtQ1o#c-NaYVsWi0b","author":{"@type":"Person","name":"Iskandar Zulqarnain Hilmi","url":"https://daily.dev/itsiskandar","image":"https://lh3.googleusercontent.com/a-/AFdZucoSNKcYtExvt1MPvhuVsK-aLHJjk_tqSFcETEDgwbs=s100"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":7}},{"@type":"Comment","text":"This book has done so much damage already, somebody should write a revised edition!","datePublished":"2024-06-25T13:19:07.766Z","url":"https://daily.dev/posts/nBxbQtQ1o#c-6pfV50fSr","author":{"@type":"Person","name":"Dimitris","url":"https://daily.dev/digeomel","image":"https://avatars3.githubusercontent.com/u/3295889?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5}},{"@type":"Comment","text":"I agree and follow most rules. What I don’t do are exceptions.\nAdditionally, I write procedural code in small functions and use OOP only when it makes sense. Pushing OOP everywhere I think is a big mistake.","datePublished":"2024-06-23T09:51:04.516Z","url":"https://daily.dev/posts/nBxbQtQ1o#c-VcRFeZbVu","author":{"@type":"Person","name":"Jaro","url":"https://daily.dev/wpspeeddoctor","image":"https://media.daily.dev/image/upload/s--zeEQdMo8--/f_auto/v1718698249/avatars/avatar_PSHEaQRJMuWifIZvzar8w"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4}}]}
```

