DEV Community

Larry
Larry

Posted on

6 Golden Rules To Write Clean Code

If you want to write clean code, learn these 6 rules:

  1. Separation of Concerns (SOC)
    => Break down a complex program into smaller units.

  2. Document Your Code (DYC)
    => Write code for your future self and others.

  3. Don't Repeat Yourself (DRY)
    => Don't waste time writing the same code again.

  4. Keep It Simple, Stupid (KISS)
    => Simple is hard, but better.

  5. Test Driven Development (TDD)
    => Write a failing test first and code to make the test pass.

  6. You Ain't Gonna Need It (YAGNI)
    => Build only essential features.

Top comments (0)