In my previous blog post I was brainstorming the possibility of collaboration between various frameworks to define a set of common interfaces. But I kind of failed to explain why this would be useful. Herman's "rebuttal" made this omission on my part quite clear. He and other critics of this idea pointed out that PHP's success over Java in the web world should be seen as an indicator that standardization efforts stifle innovation and slow down development. I totally see where this view point is coming from, but believe that they are looking at certain facts and come to the wrong conclusion. That being said the open questions left in my previous blog might still prevent this idea to take off, even if I manage to convince the general community that the above mentioned negative effects are not such a significant concern.
First up its clear that PHP has done more things right than wrong. The success is the best proof of that. But change is inevitable as the web is still in its infancy on so many levels and the requirements and expectations steadily increase. The challenge here is of course not abandoned the strengths as we search for solutions to these new challenges. PHP has always taken very pragmatic approaches, whereas Java seemed to rather ponder everything to oblivion. But what has also become apparent to me is that this long phase of deliberation that Java affords itself actually leads to really good standards. What is causing Java all this pains is that it takes them 5 years to go through this entire process. On top of that I think they are suffering from an overly verbose language and often overly complex infrastructure requirements. However to me the conclusion here is that once these guys have spend 5 years to figure out a standard it takes us much less time to adapt the concepts to PHP and this makes us stronger: It allows us to combine pragmatism with clean well designed architectures.
Of course there will be those that dispute if Java standards have indeed have a positive effect on frameworks such as Symfony2 and Zend Framework 2. Of course pragmatism also means that you can choose to ignore the standard interfaces if you feel they are constraining you too much in your quest for innovation. As a matter of fact I would be quite surprised if all developers and frameworks would adopt interfaces defined inside PHP core. So choice will remain.
However there are many different ways to innovate one is innovating on the API. But the imho much more relevant one is innovating on the implementation and surprise here interfaces actually help! Without common interfaces if you come up with a better implementation for an exiting API, there is no way to easily introduce this into existing code bases because for various reasons most frameworks are using "type hints" (I hate this terms, they are not "hints" .. but I digress). So only if there are common interfaces can an other innovate on implementation without having to face a huge up hill battle in having to displace the current implementations which are already part of a larger code base.
Furthermore there is also a very practical consideration with common interfaces: It encourages using the best tool for the job. Take the example of Doctrine Search I mentioned in my previous post. If there is a common interface for HTTP clients then it would make it possible for Zend Framework 2 users to keep using their HTTP client, which they are potentially already using in their application. While Symfony2 users who seem to lean towards Buzz can continue to use their HTTP client. Finally those who use neither could still be provided with a simple bare bones implementation as part of Doctrine Search. Furthermore those users with very special requirements (performance, routing or whatever) could implement their own HTTP client. Here I am starting to circle back to the argument that common interfaces help in "implementation innovation".
Anyway, I am still in brainstorming mode here. So I very grateful for any feedback on the pro's and con's of defining common interfaces and of course also in how we can practically establish such interfaces if we find them useful for PHP as a community.