Ruby on Rails vs Yii2

Ruby on Rails or Yii2: for what each solution is suitable?
24 July 2017   1889
Ruby on Rails

Framework written in the Ruby programming language

When it comes to web development, usually PHP immediately comes to mind - a language designed specifically for Internet applications. It has existed for more than 20 years, so it is not surprising that for such a period, many frameworks have been released.

However, the web environment is not only the prerogative of PHP. A worthy competition to this language is Ruby. He comes to the rescue, if it is necessary to create not a blog or a corporate site, but an atypical solution. However, sometimes you can find standard Web resources developed in Ruby.

In this article we will compare the two most popular frameworks for Ruby and PHP - Rails and Yii2.

Accessibility for beginners

PHP has a low entry threshold - you can start writing code quickly enough without even having any basic programming knowledge. Many web developers start with this language. Because finding a web developer familiar with PHP is not a problem. On the other hand, Yii is not the simplest framework, because it Requires certain rules when writing code.

Yii2 interface
Yii2 interface

Ruby on Rails is more complicated at the beginning of the path, but then it can greatly facilitate the life of the developer due to the abundance of magic and gems. And the language itself has many built-in useful methods, for example, for working with dates or arrays.

Ruby on Rails syntax
Ruby on Rails syntax

Performance

Rails is inferior in speed to work, because Ruby is basically a slow language, and the framework inherits this problem. Yii is not just faster than RoR, it's the fastest PHP framework. Therefore, to create a project that is critical to high performance, Yii is the only alternative among all other solutions in PHP.

Libraries and extensions

The total number of plug-ins is about the same for both solutions. However, thanks to the fact that RoR has been actively developed and supplemented since 2003, most of its gems are reliable, time-tested solutions with a lot of background information, both from developers and the community.

Debugging tools

The most popular debugging tool for php is XDebug. This powerful solution was one of the first with the system of control points and offers developers on Yii a really great set of useful features:

  • Complete information about the current state of the program;
  • Changing the values ​​of variables during the execution of the script;
  • Remote start with two session modes;
  • Built-in support for xdebug-client in most popular IDE for PHP.

True, using this debugger may require additional settings for the environment where the application is deployed.

In Rails Debugger gem is used, which provides only the basic functionality, has not the most convenient mode of operation and the need to manually mark the place for control points with the word debugger.

CRUD-applications development

In Yii, there are excellent built-in tools for creating CRUD applications. GridView, ListView and DetailView are fully supported, there is a feature of checking and searching for jQuery. Additional comfort is provided by automatic generation of code using Gii, which creates a sufficiently high-quality script that requires minimal revisions.

Ruby on Rails also can offer support for tools for working with CRUD-applications, however for full use of all features you will need to use additional modules, for example, JS-library Ext and plugin Netzke.

Documentation and support

Both frameworks exist for a long time and therefore have detailed documentation that makes it much easier to find answers for any questions. PHP, as a more common language, has a large community that actively communicates with the forums and supports Yii. However, Ruby on Rails also has an abundance of supporting information, and in thematic communities one can always rely on help.

The situation with technology is different. PHP supports any inexpensive hosting, so you can use Yii capabilities almost everywhere, which makes the framework suitable even for small projects. Ruby is a more niche language designed for complex web applications and startups, and not all hostings support it, and where RoR is available there are sometimes limitations - for example, installing gems through a ticket for Techsupport.

Final comparison of Ruby on Rails and Yii2

Yii2 Ruby on Rails
A popular language and a framework with a low entry threshold. A niche language that requires time to learn from scratch.
High performance Lower performance
Not the most convenient syntax and readability of the code. Excellent code readability, many useful built-in methods
Powerful and convenient XDebugger Debugger gem is used for a debugging, Inferior to the capabilities of XDebugger
Built-in CRUD application suppport Additional gems and plugins are required for CRUD support
Detailed documentartion Less detailed documentation
Possibility to install framework on any hosting Not all hostings support Rails and some have limitations
Suitable for small projects Suitable for bigger projects

 

What technology do you choose, Rails or Yii2?

What technology do you prefer? Ruby on Rails or Yii2? Or maybe you are already using some of it? Please, share your thoughts with the community. Also, after the voting, you will be able to see what people like the most. Your opinion is very valuable for the Hype.Codes team.

Ruby Meditation #22 in Dnipro

Meditation will be held on May 19, at Parle, Troitska St, 21 g, Dnipro
27 April 2018   533

On Ruby Meditation #22 you will hear about helpful tools and gems for building Slack apps, examples how to build functional architecture with ruby, which place takes Ruby on Rails among alternatives in 2018 and much more.

Come and get your portion of good mood, knowledge, professional communication and tasty lunch :)

Share your positive experience and best practices on this Ruby Meditation #22. If you have any work issues you cannot solve, our community will gladly help you to find the best way out in live discussion at Lightning talks session. You may also try yourself as a speaker with a short 5-10 mins talk. Fill in this form.

Programme

Anna Shcherbinina

Topic: "Docker + GPU. Not about mining."

Anna Shcherbinina
Anna Shcherbinina

Just before Christmas we launched a new body-measurement feature for our shapify.me project. A person goes into the 3D booth, gets scanned, and the body-measurements are calculated with the 3D scan data. We couldn't avoid using a GPU with these calculations.

How to install this branch of processing into our elegant scaling pipeline? When you're dealing with 3D scans you should remember two things: it's expensive and time-consuming. By the way, its workload fluctuates throughout the days. The easiest solution for us was to use Docker.

This speech is not about mining, but the most helpful articles for us were ones such as "Building your own mining farm". That's because we use quite a similar infrastructure.

GPU, Docker, scaling. What we achieved, where we failed, and what it became of it in the end is all included in my speech.
 

Anna Shcherbinina

Head of Web, Artec3D, Luxembourg

Kirill Shevchenko

Topic: "Building Slack apps with Ruby."

Kirill Shevchenko
Kirill Shevchenko

Overview of Slack APIs. Their features, restrictions, and bottlenecks. Which API is right for you? Helpful tools and gems for building Slack apps.
 

Kirill Shevchenko

Ruby/JS Developer

Valentine Ostakh

Topic: "Functional objects in Ruby: new horizons "

Valentine Ostakh
Valentine Ostakh

Overview of functional programming concepts.  What is functional objects. Examples how to build functional architecture with ruby.
 

Valentine Ostakh

Ruby/JS Developer

Leonid Shevtsov

Topic: "A polyglot's view of Ruby on Rails"

Leonid Shevtsov
Leonid Shevtsov

Nowadays, it's hip to switch from Rails to other languages and frameworks. Leonid, too, has abandoned Rails, played the field a bit, and has come around to occasionally but consistently picking Rails for some projects. What's the modern reason to use Rails? What are the strengths of Ruby and Rails and how to build upon them? When you should really jump to some other platform? Let's answer these questions in a true Ruby meditation.
 

Leonid Shevtsov

Systems Architect

Oleksii Dashkevych

Topic: "Project development - preparing hell dish together"

Oleksii Dashkevych
Oleksii Dashkevych

The recipe is averaged, because of many variations. We take some Ruby code and add Rails magic, Postgresql on top. Add Docker for viscosity. Then put this on AWS EBS pan and start frying. It's all roasted until burning deadlines and generously watered with bugs, serves to the customer. They start eating. Eat and whisper: “This is an awesome product!”. At the same time, he forehead is sweating. Kindly offer to fix bugs, but we refuse and put them in JIRA. Do I need to talk about what kind of feedback comes then? Tasks with such recipes, that double estimated.
 

Oleksii Dashkevych

Ruby/JS Developer

Thanks to the sponsors: Ruby Garage, Railsware, Aejis.

Students, who interested in ruby and have a willingness to visit Ruby Meditation, will get a discount 50% with promocode ‘student’. Please send your student ID’s scan to make your registration on the event faster.

If you are a parent of a small baby (0-3 years) on maternity leave and you want to learn more about ruby development you can get a special discount for a ticket with promo code ‘GrowWithYourKid’. Please send your document's scan or take it with you to approve your status and make your registration in the event faster.

If you have any questions or suggestions, don't hesitate to contact us via cell phone: 099 202 6308 or by email: rubymeditation@gmail.com

More details on website.

Buy a ticket