Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 2.8 KB

improving-code-quality.md

File metadata and controls

41 lines (28 loc) · 2.8 KB

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

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

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

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

Here are some highly recommended resources for further reading: