The comparison of open source web framework PHP and Ruby on Rail

Source: Internet
Author: User
Tags ruby on rails

Both PHP and Ruby on Rails have a large number of their own loyal fans. Comparing the two is a difficult choice in itself. Whoever wins will attract the saliva of the other's fans. By this effect, developers often seem hesitant to choose between the two. Although the starting point of this article is a comparison, it is not a one-sided-style singing and singing, but a dialectical synthesis of contrast. No good or bad, suitable for their own is the best.

In fact, it's not fair to compare PHP with Ruby on Rails as a pseudo proposition. PHP is only a programming language compared to the integrity of the Ruby on Rails language plus framework. You see, PHP has been lost on the starting line. But PHP has four or two dials of lightweight and flexible, which means that it consumes very little memory resources, performance excellence. On the other hand, the PHP community is mature and stable, with all kinds of PHP extensions and toolkits blossoming and contending. In this case, PHP has regained 10%.

PHP has the advantage of high performance and multiple plugins, which does not mean that it has no drawbacks. PHP syntax from the script style, but add object-oriented features, this kind of tiger is not the anti-dog of the fish and fish, has been criticized. This may be a soft rib for Ruby on Rails fan attacks. On the other hand, as mentioned earlier, PHP does not have the framework features of Ruby on Rails as a single programming language. This means that it requires very high programming costs, unless a plugin and a tool are used to develop the application from scratch by PHP alone. For example, to get a connection to a database, you have to start writing a database Connector API from scratch. But sometimes, the disadvantage is actually the merit. Unlike Ruby on Rails, which is limited by its own framework, PHP has the flexibility to choose mature and stable third-party plugins and tools. This is like saying that single comrades can not be too envious of pairs of Mandarin ducks, because no choice often means more choices. The difference is that love encourages specificity, while "pedal a few boats" is the selling point of PHP, developers can choose different frameworks at the same time, to achieve the best match with a variety of single functional features. At this point, for Ruby on Rails without a choice, there is only envy. Because of this, Ruby on rails is inherently closed, inevitably facing the challenge of performance for functionality, as opposed to PHP's openness to support third-party plugins. When it comes to meeting business process requirements, it means that ruby on rails needs more investment in research and development costs. This is definitely a big bad.

Just to emphasize the many advantages of PHP, if this stopped, I believe that will attract Ruby on Rails fans of countless saliva. It's time to speak for the rising star. Ruby on Rails, as a framework, is designed specifically for the Ruby programming language. Ruby's design concept is clear, is completely object-oriented, the syntax is very compact, clear, the cost is the loss of a certain degree of flexibility. From the performance comparison of programming languages, Ruby is usually slower and consumes more memory than PHP. However, the rails framework can help Ruby develop a Web application quickly, which is a fix. This is a typical example of functional change performance. As a web framework, rails has many very nice features. For example, the ActiveRecord feature of rails supports mapping of database table records to Ruby objects, and the benefit is that rails helps developers hide cumbersome SQL details and easily and directly use Ruby to make additions and deletions to the database. In other words, ruby developers do not have to rely on SQL to play a full-time bath powder database. In addition, rails supports many HTML features, such as the HTML code generator, session mechanism, and so on, which makes it easier and easier to build Web applications. This is also a big positive.

Rails ' Many powerful features, from another perspective, are also a drawback. For example, while rails blocks SQL, it also means that Ruby developers lose the opportunity to manipulate SQL directly. Many functions are not necessarily all needed. So it seems that the fish and the bear's paw are not to be combined.

    said so much, in the end who wins who loses? Or that sentence, no good who is bad, only who is more suitable. It is always right to choose the areas you are familiar with. In the sense of personal feeling, still prefer PHP. First, PHP preconceived, a lot of Web sites are using PHP, especially the forum. At least PHP offers more job opportunities. Second, rails offers a lot of features, in fact PHP has, the repeated invention of the wheel is not encouraged, not recommended. Finally, PHP is lightweight, flexible, fast, very well in line with the small, fast and spiritual characteristics of table tennis. If you do not need the support of the framework, PHP itself is actually enough, if necessary, to improve the development efficiency, it is easy to integrate the existing various mature, stable plug-ins and tools. Based on these three points, even though Ruby on rails has a number of advantages, individuals have awarded the award to PHP.

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.