Skip to content

eddokloosterman/coding-best-practices

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Coding Best Practices

This is a list of best practices for writing code. Like with many things in life, there will be exceptions to the rules. Therefore, this list is not meant to be followed to the letter. It is meant to be a guideline which helps us write high quality code. Feel free to contribute by creating a Pull Request or an Issue!

  • KISS: Keep It Simple, Stupid
  • Prevent code duplication
  • Leave the campground cleaner than you found it
  • Prioritize readability over performance
  • Prefer Object Oriented code over Procedural code
  • Stand on the shoulders of giants: do not reinvent the wheel
  • Only use interfaces when there is more than 1 implementation
  • Prefer typed code over untyped code
  • Prefer Strong typing over Weak typing
  • Prefer Static typing over Dynamic typing
  • Use automatic code formatting
  • Follow the Twelve-Factor app methodology
  • Do not change code for automated testing purposes: writing tests is not a valid reason for change
  • Do not use Exceptions for control flow
  • Prefer fewer repositories over more
  • Strive for Continuous Delivery
  • Strive for Continuous Deployment
  • Use Trunk based development
  • Prevent long lived feature branches
  • Use version control tools
  • Use one monorepo
  • Use constants instead of hardcoded strings
  • Use static functions when possible
  • Place 1 class in 1 file
  • Keep functions shorter than 10 lines
  • Keep classes shorter than 100 lines
  • Adhere to PSR standards
  • Do not use comments: easily readable code does not need comments
  • Write code that your IDE can follow
  • Do not use magic methods
  • Validate input
  • Encode output
  • Use existing Software Design Patterns to solve common problems
  • Apply the SOLID principles if it prevents code from becoming hard to reuse, change or understand
  • Prevent gold plating: do not apply coding best practices at the cost of simplicity to allow for flexibility in directions that are unlikely
  • Prevent gold plating: do not create more features than strictly necessary

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published