/
Coding Best Practices

Coding Best Practices

Language Agnostic

  • Avoid long chains of if statements (switch cases are ok)

  • Avoid nested ternary operations - if a nested ternary only has 2 outcomes it can be written as one ternary

  • Break up code into reusable functions

  • Comment your code

  • Have meaningful names for variables, classes, components, functions, methods, etc

  • Avoid massive functions/components

  • Use object oriented programming whenever possible

  • Create documentation for your projects in confluence

  • Handle exceptions

  • Coding Standards and Best Practices to Follow | BrowserStack

React

  • All state hooks should be right after the constructor, then stack useEffects, followed by component functions, and finally the JSX return statement when possible.

  • Avoid writing extensive logic into useEffects write as functions that can be called in the useEffect when possible

  • Don't use redux or the database to hold information only being used within one component

  • When writing supporting components write them to be ambiguous so they have the potential to be used outside of application they were created in.

Python

Related content

Style Guides
Style Guides
More like this
GitHub README Template
GitHub README Template
More like this
Repositories
Repositories
Read with this
Refactoring React Components
Refactoring React Components
More like this
Scrum Overview
Scrum Overview
Read with this
Front-end Overview
Front-end Overview
More like this