---
# System prepended metadata

title: '**Clean Code by [Nhien Nguyen](https://github.com/annhienktuit)**'

---

# **Clean Code by [Nhien Nguyen](https://github.com/annhienktuit)**
These rules are collected by me by reading books and workshop. I'm in the progress of changing my coding style because my codes are dirty (•_•)



---
**1.General rules**
    Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
* Follow standard conventions
* Keep it simple
* Use boy scout rule 
* Always find root causes and look for problems

**2.Naming**
* Choose descriptive and meaningful names
* Pronounable names
* Searchable names
* Define magic number(eg: PI,...) with named constants
* Avoid Encoding

**Function name**
* Descriptive and meaningful names
* Small
* Do one thing
* No side effects(eg: checkPassword function just only validate the password, not initilize anything else)
* Don't use flag arguments

**Comment**
The best comment is don't comment ( ´･･)ﾉ(._.`)
* Don't be redundant
* Don't use closing brace comment
* Don't add obvious noise
* Don'comment unuse code (this is me)
* Use as explanation of intent
 
**Source code formatting:**
Nowadays, IDE help you a lot in code formatting so that we can use the automatic function

**Visual Code**
* On Windows Shift + Alt + F
**Visual Studio**
* On Windows Ctrl + K then Ctrl + D
**Android Studio**
* On Windows Ctrl + Alt + L

**Classes**
* Small
* Single responsibility
* Maximize coherent
* Organizing for change

