Coding Standards For WordPress [Tutorial]
Friday, March 20, 2015
/
No Comments
The reason that we have coding standards at all (not just for WordPress) is to create a familiar environment for programmers working on a project. WordPress in particular encompasses a wide variety of products. From the core itself to themes and plugins, there is a lot to look at – and a lot to get mixed up about.
If everyone formats their code the same way, uses comments, the same style of documentation and so on, working together becomes that much easier, and the learning curve of joining a new project won’t be as steep.
The need for cohesion in WordPress is magnified by the state in which the codebase is. WordPress does not follow a strict object oriented approach and doesn’t use an MVC pattern. Projects that follow an OOP and MVC guidelines without exception (like Laravel) have consistency and best practices “baked in” due to their structure.
WordPress is unfortunately ripe for spaghetti coding, aka doing whatever you want. Best practices are difficult to enforce simply because products employing bad code may work just as well (on the surface).
If everyone formats their code the same way, uses comments, the same style of documentation and so on, working together becomes that much easier, and the learning curve of joining a new project won’t be as steep.
The need for cohesion in WordPress is magnified by the state in which the codebase is. WordPress does not follow a strict object oriented approach and doesn’t use an MVC pattern. Projects that follow an OOP and MVC guidelines without exception (like Laravel) have consistency and best practices “baked in” due to their structure.
WordPress is unfortunately ripe for spaghetti coding, aka doing whatever you want. Best practices are difficult to enforce simply because products employing bad code may work just as well (on the surface).










