Ruby is not as good as Python

Source: Internet
Author: User

I have no intention of initiating a language dispute. I just want to talk about my own ideas.

I have also studied Ruby. I feel that it is too complicated, with too many syntaxes, too much sugar, and too many abbreviations.

I haven't played Ruby for a long time, and I can't understand this code.

  1. Class Customer <activerecord: Base
  2. Has_dependencies: orders,: Dependent =>: Destroy
  3. End
  4. I also don't want to understand it.
I read another article on the ruby Official Website: to Ruby from Python. This article is also awesome. It's just a waste of shame to turn black and white upside down! Address: http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby-from-python/

Ruby does not have tuples. This is not an advantage. Tuples are the core of functional programming. Ruby boasted functional programming all day long, and it was nothing to blow without it.

· There are no "New Style" and "Old Style" classes. Just one kind.

· Ruby is single-stick. The new Python style class is single. However, there is no root class for the class of the old Python style.

· Python classes are generated from Metadata classes. Classes in the old Python style are also generated from the Meta class and can be customized.

Ruby seems to have something similar. Sorry, I haven't played Ruby for a long time.

 

· You never directly access attributes. with Ruby, it's all method CILS.

· The property cannot be accessed in Ruby. It provides the automatically generated get/set method. Python can directly access attributes. You need to write the get/set method or directly operate on variables. The _ ATTR _ method can also intercept access to attributes.

Ruby function calls () can be omitted, which can greatly damage code readability.

· There's public, private, and protected to enforce access, instead of Python's _ voluntary _ underscore _ Convention __.

· Ruby enforces the public, private, and protected of classes.

· All Python objects are public, but variables starting with "_" are confused with names.

I think it doesn't matter whether it is.

· "Mixin's" are used instead of multiple inheritance.

· Ruby is single-inherited and has a specific Mixin mechanism. Python uses multi-inheritance implementation.

· Ing refers to multiple classes that inherit data without methods.

· You can add or modify the methods of built-in classes. Both classes let you open up and modify classes at any point, but Python prevents modification of built-ins-Ruby does not.

· Python cannot modify the methods and attributes of built-in classes, but can only inherit from them.

· Ruby can be modified. -------- Is there a bird? How can I break the basic type?

· You 've got true and false instead of true and false (and nil in stead of none ).

· The True, false, and none keywords in Python are really strange. It is not a habit to use case-insensitive keywords.

· There are a number of shortcuts that, although give you more to remember, you quickly learn.

They tend to make Ruby fun and very productive.

· This is a major disadvantage of Ruby. Ruby has many shortcut keys, default value. Very strange. The class generated by rails above is too ugly to understand.

The readability of the Code must be the first. Ruby has a small amount of code but is very obscure.

 

Ruby's book is often proud of the following:

1. Ruby is a class-based language similar to Java.

Everything in ruby is an object, including basic types and integers.

In fact, python is better at object orientation.

Everything in python is an object. Python allows direct execution of the source code in the module. Python also allows you to directly define variables and functions without using classes.

Ruby said that python is not as pure as it is. In fact, it is completely slander!

Python functions are also objects! Is an instance of the function class.


2. Ruby advertised its strong functional programming capabilities. Lambda or something.

In fact, python is more powerful in function-oriented programming.

Python supports tuples, lambda, embedded functions, closures, and partial functions. Ruby only has one Lambda!


3. Ruby also advertised its own Mixin mechanism. It specifically defines a module mechanism for Mixin.

Python supports a more concise and powerful Mixin mechanism. Python supports multi-inheritance!


4. Ruby advertises itself as a DSL language and has many key keys.

In fact, the source code is hard to understand.

5. Ruby often claims to have many libraries and many applications. In addition to some Web applications of rails, what else does Ruby have? Chinese programmers seldom learn python, making people feel that python is a non-mainstream language. In fact, on the Linux platform, the most open-source and commercial programs are C programs, and the second is Python. A large number of programs in Linux are written in Python. For example, libvirt and related suites in virtualization. Python also has many frameworks in the Web development field. Python's open-source resources are vast. How is Ruby compared? To be honest, Ruby is also a well-designed language. Very flexible and powerful. However, I am not familiar with rubyer's attempt to slander other languages and demonstrate the World's Best posture. Yu heshengliang! Ruby is inferior to Python. I prefer python!

 

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.