After reading some of the reactions from http://net.tutsplus.com/tutorials/php/psr-huh/ I’ve seen how much PHP needs standards.
Most of the hate, fortunately goes to the PSR-1 and PSR-2 which specify how the source code should be formatted. Since the nature of PHP is to be so open and non-restrictive, people are used to adopt whatever coding style fits them. I’m not saying other languages don’t have this ability but PHP just makes it more easy to do it.
Bbbut I love my tabs/2 spaces/8 spaces/whatnot indentation rules… And I love my own way of leaving a blank space then have the curly brace on the same row as the function definition.
Well, the great thing about PHP-FIG, and the thing that nobody gets it, is that they don’t force you to use any PSR in your code. Actually I don’t think anyone cares about how you code. So why should you care then?
For one, I’m sick of jumping from project to project or even from company to company and every time learn yet another way to format the source code/read it. Yes, IDEs and tools like PHP Coding Standards Fixer make it easy to format sources according to different standards but at the end of the day, wouldn’t it be more easy to just open a new project and see all the syntax that I know and I could use directly?
Even better, it would encourage contribution to the said project since people would know how to read the syntax already should you decide to go open source.
And I’m willing to bet that when you are using Zend Framework, Symfony, CakePHP, Drupal or any other project, you are adapting to the standards of that project. Granted, it’s not a big problem but you still need to do it. Not to mention if you are working in a company / open source project and others must work with your code.
Do you feel hindered in any way because of adopting this standard? Well no standard has its disadvantages but on the long run it would be such a great thing if people could stop arguing about how to format code and talk about how the code is written, how the code performs under heavy load, how the code allows new users to get the most out of it or how the code could be improved to allow more extensibility.
The point is that standards like this would allow you to focus on what matter the most and leave out the details. So why don’t you rethink your approach to them and see if you can become a better programmer by embracing change or help creating a better future for all of us?
What do you think?