What is the difference between the PHP framework and the RubyPython framework. PHP: after each HTTP request comes over, all resources are initialized (for example, database links are created, system class libraries are loaded, and cache is created), processed, and all resources are released. Python PHP: after each HTTP request comes over, all resources are initialized (such as creating database links, loading system class libraries, and creating caches), processed, and all resources are released.
Python/Ruby: resources are initialized at the first startup, and subsequent requests do not have to initialize resources again.
The mechanism difference between PHP and Python/Ruby is:
- PHP is very difficult to have serious memory leakage problems. whatever code you write is poor, every request is executed and all resources are released. Python/Ruby depends on GC to recycle memory. Therefore, a slight carelessness may cause memory leakage that cannot be released by GC.
- PHP initializes resources for each request. This overhead is very high. Therefore, although the PHP parser itself runs extremely fast, once a complicated PHP framework is used, the performance of the entire framework needs to be initialized during each request is greatly reduced, the result of using a complicated PHP framework is that Ruby is far away from the overall performance. This is one of the reasons why the PHP community has been reluctant to use frameworks for so many years.
- PHP, a mechanism for initializing resources for each request, also makes it quite difficult to add advanced features for cross-request in PHP. this is a huge limitation of PHP itself, but in other words, it is this restriction that keeps PHP on a relatively simple web language. this is the reason why PHP became the first Web programming language on the Internet, so it may not be good.
In short, the difference between PHP and Ruby is still very large. it is not suitable for comparison. In fact, we should compare Ruby and Python.
So I think the framework of Rails is followed by PHP, but PHP is actually taking the wrong path, so it is better to say that Rails is misleading the development of PHP. By the way, DHH has been using PHP before writing basecamp, and he has also written a PHP rapid development framework. after he switched to ruby, I have also transplanted my own PHP framework, which is actually the original prototype of Rails. So why didn't DHH directly develop Rails based on PHP? Do I have to use ruby to publish rails? You can see the operating mechanism of PHP. it is not a bright path for PHP to develop complex web development frameworks.
Whether to select PHP or PHP Framework. you should determine whether the performance indicators of the Framework meet your application requirements in advance, during the test, you may need to switch various caching technologies, simulate your application design architecture, and then decide to adopt the framework appropriately and appropriately. Some people get used to the language or framework that is better or worse than the application. I think this often makes things deadlocked. There are no problems to face, and there is no solution to the problem. Technical solutions are designed for the development of an application. Isn't it?
Rasmus, father of PHP, also made it clear that he does not like PHP framework. (Rasmus: "I don't like frameworks. PHP frameworks are ridiculous slow ".) this is what Rasmus mentioned in a speech: Simple is Hard.
In PHP, the language "every request is a complete life cycle" is a simple and anti-framework. Large PHP Internet applications use Java/C ++ write middleware in the background to complete complex business logic processing. It is not the responsibility of PHP to make PHP a framework. (Drupal is mentioned in this article, but it is all positioned as a product rather than a framework. I will not go into details here .)
At the product level, the CMS plone of Python is the best and has very powerful functions. it is easy to perform secondary development without drupal performance problems. Shanghai runpu has developed several commercial projects with plone, including systems like Shanghai Airlines.
But the problem is: even in the Python community, zope/plone, which is highly productized, is now no longer the mainstream, and the mainstream technology has gone to django. I think it is hard to say how much future drupal's anti-PHP philosophy will have.
The development cost should be paid attention to in framework design. integration is a good thing. However, the waste of resources and development caused by too many integrations are not the cause of the extreme death of some frameworks during development, simplifying the framework with plug-in development is the true framework productization. The beauty of simplicity is the beauty, but many Framework designers also realize that it is really difficult to make the framework simple.
(For example, creating database links, loading system libraries, and creating caches), processing is complete, and all resources are released. Python /...