What is the difference between PHP framework and Ruby/python Framework _php Tutorial

Source: Internet
Author: User
Tags php framework drupal plone
PHP: After each HTTP request, initialize all resources (such as creating a database link, loading the System class library, creating a cache, etc.), processing and releasing all resources.

Python/ruby: Initializes the resource when it is first started, and subsequent requests do not have to initialize the resource again.

The difference between PHP and Python/ruby mechanism is:

    1. PHP extremely difficult to have a serious memory leak problem, whatever your code is bad, anyway, every request once executed, all the resources to release the light. While Python/ruby relies on GC to reclaim memory, there is a slight loss of memory leakage that GC cannot release.
    2. PHP has to initialize resources for each request, which is very expensive. So although the PHP parser itself is very fast, but once the complex PHP framework, because the need to initialize the entire framework each time the request, performance degradation is very strong, you use a very complex PHP framework result is the overall performance by Ruby far away. This is one of the reasons why the PHP community has not tended to use the framework for so many years.
    3. Since PHP is a mechanism for initializing resources per request, it is quite difficult for PHP to add high-level features across requests, which is a big limitation of PHP itself, but on the other hand, it is this limitation that keeps PHP in a relatively simple web language. And that is why PHP is the first web programming language in the Internet, so it may not be a bad idea.

In short, the difference between PHP and Ruby is very large, not suitable for comparison, in fact, it should be compared to Ruby and Python.

So I think that the framework of the rails approach to PHP after the follow-up, in fact, the PHP with the astray, so that is more than the development of rails misleading PHP. By the way: DHH before writing Basecamp, has been PHP, and also wrote a rapid development of PHP framework, he switched to Ruby after the original PHP framework was also transplanted, the framework is actually the original rails prototype. So why didn't dhh just do rails based on PHP? Do you want to use Ruby to publish rails instead? You see PHP as a mechanism to understand that PHP is a complex web development framework is not a bright road.

Whether to choose PHP, whether to choose the PHP framework, should be based on whether to meet your application as the indicator: in advance to determine whether the framework performance indicators to meet your application, testing you may want to switch the various caching technology, and may want to simulate your application design framework, and then decided to moderate, appropriate adoption of the framework. Some people are used to comparing which language or framework is good or bad, and I think it's going to be a stalemate. There is no solution to the problem that is not faced. Technical solutions are developed in the face of an application. Isn't it?

PHP's father, Rasmus, has made it clear that he doesn't like the PHP framework. (Rasmus: "I don ' t like frameworks. PHP frameworks is ridiculous slow ".) This is what Rasmus in a speech: simple was hard.

In the language of "every request as a complete life cycle", PHP itself is the pursuit of simple, anti-framework. Large PHP Internet applications will use java/c++ to write middleware in the background to complete complex business logic processing. It is not PHP's responsibility to make PHP a framework. (It mentions Drupal, but it's all positioned as a product rather than a framework, and it's no longer a statement.) )

At the product level, Python's CMS Plone is the best, very powerful, two times easy to develop, without the performance problems of Drupal. Shanghai Run has developed several commercial projects with Plone, including some systems like the one on the air.

But the problem is that, even within the Python community, highly-zope/plone is now becoming less mainstream, and mainstream technology has gone to Django. So I think it's hard to say how much the future of Drupal's anti-PHP philosophy can be.

Framework design to pay attention to development costs, integration is a good thing, but too much integration caused by the waste of resources and development inconvenience is a number of frameworks in the development process or even lead to extreme death reasons, the framework is simplified with a plug-in development approach is the real framework of the product. The beauty of simplicity is beauty, but many framework designers realize that it is really hard to make the framework simple.

http://www.bkjia.com/PHPjc/752382.html www.bkjia.com true http://www.bkjia.com/PHPjc/752382.html techarticle PHP: After each HTTP request, initialize all resources (such as creating a database link, loading the System class library, creating a cache, etc.), processing and releasing all resources. python/ ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.