Everyone have their own opinion when it comes to coding practises but at least we all should do our best to follow official standards and best practises to make our code easy to understand, easy to follow, easy to refactor, easy to work with so on. The list below consists of some, not all, standards and practises that I tend to follow.

  1. I follow PSR-2 Coding Style Guide.

  2. I use TDD (Test Driven Development) framework PHPUnit and PHPspec.

  3. I use BDD (Behavior Driven Development) frameworks like Behat.

  4. I version my code with Semantic Versioning.

  5. I try not to define more than 5 method parameters.

  6. I try not to have more than 15 methods in a class.

  7. I try not to have more than 25 lines of code in a method.

  8. I try to keep "public" methods as thin as possible and do most of the work in "private" methods.

  9. I avoid having God objects in my applications.

  10. I follow DRY, SOLID and Law of Demeter principles.

  11. I analyse source code and fix PSR coding standards issues with PHP-CS-Fixer or PHP_CodeSniffer.

  12. I use PHP Mess Detector to look for potential problems or bad smell within the source code.

  13. I use PHP Copy/Paste Detector.

  14. I use phploc to measure the size of my projects.

  15. I try not to introduce unnecessary functionality because You aren't gonna need it.

  16. I'm aware that Worse is better.

  17. I follow Agile software development methods.

  18. I always use GIT, apply git-flow and branching model techniques.

  19. I always consider refactoring my code.

  20. Before and while coding I tend to use ERD and UML modelling techniques.

  21. I don't like Cargo cult programming.

  22. I believe that all UI and UX people should understand Principle of Least Astonishment.

Interesting things to know