Home Backend Development PHP Tutorial Comparison between Rails and Node.js/PHP/Python etc.

Comparison between Rails and Node.js/PHP/Python etc.

Nov 11, 2016 am 09:58 AM
ruby

First of all, this is not a comparison post. Can languages ​​and frameworks be compared?

Secondly, I haven’t used them all

The only purpose of this article is to remind myself (and you who are browsing) what you really need to pay attention to

PHP
PHP is a simple but dirty language, and simple means The learning curve is low, mainly because there are a large number of fool-proof applications based on PHP, such as wordpress, discuz, etc. If you only have general blog or forum needs, as long as you make good use of Google, you don't need to write even a single line of code. But, is PHP itself simple? Personally, I don’t think so, and I won’t list the reasons one by one. As for dirty, I think it’s more about its design. The language design is rather poor. You can get a glimpse of it just by looking at the function names connected by underscores. Except for experienced PHP programmers, it is difficult for anyone to write a program that is not serious. Vulnerable code.

Recommended PHP development frameworks: First class: Yii, Yaf, Symfony; Second class: Zend, Cake, CI

Django
Django is a web development framework based on Python, which is very similar to Rails. A few years ago, it was better than Rails The good thing is that Python is more "reliable" than Ruby. The so-called reliability means that more people use it, it has more documents, and it is easier to find answers by asking. However, with the gradual rise of Ruby in recent years (mostly driven by Rails) , more and more websites use Rails. When it comes to language design alone, Python is not necessarily simpler than Ruby, and its consistency is slightly less consistent. It can be said that Python’s only advantage is that many serious scientists are using it, accounting for most of the world in the field of scientific computing, while Ruby is made in Japan. (Ruby borrowed from Python). If Ruby was a language born in European and American countries at the same time as Python, I believe that there would be nothing wrong with Python now.

Rails
Rails is an amazing web framework. The shadow of Rails can be seen in almost all mainstream web frameworks now. Rails uses the characteristics of Ruby to the limit. Rails can be applied to all large, medium and small applications. Very large-scale applications cannot be handled by any scripting language alone. After years of development, Rails has washed away its glory and is now in a state of "outstanding". It can be said that no framework can surpass Rails in terms of comprehensive capabilities (ease of use, simplicity, efficiency, learning curve, etc.), and NodeJS cannot. Django is not good, and other "niche" languages ​​are even less good. On the contrary, Rails is in a state of rapid development, and successful cases of ultra-large-scale applications will appear one after another in the future.

NodeJS
NodeJS is a promising web framework, but it is a pity that it was born a few years later, otherwise it would still be able to compete with Rails. Compared with PHP, Django and Rails, NodeJS has relatively few open source projects and large-scale There are also slightly fewer successful cases, but its design and performance are also quite simple and efficient. I believe it will also shine in the near future.

ASP, JSP, etc.
Complex, bloated, enterprise-level, companies that rely on the accumulation of people, state-owned enterprises, banks, e-commerce, start-up companies will commit suicide if they use these, and it will also commit suicide if important departments do not use these (recruiting people are not good, they can only Use after-sales service).

Others
Other languages ​​have their own uses, but they just happen to be used in business. Strictly speaking, they cannot be considered specialized in network development, such as Clojure, Io, etc. We won’t discuss it here for now.

Summary:

If I were asked to choose the learning route again (only language, excluding server, db aspects), I would

understand php, no need to go in depth

understand Yii, an MVC framework for php, no need In-depth

Basically learn Ruby

Basically learn Rails

Learn Ruby thoroughly

Learn Rails thoroughly

Understand Python, Django, Lisp, Clojure, NodeJS, etc.

-------------------------- ----------Separation line------------------------------

This article is about rails The applicable scenarios for nodejs are described very well. rails and nodejs are the two most noteworthy backend technologies.
Disclaimer: This article is by no means a discussion about the advantages and strategies of NodeJS and Ruby on Rails. It only describes some of the thinking in our decision-making process and the reasons behind our decisions. Both frameworks are excellent and have accomplished their original design goals well, which is why some of our modules still run on NodeJS.

I am a big fan of NodeJs. I think this is a very exciting technology and I believe it will become more and more popular. I have a huge appreciation for this technology - even though we recently migrated our Targeter App from NodeJS to Ruby on Rails.

The reason why we used NodeJS to develop it was simple. I have a package that gets our app online very quickly (it took us 54 hours to do it), and I use JavaScript more than Ruby. Because our technical architecture involves MongoDB, these expertise of mine only make sense in a NodeJS environment. However, as the application grew in size, I realized that choosing NodeJS to implement this application was a wrong choice. Let me outline why.

NodeJS is well suited for applications that have a large number of short-lived requests. For traditional CRUD applications, it's fine, but not ideal. There are very mature and optimized frameworks in PHP, Ruby, and Python languages ​​to handle this kind of application. The idea that everything in NodeJS executes asynchronously has no effect on CRUD applications. Popular frameworks in other languages ​​provide very good caching technology that meets all your needs, including asynchronous execution.

NodeJS is a very young technology framework, and its surrounding libraries are not very mature. I say this without any offense to the code donors. They are excellent people and have developed many excellent libraries. However, most libraries need improvement, and the fast-growing environment of NodeJS means that there are a lot of changes in each version upgrade; when you use a cutting-edge technology, it is very important that you keep up to date as soon as possible. version of. This brings a lot of trouble to entrepreneurial companies.

Another reason is about testing. The testing framework in NodeJS is not bad, but it is still inferior compared to the ones on Django or RoR platforms. For an application that has a large number of code submissions every day and will be released within a day or two, it is crucial that the program does not have problems, otherwise your hard work will not be worth it. No one wants to spend a day fixing some stupid bugs.

Last point, what we need is something that can cache everything, and it needs to be implemented as quickly as possible. Although our application is growing, with tens of thousands of hits per second, there will never be a large number of access requests; this is not a chat program! The main program can reach 1000RPS at most. Such a load is nothing to Ruby on Rails and Nginx.

If you are still reading this article now, then you have seen everything I have to say, and you may be very insistent and want to know where our application is still using NodeJS. Well, our application consists of two parts. The first is the interface, the part that users see, and the second is the part responsible for report management and the logging function. The latter is one of the best usage scenarios for NodeJS, where there are a large number of short-cycle requests. This part of the action needs to be executed as soon as possible, even before our data push is completed. This is important because when the request execution has not yet ended, the browser continues to wait for the response to end, which will affect the user experience. The asynchronous nature of NodeJS saved us. The data is either stored in the database or processed, and once the request is completed, the browser can start doing other important things.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

In-depth analysis of the similarities and differences between Golang and Ruby In-depth analysis of the similarities and differences between Golang and Ruby Jun 01, 2024 pm 08:46 PM

The main difference between Go and Ruby is that Go is a statically typed compiled language that supports lightweight parallelism and efficient memory management, and is suitable for writing high-concurrency applications; Ruby is a dynamically typed interpreted language that supports true parallelism but memory management It requires manual control and is suitable for writing flexible web applications.

Why have Python, Ruby and other languages ​​deprecated the increment operator? Why have Python, Ruby and other languages ​​deprecated the increment operator? May 11, 2023 pm 04:37 PM

Many people may notice a phenomenon, that is, in some modern programming languages ​​​​(of course, not referring to "recent" programming languages), the increment and decrement operators have been cancelled. In other words, there is no such expression as i++ or j-- in these languages, but only i+=1 or j-=1 Such an expression. This answer will explore the background and reasons for this phenomenon from the perspective of design philosophy. Strictly speaking, it may be biased to say "i++ is disappearing", because it seems that only Python, Rust and Swift among mainstream programming languages ​​do not support the increment and decrement operators. When I first came into contact with Python, this was also

How does Ruby use Mysql2 connection to operate MySQL? How does Ruby use Mysql2 connection to operate MySQL? Apr 17, 2023 pm 10:07 PM

Ruby operates MySQL using mysql2 to connect to mysql and operate mysql. geminstallmysql2 connects to mysql to establish a connection: require'mysql2'conn=Mysql2::Client.new({host:'192.168.200.73',username:'root',password:'P@ssword1!'}) The accepted connection options include: Mysql2::Clie

How to implement a simple data conversion function using MySQL and Ruby How to implement a simple data conversion function using MySQL and Ruby Sep 21, 2023 am 08:07 AM

How to use MySQL and Ruby to implement a simple data conversion function. In actual development work, data conversion is often required to convert one data format into another data format. This article will introduce how to use MySQL and Ruby to implement a simple data conversion function, and provide specific code examples. First, we need to install and configure the MySQL and Ruby environments. Make sure you have a MySQL database installed and can connect to the database via the command line or other tools. In addition, you need to install

How to implement a simple asynchronous task scheduling function using MySQL and Ruby How to implement a simple asynchronous task scheduling function using MySQL and Ruby Sep 20, 2023 am 10:48 AM

How to use MySQL and Ruby to implement a simple asynchronous task scheduling function. Most of the previous web applications used a synchronous method to process requests, that is, after the user sends a request, the server will immediately process the request and return the result. However, as the complexity of applications increases, the processing efficiency of synchronous methods gradually becomes inefficient, so asynchronous task scheduling has become a common requirement in modern web applications. This article will introduce how to use MySQL and Ruby to implement a simple asynchronous task scheduling function, including task

How to use MySQL and Ruby to implement a simple data analysis report function How to use MySQL and Ruby to implement a simple data analysis report function Sep 20, 2023 pm 05:09 PM

How to use MySQL and Ruby to implement a simple data analysis report function Introduction: In today's data-driven era, data analysis plays a crucial role in corporate decision-making and development. As an important part of data analysis, data analysis reports are of great significance for organizing, visualizing and interpreting data. This article will introduce how to use MySQL and Ruby to implement a simple data analysis report function, and provide corresponding code examples. 1. Database design and table creation must realize data analysis and reporting functions

How to use MySQL and Ruby to implement a simple data query and analysis function How to use MySQL and Ruby to implement a simple data query and analysis function Sep 21, 2023 pm 04:36 PM

How to use MySQL and Ruby to implement a simple data query and analysis function. In today's big data era, data analysis has become an indispensable part in many fields. When performing data analysis, the most common operation is data query. This article will introduce how to use MySQL and Ruby programming language to implement a simple data query and analysis function, and give specific code examples. First, we need to install the MySQL and Ruby development environments. MySQL is an open source relational database

How to build scalable web applications using Vue.js and Ruby How to build scalable web applications using Vue.js and Ruby Aug 03, 2023 pm 02:27 PM

How to use Vue.js and Ruby language to build scalable web applications. In recent years, with the development and growing needs of web applications, building scalable web applications has become an important topic. As a lightweight JavaScript front-end framework, Vue.js provides a flexible, efficient and scalable solution. At the same time, Ruby, as a concise and easy-to-read programming language, can be used to construct powerful back-end systems. This article will introduce how to combine Vue.js and Ruby language to build

See all articles