Zend Framework Preview Release version 0.2.0 Released!

Posted on 31st October 2006 by Nio in Zend Framework, 程序人生
The Zend Framework community has released the 0.2.0 Preview Release. This release contains many important enhancements and new features:

* New MVC implementation
* New HTTP request and response objects make it easy to automate unit testing for web apps without a web server, and also make it possible to use MVC for command-line and PHP-GTK application development
* Enhanced pure PHP Lucene-compatible search engine component
* New Mysqli DB adapter
* New JSON server
* New REST client and server
* New XmlRpc client and server
* New Acl component
* New Session component
* New Web Services clients for Delicious and Audioscrobbler
* New Registry component
* Significant improvements to many other components

Zend_Search (Java Lucene)

Posted on 16th October 2006 by Nio in Lucene, Zend Framework, 程序人生

via: NorthClick:

We have implemented Zend_Search into our content management system “Click and Change” and we would like to share our experiences with the developers’ community. For this purpose, we decided to publish the complete source code and it’s documentation. [....]

Understanding the Zend Framework

Posted on 12th July 2006 by Nio in Zend Framework, 程序人生

IBM developerWorks 开始了 Understanding the Zend Framework 序列的文章,一共分为九个部分,目录如下:

Part 1: The basics
Explains the project in general and the Zend Framework.

Part 2: Adding a database
This tutorial shows how to use the Zend_DB module to create and manipulate the central database used to store subscription information, as well as saved entries and other information.

Part 3: The feeds
Now we add feeds into the equation, enabling the user to create an account, subscribe to particular feeds, and display those feeds. This tutorial uses the Zend_Feed and Zend_Inputfilter modules, the latter used to verify e-mail addresses and to strip HTML tags from feed entries.

Part 4: When there is no feed: the Zend_HTTPClient
Not all sites have feeds, but it's still useful to track everything in one place. This article shows how to use the Zend_HTTPClient module to create a proxy to pull data into the feed reader interface.

Part 5: Creating PDF files
This tutorial explains how to use the Zend_PDF module to enable the user to create a customized PDF of saved articles, images, and search results.

Part 6: Sending e-mail
This article explains how to use the Zend_Mail module to alert users to new posts and subscribed feeds, and even to send those posts using HTML e-mail.

Part 7: Searching
This article explains how to use the Zend_Search module to search existing current and saved blog entries for a particular search term and return ranked results.

Part 8: Adding related information and services
This tutorial explains how to use the Zend_Service modules to pull in information from other services — specifically Amazon, Flickr, and Yahoo! The interface will use Ajax to pull books, photos, and search results related to a current blog entry or from a search term the user clicks.

Part 9: Adding Ajax
The Zend Framework makes it easy to add Asynchronous JavaScript + XML (Ajax) interactions to your application by automatically translating native PHP objects to and from JavaScript Object Notation (JSON). This article shows how to add this functionality to the feed reader. It also includes a basic description of JSON.

ZF 的一个 BUG

Posted on 20th June 2006 by Nio in Zend Framework, 程序人生

今天无意中发现了 Zend Framework 的一个 BUG。在文件Zend/Controller/Action.php 中,Zend_Controller_Action::run() 的方法定义为:


<?php
   final public function run(Zend_Controller_Dispatcher_Interface $dispatcher,
                             Zend_Controller_Dispatcher_Token    $action)
?>

但在方法 run() 中,出现了如下代码(在 111 行):


<?php
$methodName $dispatcher->formatActionName($action->getActionName());
?>

而方法 formatActionName() 并未在接口 Zend_Controller_Dispatcher_Interface 中定义。这就意味着,即使你有一个实现了 Zend_Controller_Dispatcher_Interface 的 dispatcher,也无法在 Zend_Controller_Action::run() 中使用,除非你再外加一个可能对于你的 dispatcher 没有一点意义的 formatActionName() 方法 :|

目前已经将这个 BUG 提交到 ZF 的邮件列表中了。这个其实是比较明显的 BUG,只是 ZF 没有对 Controller 部分写单元测试,所以并未觉察到,所以测试还是相当重要的,特别是一些 mock 测试。

关于 DiggMore & Zend Framework 的讨论

Posted on 22nd May 2006 by Nio in DiggMore, Zend Framework, 程序人生

这几天不少同学在 phpe.net 上对 DiggMore & Zend Framework 进行了激烈的讨论,这里需要先对 DiggMore 说明一下。最初对 DiggMore 的想法是因为 binzy 和我都觉得我们应该提供一个平台,让国内的 phpers 能够通过这个平台了解到 PHP 相关的各方面咨询,甚至可以在此基础上进行交流讨论,为国内 phpers 的共同进步而努力。通过交流,我们觉得 Digg 的方式非常合适,可以让大家都参与进来,也可以让有用的信息上浮。正当我们准备开始 DiggMore 的工作时,Zend Framework 恰好发布,这也是一个机会,可以在 DiggMore 的开发中顺带应用 ZF,但是,ZF 并不是这个项目的全部,我们可能会用到 ZF 的 Controller、DB、Feed 等等,但我们不想让 DiggMore 强依赖于 ZF。接下来就是这个上面这个帖子讨论的问题了,ZF 的 Controller 并不能让我们满意,因为对于 Action 无法测试,另外正如 binzy 所说:

Zend_Controller_Front作为最前的门面, 缺乏Flexable. 因为很显然你需要根据不同的request去load不同的信息, 去add不同的Zend_Controller_Plugin. 即Zend_Front缺乏可配置性, 从Zend Framework的MailList中可以看到有Configuration相关的Proposal, 但是什么时候出来是另外一回事情了. 所以建议在Zend_Controller_Front前再加一层, 去实现Zend_Front没有做的那些事情, 即Load Configuration, Add不同的Plugins, 即创建Request所对应的Zend_Controller_Front的实例.

这导致了我们开始“改造” ZF 的 FrontController 部分,说是“改造”,但实际上我们并没有“入侵” ZF 的任何代码,在中间增加了 FrontInterface、Action、ResultType 等等接口。

帖子的讨论中让我比较失望的是,我一再地强调减少依赖、松耦合、测试优先等等,但却很少得到回应,而更多的是在讨论 image、js、view 的目录结构问题,我觉得这些目录结构都不是重点,我并不关心这些,因为一个可配置的系统平台,这些问题很容易处理,而且目录结构并没有一个必须遵循的原则,如果说有的话,那就是用户不需要访问到的文件都放到发布目录之外,呵呵,这个也算不上什么大原则。

从讨论中我开始发现其实我们(至少是 phpe 上的 phpers)相对于其它语言的讨论落后了许多,本身 PHP 在 OO 方面起步就比较晚,而 phpers 中实际懂得 OO,晓得设计模式,应用敏捷开发原则的人实在是少之又少,这不免让我对国内 PHP 的发展有些担忧(但愿是杞人忧天)。语言并不是软件开发的障碍,编程思想才是障碍,为什么我们不能多学习一下 Java、C++、.Net 等等呢,比如 Java 方面,已经有很多成熟应用设计模式案例、项目及讨论,而我们还在闭门造车,继续着复制粘贴、重复开发的机械工作。希望 DiggMore 能为大家带来一些启发,即使是一丁点的,我觉得都是成功的,毕竟我们敲开了第一块砖。