Archive for PHP
Although PHP Eats Rails For Breakfast
June 23rd, 2007 • 2 comments PHP, Ruby
Ohloh is a stalker for open source projects. These guys can discern tremendous amounts of data about any code that has public version control. Pretty nifty.
Now according to Robin Luckey’s report, PHP has seen 20% growth in terms of LoC; code written in Ruby simply dwarfs in comparison. Though I have a strange feeling about this.
I believe that this year, and the one to follow will put Ruby (and especially Rails) where PHP was back in 2002-03; in a sense Ruby will enjoy the growth in popularity and adoption the same way PHP did. But putting aside technological merits, I think that there’s a categorical difference between most code written in PHP and that in Ruby… in a Apple vs. Microsoft kind of way.
For starters, Ruby (and especially Rails) tend to spoil developers. The minimalistic approach of both the language and the framework affects the developers’ mindset, and makes them, even forces them to write more concise code. PHP has a history of ugly code, amateur software and “failed” frameworks. So the code produced by most PHP’ers would have a much larger LoC value than similar code produced by Ruby’ists.
In addition to that, most projects written in Rails are service-oriented: not open source, no public code repository, and no way Ohloh can analyze them. Most of the Ruby code that Ohloh can analyze comes from RubyForge, which accounts for most projects written in Ruby, and none of those, relatively speaking, have a large code base.
I neglect the effect of 37signals’ product design and marketing approach, though I know it’s in the back of every Rails developer’s mind. Most sites built with Rails are usually simplistic, and don’t require much code in the first place. And even if Ohloh had access to these sites’ code, they wouldn’t see much growth anyway, because once a service-oriented site is complete, feature-additions will only account for a thin slice of its growth.
Remember, the numbers on Robin’s report are those of growth not of total LoC. That is, PHP has grown by 20% even with Rails’ influence over web developers. I can only find two reasons for that:
- PHP code is inherently more verbose, thus generates more lines of code.
- Developers prefer switching frameworks than switching languages.
LAMP’s Standing Still
June 25th, 2006 • 9 comments General, PHP
These guys seem really serious about losing LAMP. I don’t think we’ll lose LAMP as a platform, but it’s probably stagnating. That is, not lost but not going anywhere.
Three or four years ago I used to get excited about PHP releases, I remember how big was the jump from 4.0.6 (read buggy) to 4.1 (read cool). We all know it was the 4.x tree that caused everybody to hail. We compared it to 3.x, we liked it a lot. Not because 4 became object-oriented, not because 4 introduced tons of features, but because 4 made it much easier to do what we do best: make stuff.
I would argue that PHP’s next major tree was the 4.3, but then things stated getting out of hand. Everybody started getting touchy feely about the “enterprise”, we wanted to prove that PHP can make, that Java’s no better. Remember the PHP vs. Java, PHP vs. ASP.NET, PHP vs. Fluffy Puppies debates? Benchmarks? Micro-scrutinizing? strstr vs. str_str? I do, and I couldn’t bare it. I couldn’t care less whether PHP was enterprisey or not, I just wanted to make stuff, I wanted a sharp tool, a single tool, not a swiss-army knife, and I’m sure many PHP developers would agree.
PHP5 couldn’t make up for it. Admit it. Deal with it.
PHP5 introduced all sorts of bells and whistles, a whole new OO model, SimpleXML, SQLite and whatnot. How many of us felt these are crucial? These features where important, cool, but not crucial, they weren’t enough of a reason for ISPs to upgrade, they weren’t good enough for the “ignorant” 90% user base. Web applications are simple, and that’s what the language, platform and tools are supposed to be. Take a look at Rail’s success then tell me otherwise.
I’m sorry if I sound too harsh, but it is only because I really like PHP and I don’t want it to lose focus. I loved reading this guy and this guy, I used to keep up with [this site]http://www.dotgeek.org and this site, I used to like this board and this thing. I used to do have no doubts about PHP, I don’t want to be disappointed now.
The PHP community is shrinking by the day, at least that’s how I feel. I consider the community to consist of the extremely enthusiastic evangelists, those who make stuff instead of benchmarking them. We have a growing base of young developers who only need a small portion of PHP’s capabilities and a shrinking base of developers who want to make things happen. We need chaos, not community rules. We need a CPAN, not a PEAR, a Smarty or a Zend Framework; these projects give me a feeling of being the “chosen” ones.
However, along with chaos we need an educated community, one that can automatically filter crap. Let a thousand frameworks flourish because with a filtering community only the best of the best will survive, and not because Zend or PHP.net chose that.
Winning company’s acceptance is not an advantage per se. That’s starting at the top of the pyramid, which the opposite of how Perl and Ruby grew. Hackers used to like Perl, I personally love Perl, I use it everyday for tons of mini tasks, and I think that’s how Perl got into big corporates; Larry had nothing much to do with it.
PHP has limited itself to web applications, and that was good. But later on, PHP started to market itself as both an enterprise and a scripting (as in CLI) language. Of course there’s no way it can fit both, because “scripting” and “enterprise” can’t be crammed into the same sentence without horrible consequences. This marketing expansion didn’t come naturally, it felt like it was forced upon PHP and that we’re shoving PHP somewhere it doesn’t belong, and that it was now obliged to compete with two well-backed platforms.
Few have noticed that PHP wasn’t a platform by itself, and that it can’t compete with Java or .NET because it wasn’t complete without LAM. We should be pushing PHP away from that stiff competition and try to convert it to a leader in its own category. I think Marco’s pointing in the right direction with his suggestion to make PHP a foundation. It’ll hand over the steering wheel back to where it belongs.
Aspect-Oriented Programming
November 15th, 2005 • PHP
I found this on PHC’s website, must be the cleanest explanation I’ve seen of aspect-orient programming:
Aspect oriented programming is a relatively new programming paradigm. The standard example to explain what AOP does for you is the following. Suppose you have a script with a series of functions. Say you want to start and end every function with a call to some logging function:
<?php function some_function { log("some_function: begin"); /* do whatever the function should do */ log("some_function: end"); } ?>And say you want to do that in each and every function, for example for debugging purposes. It’s a lot of work to do that manually for every function. And when you no longer need it, it is a lot of work to remove it again. This is what’s known as a cross-cutting concern: something you need to implement (in this example, logging), that “cross-cuts” (affects) a lot of code. With AOP, you can write this concern as a single “aspect”. You then run your program through an “aspect weaver”, which will insert the necessary code at the start and end of each function, thus saving you a lot of work.
Iterators in PHP5
February 25th, 2005 • 16 comments PHP
Marco Tabini, head of PHP|architecture magazine, was kind enough to allow me to publish my article from the January issue, although the contract buys all publishing rights. The article is about iterators in PHP5, I thought it’s a topic that should be discussed in a little more detail, since first I like SPL so much, second, I get a lot of questions about it. Oh, and by the way, if you haven’t subscribed to php|a yet, you should put it on your top-priority list.
Well, after proof-reading the article, and (hopefully) getting rid of all the typos and grammatical mistakes, here’s my latest and greatest article; I hope you find it useful.
Blurb (as seen on php|a)
When PHP5 came out, a buzz started about Design Patterns and their application, how to use them, what exactly are “patterns”, and why they are so important. Today, we take a look at one of the famous patterns, the Iterator.
PHP and Apache
December 25th, 2004 • PHP
Following the latest discussions on PHP vs. Apache, I felt I had to say something about it. John Coggeshall doesn’t really think there’s a real reason to switch and actually consider Apache2; but guess what? That’s wrong!
Some people at the Apache community are pretty pissed off at how PHP pushes people away from Apache2 although it’s literally the next best thing after 1.3. The reason is obvious, Apache guys want people to use Apache2, PHP guys say don’t. Of course you can say that in thousands of pretty ways, but the fact remains that PHP people (and especially module writers) aren’t paying much attention to Apache2.
But why? Apache2 has all sorts of great features, like threading, filtering, module API, etc. Why not make use of it? I hear you say “If it ain’t broken, don’t fix it”. Well duh, Windows 3.11 wasn’t broken (sort of), OS/2 seemed like a solid system too, heck PHP4 wasn’t broken, it worked, didn’t it? But weren’t they “fixed”?