Chủ Nhật, 6 tháng 11, 2005

PHP Framework


Advanced PHP ProgrammingThe announcement of a forthcoming PHP framework reminds me of leading a foot-race by a huge margin, then stopping and turning around to see who's catching up.

Recent news coverage of Ruby on Rails -- a framework for creating web applications with a minimum of fuss -- has Zend and others in the PHP community reacting with what seems to be, at first blush, raw panic.

Okay, maybe it isn't panic. But why else contribute another entry to the Vaporware Hall of Fame as Zend did in late October?

While Ruby on Rails places a web developer into a tight MVC framework, the beauty of PHP hinges on its very lack of a framework. Or, in fact, flexbility to utilize many frameworks.

MVC has a well-known set of benefits and -- importantly -- drawbacks, not the least of which is design complexity and a requirement for significant up-front planning. Debugging most MVC-based systems can be difficult. And, in general, the MVC concepts run counter to the iterative approach inherent in many of the most successful web-based applications.

Further, PHP already has a set of MVC frameworks from which to choose if MVC really sets a developer's mind at ease.

The ease of PHP is still, after all these years, stunning. Consider the following code snippet that reads a tab-delimited text file and prints the third column of fields to a web page:

   $arrayRecords = file("/temp/foo/somefile.txt");
   for ($i = 0; $i < sizeof($arrayRecords); $i++) {
      $arrayFields = explode("\t", $arrayRecords[$i]);
      echo($arrayFields[2] . "<br>");
   }

My contention is that PHP shouldn't fix a problem that doesn't exist. More than twenty million domains run PHP because of its inherent simplicity and flexibility. Forcing-feeding another framework into the mix may run counter to much of what made PHP so popular.

Không có nhận xét nào:

Đăng nhận xét