Python and Ruby: Comparison of popular dynamic scripting languages

Source: Internet
Author: User
Tags ruby on rails

    Dynamic scripts in recent yearsProgramming LanguageIn China, Python and Ruby are becoming more and more popular, and they are often compared. I think they have their own characteristics:

    51cto editing recommendations: Ruby tutorials and tips

    1. python is more simple in syntax, while Ruby is more sexy.

    Compared with other scripting languages, the python syntax is not so clever and rigid.CodeIndentation also shows the orientation of Guido design language. The rigid side of the syntax is that it is not easy to play with more sexiest things. For example, a framework like rails, and Python cannot do DSL things, but the rigid side of the syntax is more standard, relatively speaking, it is easier to organize large-scale teams for development to adapt to the engineering requirements of software development.

    Ruby's syntax is very flexible. Matz's design of Ruby is also based on coding for fun. Therefore, we can use Ruby to develop many tricks and use enough skills, a DSL that can be written in Ruby to approach a natural language.ProgramIt is really fun to play Ruby. Rails can be used in rubyCommunityThe birth of the python community, rather than the birth of the python community, is absolutely directly related to the programming language. However, another aspect of Ruby syntax flexibility is the diversity of programming implementation styles, which is a challenge for large-scale team collaboration and management.

    Ii. Python parser is more mature, and the quality of third-party libraries is high

    Although the ruby1.9 parser has greatly improved its performance and many new featuresSource codeFrom the implementation point of view, it is basically added by applying patches on the ruby1.8 source code. From the perspective of the source code structure, Ruby implementation is too old. Ruby is difficult to expand and can only be patched continuously. This is why so many new Ruby parser implementations have emerged in the Ruby community. To a large extent, this restricts the development speed of Ruby. The Python parser is relatively more mature and stable.

    In terms of the number of third-party class libraries, Ruby is not less than python, but the python of high-performance, high-quality, and tested third-party class libraries is obviously more than Ruby. In fact, many Ruby third-party class libraries are not very mature, therefore, this restricts the development of Ruby to a large extent.

    Iii. python is widely used, while Ruby is mainly confined to the Web field.

    Python is widely used in many fields. In addition to web development, it is also widely used in high-performance server implementation at the backend of the server, various intensive operations at the backend of the server, full-text retrieval, and various text processing, in addition, wxpython is also a mature cross-platform GUI framework in the desktop application field. For some special applications, for example, calling the operating system kernel API, python can also do well, for example, real-time synchronization of a large number of small files, it is implemented using python to directly call the inotify feature of Linux kernel. So it can be said that python is a Swiss Army knife in the field of software development, and everything can be done.

    It is precisely because of the constraints of the Ruby parser and Ruby class library that Ruby applications are mainly confined to the web development field. Currently, Ruby applications cannot be extended beyond the web development field. It is said that Douban has considered Ruby on Rails in the early days, but because Ruby cannot do other things, python can be a big deal, and finally gave up Ruby's choice of Python.

    4. Ruby is the king in the Web Field

    As Internet applications penetrate into various fields of software development, web development accounts for a growing proportion of the development of the entire software industry. Although Ruby is restricted in other fields, it is absolutely the king in the Web development field. The rails framework is far ahead of any potential competitor by 108,000. Therefore, although ruby may have such a problem, when it comes to web development, rails is almost the only undisputed choice.

    Although python is comprehensive, it is not widely used in the Web development field. Although there are many web frameworks, none of them can really pick up the spotlight. Although Django is popular in the python community, but there are also defects in many aspects. Nowadays, Internet applications are often mixed programming in multiple languages. Ruby's defects beyond the Web can also be compensated by other languages.

    5. Python package management is inferior to Ruby

    Despite the higher quality and maturity of Python third-party class libraries, the python community lacks Ruby gem, a good package management software and package release website. Therefore, application construction is not as convenient as Ruby, so user-friendly. Especially when upgrading the version of the class library, there will be a lot of trouble, which is not as simple as Ruby gem.

    But in general, Python and Ruby are two programming languages with extremely high similarity. Even if both programming languages are learned, it will not waste too much time. If I personally choose, I will first use rails to build a web application, and then select Python or Java to process some server back-end operations as needed. In short, the future is still an era of mixed programming. We need to learn more about some programming tools and then eat food as needed.

    This article is from Robbin's blog: record the python community gathering in Shanghai and talk about Python and Ruby.

Related Article

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.