> For the complete documentation index, see [llms.txt](https://books.codepath.org/student-handbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://books.codepath.org/student-handbook/domain-specific/improving-code-quality.md).

# Improving Code Quality

When coding in an interview context or when presenting code on your Github profile, it’s important to spend some attention on the following:

* Basic code styling (Spacing, indentation, braces, etc)
* Variable/method naming (prefix and spelling, clear naming)
* Language conventions (e.g., using list comprehensions in Python or async/await/promises in Javascript)
* Object-Oriented Design (encapsulation, scoping, class design, etc)
* Understand how to easily unit test all of your code

## Common Checklist <a href="#common-checklist" id="common-checklist"></a>

Be sure to look out for the following things:

* Try to make sure all whitespace and indentation is properly formatted and consistent throughout the code. Try using an “auto-indent” within your text editor or IDE for your language.
* A common coding style convention is that class names should be written in PascalCase and variable names should be written in camelCase
* Avoid any misspelled words in any methods, variables, comments, etc. This demonstrates an attention to detail in your code.
* Try to include at least a few comments in your code to explain intent on certain key code blocks.
* Make sure to include some reasonable code organization into objects, methods. Avoid long blocks of complicated unorganized code. The longer and more concentrated a function is, the more difficult it is to understand.
* Avoid deeply nesting code. The code is more readable as it’s easier for the eye to follow and the logic is less dense and pretzel-ed.
* Code that you want to sustain should be tested. If you test your code properly, you will increase your ability to modify/scale your code safely.

## Style Guides <a href="#style-guides" id="style-guides"></a>

There are many great style guides online, you can check a few suggested language-specific ones below:

* [Python](https://docs.python-guide.org/writing/style/)
* [Java for Android](https://medium.com/@aliesaassadi/android-java-style-guide-515d99d888a5)
* [Swift](https://github.com/raywenderlich/swift-style-guide)

If you are working in a different language, you can often find them many of these as top results for `“[language] style guide”` on Google.

## More Resources <a href="#more-resources" id="more-resources"></a>

Here are some highly recommended resources for further reading:

* [Refactoring Guru](https://refactoring.guru/refactoring/smells)
* [Martin Fowler's Refactoring Improving The Design Of Existing Code](https://www.powells.com/book/refactoring-improving-the-design-of-existing-code-9780134757599)
* [Ed Crookshanks' Just Enough Debugging: Debugging, Refactoring, and Unit Tests](https://bookshop.org/books/just-enough-debugging-debugging-refactoring-and-unit-tests/9781985261815)
* [Tom Long's Good Code, Bad Code: Think Like a Software Engineer](https://www.powells.com/book/good-code-bad-code-think-like-a-software-engineer-9781617298936)
