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. Note: The most of these apply to PHP.


  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, The twelve-factor 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 PHPStan and 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 use Roave Security Advisories to ensure that my applications don't install composer packages with known security vulnerabilities.

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

  17. I'm aware that Worse is better.

  18. I follow Agile software development methods.

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

  20. I always consider refactoring my code.

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

  22. I don't like Cargo cult programming.

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