Tag Archive for 'cakephp'

php开发的选择

因为用了很多php的应用,对于用php来说,我已经有很坚定的决心。我并不认为性能会是一个太大的问题,比如一个基于cakephp开发的php应用能够让一组服务器(apache+mysql)受不了的话,这个应用本身的访问量已经很不错了。而基于apache和mysql的诸多缓存应用也是我们可以在以后挑选的。

现在我的难题可能在于我不想从头开始最基础的工作,很多人也推荐php开发可以从一个好的框架开始。

怎么看php界不是很团结,框架非常多,经常看到的文章是10大php framework比较之类,让我这样的初学者很难选择。很早以前,leo推荐过prado给我,至今看来,功能还是很强,特别是类似delphi那样的事件驱动机制,我也非常熟悉。单就论框架的功能和先进性,cakephp绝对可以排在前三位。MVC也是很棒的体验,一些从ROR学来的特性也非常诱人。

php开发除了delphi for php以外,都没有很好的IDE支持,而codegear虽然已经发布了delphi for php的2.0,对这个公司还有点不太放心,总的来说,目前用户很少,delphi for php中很多的元素都很熟悉,他们自己开发的framework也很棒,可是我就是有点担心。(其实这个担心对于cakephp和prado我也有,看来有点多余)

我设定的开发目标并不是很轻,虽然也不一定能够实现。从扩展性、文档、资料等综合来分析,cakephp和zend应该是比较好的选择,我不知道prado能否满足数据库这里的要求。最好还不清楚cakephp和extJS这类能否完美结合。

相关内容

REST:我们未来的方向

说未来已经有点不准确了,实际上web2.0的重要特征之一就是开放API,而REST方式是开放API这个行为的实现模式之一。

Cakephp是这样介绍的:

Many newer application programmers are realizing the need to open their core functionality to a greater audience. Providing easy, unfettered access to your core API can help get your platform accepted, and allows for mashups and easy integration with other systems.

While other solutions exist, REST is a great way to provide easy access to the logic you’ve created in your application. It’s simple, usually XML-based (we’re talking simple XML, nothing like a SOAP envelope), and depends on HTTP headers for direction. Exposing an API via REST in CakePHP is simple.

在wikipedia上是这样解释的:

Representational state transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The terms “representational state transfer” and “REST” were introduced in 2000 in the doctoral dissertation of Roy Fielding,[1] one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification. The terms have since come into widespread use in the networking community.

REST strictly refers to a collection of network architecture principles which outline how resources are defined and addressed. The term is often used in a looser sense to describe any simple interface which transmits domain-specific data over HTTP without an additional messaging layer such as SOAP or session tracking via HTTP cookies. These two meanings can conflict as well as overlap. It is possible to design any large software system in accordance with Fielding’s REST architectural style without using HTTP and without interacting with the World Wide Web.[citation needed] It is also possible to design simple XML+HTTP interfaces which do not conform to REST principles, and instead follow a model of remote procedure call. The difference between the uses of the term “REST” therefore causes some confusion in technical discussions.

Systems which follow Fielding’s REST principles are often referred to as “RESTful”.

在学习cakephp的时候,发现它对于REST模式的开发支持的也不错。稍后继续研究。

相关内容

转载:每一个PHP开发者应该知道的五必不可少的发展要素

      语法结构教科书上的知识和实际的程序设计是有区别的,真正的知识要在实际的开发中获得。每个php的开发人员在开始开发web应用程序之前,都应该熟悉下面的五件事:
1. 框架
    框架可以说是php开发中的一个最重要的问题。 用php开发web应用程序时有很多方法,有很多开源的框架可以使用,可以帮助快速的开发,保持更高的一致性和有效性。 其中比较好的框架包括cakephp SymfonyCodeIgniter 。很多框架还按照MVC设计模式 ,如果你在这个模式下工作过,那你一定会很熟悉。过一段时间,你甚至可以根据自己的需要来创建框架。

2. 模板引擎
    如果您使用的不是一个框架来执行一个具体的设计模式,那么您想要使用的是模板引擎。不论你是自己创建或是使用现有的模板(如 Smarty),模板引擎都会使你的逻辑代码从HTML页面中独立出来(以及相关的CSS / js /等)。 这大大的简化了你的代码,使整个程序的修改变得快速简单,也使非开发者更容易修改你的程序。
3. 代码重用

 
    正如我先前提过的,php是所用语言中代码重用性最好的。从多中小的文档到整个数据库类,php开发者需要的时候可以随意的选择重用现有的代码。其实,你几乎可以不用编写一行代码就能建立起整个应用程序。

4. 不重新开发现有的东西

 
    很明显的一件事,只有少数的php开发者知道php本身有很多可用之处。忘记新的图书馆,或复杂的代码例程-先看看PHP手册。 例如,你们有没有听过number_format()parse_url(),wordwrap()bbcode_parse()?看一下整个函数参考 ,选择一个类别,浏览一下,您一定会有所发现。

5. IRC 是令人愉快的事

 
     当你有个复杂的问题不能解决的时候,可以到IRC上。php非官方的支持频道,很多经验丰富的开发者陶醉其中。你需要一个IRC客户端,如果你用的Firefox,ChatZilla是一个很好的插件,当你需要帮助时,以irc://irc.freenode.net/php做为头部粘贴你的代码。张贴您的问题,并耐心等待;某种热心人(或多个)会给你答案。当你得到答案后,考虑一下其他需要帮助人的问题。对于php庞大的函数库来说,没有人是泰斗;在IRC上,汇集所有人的知识就可以解决任何问题。

相关内容