The PSR-1/PSR-2 Analogy

Written by Zac Vineyard

Similar to the efforts of the PHP-FIG in establishing PSR-2, the University of Chicago Press introduced the The Chicago Manual of Style in 1906, except that it was for an entirely different industry. Being one of the first manuals of style for the English language published in the United States, it has since become one of the primary resources used in the regulation of citation style, especially in the publication of literature and academic research1. Similarly, large organizations like the Associated Press and the Modern Language Association have language style guidelines of their own: AP style and MLA style, respectively. Each of these style guidelines fulfill purposes in the industries that adopt them, but none of them have probably been as successful or widely used as AP style.

AP style, published in a book titled The Associated Press Stylebook and Briefing on Media Law, is most notably used in the news industry. Every press release, news article, and media briefing will likely use AP style. The benefit (the thesis the folks commenting on Nettuts+ need to hear) is that content can immediately be reused by multiple (tens-of-thousands) news outlets very quickly. Imagine how much publication rates would suffer if every newspaper, professional blog, and news website ran their own way of styling content? How many fights would break out about whether or not to use the Oxford comma? This would, no doubt, be an ugly scene, leaveing editors losing their minds over hours and hours of refactoring.

One thing I hate to say, though, is that the developers who write PHP, in whole, never seemed to grasp this idea. Lots of amateur bickering still happens over whether or not to use camel-case. As a consequence of this fragmented culture, lots of talented and intelligent programmers end up wasting time refactoring code just to that it can fit well within their own style guidelines.

I applaud the efforts of the PHP-FIG because I see how their work can be used to make the giant body of code all PHP developers write more re-usable. Our code can, in a way, become the quickly published press releases distributed by thousands of publishers without refactoring. So, whether or not you agree with all the style ideas proposed in the PSR standards—just as you might not agree with the use of the Oxford comma—it is a smart idea to standardize the style of your code to that of your peers. I'm just hoping that the style guidelines you and your peers choose are PSR-1 and PSR-2.

1. “The Chicago Manual of Style,” last modified 14 November 2012 at 20:03, March 11, 2009, http://en.wikipedia.org/wiki/The_Chicago_Manual_of_Style.