ruby on rails_ruby on rails vs node js你应该选择什么

ruby on rails

What is launching a successful startup like? It’s like baking a delicious cake, that everyone likes. Well, almost. What do these procedures have in common? Ingredients. For the cake to be tasty you must know the recipe very well and use exactly those ingredients that are mentioned. Perfectly chosen ingredients equal tasty cake with the flavor you want to achieve.

怎样启动一个成功的创业公司? 就像每个人都喜欢烤美味的蛋糕一样。 好吧,差不多。 这些程序有什么共同点? 配料。 为了使蛋糕鲜美,您必须非常了解食谱,并完全使用提到的配料。 完美选择的食材将美味的蛋糕与您想要达到的风味相提并论。

Now, let’s take this parallel and move it to your startup software. The key ingredient of your startup is a programming language.

现在,让我们并行进行并将其移至启动软件。 启动的关键要素是编程语言。

If you already analyzed available options and are now considering either Ruby on Rails or Node.js, we suggest looking through this comparison article for a clearer vision.

如果您已经分析了可用的选项,并且现在正在考虑使用Ruby on Rails或Node.js,我们建议您仔细阅读这篇比较文章,以获得更清晰的视野。

Node.js (Node.js)

This open-source runtime environment came out in 2009 and slowly gained developers’ favor. Node.js is used for server-side as well as client-side scripting, which makes web app development possible with a single programming language, JavaScript. Google-designed V8 JavaScript engine allows executing code outside the browser.

该开源运行时环境于2009年问世,并逐渐获得了开发人员的青睐。 Node.js用于服务器端和客户端脚本,这使得使用单一编程语言JavaScript进行Web应用程序开发成为可能。 Google设计的V8 JavaScript引擎允许在浏览器外部执行代码。

Node.js is characterized by the Node Package Manager ecosystem that includes a bunch of open source libraries. Built-in modules make Node.js an expansive platform and allow managing all files including computing resources and security.

Node.js的特征在于Node Package Manager生态系统,其中包括一堆开源库。 内置模块使Node.js成为一个扩展平台,并允许管理所有文件,包括计算资源和安全性。

Node.js的优势 (Node.js advantages)

易于扩展(Easy scalability)

One of the key strengths of Node.js is its scalability. Being a lightweight development environment, Node.js is an amazing option for microservices architecture. This technology allows breaking the application logic into small microservices and modules as opposed to a single monolithic core. Ultimately, it simplifies the process of adding more microservices on top of the existing ones than to integrate additional features with the basic app functionality.

Node.js的主要优势之一是其可伸缩性。 作为轻量级开发环境,Node.js是微服务体系结构的绝佳选择。 这项技术可以将应用程序逻辑分解为小型微服务和模块,而不是单个的单核。 最终,与将附加功能与基本应用功能集成在一起相比,它简化了在现有微服务之上添加更多微服务的过程。

Architectural style like this became really popular recently and is used alongside with Node.js by IBM, Uber, Walmart, and Netflix.

像这样的建筑风格最近变得非常流行,并且与IBM,Uber,沃尔玛和Netflix的Node.js一起使用。

快速处理 (Fast-processing)

According to performance tests run by Toptal, Node.js is pretty fast. Why is it so? V8 engine used in Node.js was initially implemented for the Chrome browser which granted a lot of benefits to this development environment. Moreover, due to the asynchronous model, Node.js processes requests without delays. In synchronous processing code is executed only in one thread, therefore other tasks wait when the previous requests are finished. Asynchronous processing enables the process to be non-blocking.

根据Toptal进行的性能测试,Node.js相当快。 为什么会这样呢? Node.js中使用的V8引擎最初是为Chrome浏览器实现的,这为该开发环境带来了很多好处。 此外,由于采用了异步模型,Node.js可以无延迟地处理请求。 在同步处理中,代码仅在一个线程中执行,因此其他任务在先前的请求完成时等待。 异步处理使过程成为非阻塞的。

强大的技术堆栈 (Robust technology stack)

Node.js developers get all the advantages of full-stack JavaScript enabling their teams to be more flexible and save considerable amounts of time. Those who are proficient in front-end can also develop on the server-side and reuse code in modules.

Node.js开发人员获得了全栈JavaScript的所有优势,从而使他们的团队更加灵活并节省了大量时间。 精通前端的人员也可以在服务器端进行开发,并在模块中重用代码。

丰富的生态系统 (Rich ecosystem)

Node.js package manager has 836,000 libraries available and there are around 10,000 that are published each week, which makes the technology ecosystem quite rich. Besides, according to npm’s study rich ecosystem and availability of libraries is the main reason why most developers/companies choose Node.js.

Node.js软件包管理器有836,000个可用库,每周大约发布10,000个,这使技术生态系统非常丰富。 此外,根据npm的研究,丰富的生态系统和库的可用性是大多数开发人员/公司选择Node.js的主要原因。

Image for post
Why did you went with Node.js for your product/products?
您为什么要为产品使用Node.js?

Ruby on Rails (Ruby on Rails)

Contrary to Node.js, Ruby on Rails is a framework created to make the development process faster and easier without bottlenecks within the processes. The framework is written in Ruby, which is a multi-purpose language. Released in 2005 it completely changed the development process by reducing developer’s work with the boilerplate code allowing them to focus on the software logic.

与Node.js相反,Ruby on Rails是一个框架,旨在使开发过程更快,更轻松,而不会出现瓶颈。 该框架用Ruby编写,Ruby是一种多用途语言。 它于2005年发布,通过减少开发人员使用样板代码的工作量,从而使他们可以专注于软件逻辑,从而完全改变了开发过程。

Ruby on Rails的好处 (Ruby on Rails benefits)

快速的应用开发(Rapid application development)

The framework is easy to learn and simplifies the development of time-consuming tasks. Thanks to the variety of tools and libraries it’s much easier to optimize, debug, and test the code. Ruby’s simple syntax is also worth mentioning here.

该框架易于学习,并简化了耗时任务的开发。 由于有了各种工具和库,优化,调试和测试代码要容易得多。 Ruby的简单语法在这里也值得一提。

广泛的基础设施 (Extensive infrastructure)

An integrated webserver and database that includes scripts and generators ensure rapid development and good code quality.

包含脚本和生成器的集成Web服务器和数据库可确保快速开发和良好的代码质量。

数据库信息交换 (Database info exchange)

With Rails, it is effortless to migrate databases. ActiveRecord model painlessly translates discrepancies among the multiple SQL interactions. It means that developers can use RoR language to introduce alterations to the database tables and not be busy with SQL code. What’s more, the Rails app can work in various database environments.

使用Rails,可以轻松地迁移数据库。 ActiveRecord模型可以轻松地转换多个SQL交互之间的差异。 这意味着开发人员可以使用RoR语言将更改引入数据库表,而不必忙于SQL代码。 而且,Rails应用程序可以在各种数据库环境中工作。

良好的社区 (Good community)

An open-source web framework is massively supported by developers, which helps to deal with challenges, updates, and security issues.

开发人员大量支持开放源Web框架,这有助于应对挑战,更新和安全性问题。

比较方式 (Comparison)

Ruby on Rails与Node.js —体系结构(Ruby on Rails vs Node.js — Architecture)

There are many support functions within the Node.js environment, however, JavaScript wasn’t created for backend processes support and has some limitations regarding modern architecture design.

Node.js环境中有许多支持功能,但是,JavaScript不是为后端流程支持而创建的,并且在现代体系结构设计方面有一些限制。

Contrary to Node.js, Ruby on Rails is a framework that has been specifically designed to power the web architecture development and eliminate configuration issues.

与Node.js相反,Ruby on Rails是一个专门设计用于支持Web架构开发并消除配置问题的框架。

Ruby on Rails与Node.js —开发速度 (Ruby on Rails vs Node.js — Development speed)

JavaScript appeared years ago, thus Node.js can take advantage of all the experience and ready-to-use solutions JavaScript has. However, due to a limited set of possibilities, it’s lagging behind any full-scale backend programming language. Therefore, it takes time to come up with a solution to a problem.

JavaScript是在几年前出现的,因此Node.js可以利用JavaScript的所有经验和即用型解决方案。 但是,由于可能性有限,它落后于任何全面的后端编程语言。 因此,花时间来解决问题。

Ruby on Rails is probably one of the easiest languages to learn and use. A number of tools and easy syntax do their thing and enable fast development.

Ruby on Rails可能是最容易学习和使用的语言之一。 许多工具和简单的语法都可以发挥作用并实现快速开发。

Ruby on Rails与Node.js —性能 (Ruby on Rails vs Node.js — Performance)

Node.js is praised for dazzlingly fast performance. Google-designed V8 and asynchronous code made Node.js a number one technology option for applications with heavy operations. Node.js performs 20 times better than Ruby on Rails.

Node.js因其惊人的快速性能而受到赞誉。 Google设计的V8和异步代码使Node.js成为操作繁重的应用程序的第一技术选择。 Node.js的性能比Ruby on Rails高出20倍。

Unfortunately, with RoR it is much harder to achieve the concurrency. It doesn’t completely support asynchronous code and the performance is not that high.

不幸的是,使用RoR很难实现并发。 它不完全支持异步代码,性能也不是很高。

Ruby on Rails与Node.js —学习曲线 (Ruby on Rails vs Node.js — A learning curve)

Ruby is super easy to learn. Besides, there are multiple courses and tutorials on Ruby and you can get as much information as needed by joining the huge and active Ruby on Rails community.

Ruby非常易于学习。 此外,有许多关于Ruby的课程和教程,您可以通过加入庞大而活跃的Ruby on Rails社区来获得所需的尽可能多的信息。

Node.js has an even shorter learning curve. It is easy for developers with various backgrounds (like Java or C#) to master, especially to those who know JavaScript.

Node.js的学习曲线更短。 具有各种背景(例如Java或C#)的开发人员很容易掌握,特别是对于那些了解JavaScript的人。

Ruby on Rails与Node.js —可伸缩性 (Ruby on Rails vs Node.js — Scalability)

Ruby cannot boast high scalability, therefore many companies including the New York Times, Linkedin, Uber, and PayPal switched to Node.js technology.

Ruby无法实现高可扩展性,因此许多公司,包括《纽约时报》,Linkedin,Uber和PayPal都转向了Node.js技术。

Thanks to the cluster module Node.js is more scalable than Ruby. Clusters with abstractions are spawning the process based on the workload of the app with the least number of CPUs.

多亏了集群模块,Node.js比Ruby具有更高的可伸缩性。 具有抽象的集群根据CPU数量最少的应用程序的工作量来生成进程。

当Node.js是更好的选择时 (When Node.js is a better choice)

Scalability and performance are the main assets of Node.js. Event-based technology is a great solution for real-time applications that have many simultaneous requests and it easily handles the process of client-server data exchange. Real-time apps include video conferencing, collaborating apps, and chat apps. Being a single-threaded environment, Node.js isn’t preferable for applications with heavy images and graphics.

可伸缩性和性能是Node.js的主要资产。 对于具有许多同时请求的实时应用程序,基于事件的技术是一个很好的解决方案,它可以轻松处理客户端-服务器数据交换的过程。 实时应用程序包括视频会议,协作应用程序和聊天应用程序。 作为单线程环境,Node.js对于具有大量图像和图形的应用程序不是首选。

当Ruby on Rails是更好的选择时 (When Ruby on Rails is a better choice)

By now you may have noticed that Ruby on Rails is better for CPU intensive apps and fast development. Contrary to Node.js Ruby on Rails copes well with heavy graphics and images. If you want to roll out your websites quickly there’s no better option than Rails. It allows you to create prototypes in a blink of an eye, while Node.js requires additional resources.

到目前为止,您可能已经注意到Ruby on Rails对于CPU密集型应用程序和快速开发而言更好。 与Node.js相反,Ruby on Rails可以很好地处理大量图形和图像。 如果您想快速推出您的网站,没有比Rails更好的选择了。 它使您可以在眨眼间创建原型,而Node.js需要其他资源。

最后的想法 (Final thoughts)

All in all, there are two main parameters to consider, the speed and the server performance. If your app runs a lot of simultaneous requests choose Node.js. Does your app deal with CPU intensive requests? Go with Ruby on Rails.

总之,要考虑两个主要参数,即速度和服务器性能。 如果您的应用程序同时运行大量请求,请选择Node.js。 您的应用程序是否处理CPU密集型请求? 与Ruby on Rails一起使用。

Whether you need further consultation or already made a choice regarding technology and need some help with development, inVerita will be more than happy to guide you through this process.

无论您需要进一步的咨询还是已经在技术方面做出选择并需要一些开发方面的帮助, inVerita都会很乐意为您提供指导。

翻译自: https://medium.com/swlh/ruby-on-rails-vs-node-js-what-should-you-choose-70d25d849ae8

ruby on rails

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Windows上安装Ruby on Rails,你可以按照以下步骤进行操作: 1. 首先,确保你的系统已经安装了RubyRubyGems。你可以在Ruby官方网站(https://www.ruby-lang.org/)下载并安装最新版本的Ruby。 2. 打开命令提示符(Command Prompt)或PowerShell,并输入以下命令来安装Rails: ``` gem install rails ``` 这将使用RubyGems安装最新版本的Rails框架。 3. 安装完成后,你可以通过运行以下命令来验证Rails是否已成功安装: ``` rails --version ``` 如果一切顺利,你将看到Rails的版本号。 4. 接下来,你需要安装一个JavaScript运行环境。推荐使用Node.js,你可以在其官方网站(https://nodejs.org/)下载并安装最新版本的Node.js。 5. 安装完成后,你还需要安装一个数据库管理系统。Rails支持多种数据库,最常用的是MySQL和PostgreSQL。你可以选择其中一种作为你的开发环境,并安装相应的数据库软件。 - 如果选择MySQL,可以在MySQL官方网站(https://dev.mysql.com/downloads/windows/installer/)下载并安装MySQL Community Server。 - 如果选择PostgreSQL,可以在PostgreSQL官方网站(https://www.postgresql.org/download/windows/)下载并安装最新版本的PostgreSQL。 6. 安装数据库管理系统后,你还需要安装相应的Ruby库以便Rails与数据库进行交互。例如,如果你选择了MySQL,可以运行以下命令来安装相应的库: ``` gem install mysql2 ``` 如果你选择了PostgreSQL,可以运行以下命令来安装相应的库: ``` gem install pg ``` 这些命令将会使用RubyGems安装相应的库。 完成以上步骤后,你就成功在Windows上安装了Ruby on Rails。你可以开始使用Rails来开发Web应用程序了。祝你好运!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值