Ruby on Rails vs Yii
When comparing Ruby on Rails vs Yii, the Slant community recommends Ruby on Rails for most people. In the question“What are the best backend web frameworks?” Ruby on Rails is ranked 5th while Yii is ranked 21st. The most important reason people chose Ruby on Rails is:
The sheer scale and massive number of developers using Rails has produced a large number of guides, tutorials, plugins, documentation, videos and anything that can help new and old Rails developers.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Massive community with lots of tutorials and guides
The sheer scale and massive number of developers using Rails has produced a large number of guides, tutorials, plugins, documentation, videos and anything that can help new and old Rails developers.
Pro Many plugins (gems) available
There are many third-party plugins (Ruby gems) available for Rails development. The larger ones and those that have a lot of downloads and users are very well documented and easy to use.
Pro Ruby is a nice readable language
Ruby has a very clean syntax that makes code easier to both read and write than more traditional Object Oriented languages, such as Java. For beginning programmers, this means the focus is on the meaning of the program, where it should be, rather than trying to figure out the meaning of obscure characters.
presidents = ["Ford", "Carter", "Reagan", "Bush1", "Clinton", "Bush2"]
for ss in 0...presidents.length
print ss, ": ", presidents[presidents.length - ss - 1], "\n";
end
Pro Good conventions
MVC is a great starting point, and perfect for APIs. You'll rarely if ever have to wonder "where should I put this code?"
Pro Small projects are very easy and it's possible to finish one in very little time
The large number of documentation, tutorials, videos and guides which help new developers who are just starting with Rails make it seem very easy to create a small and simple application by relying on code generation and components that come out of the box with Rails.
Pro Cool language
Pro Supported on every major cloud or VPS hosting service
Rails is supported on every major Cloud hosting service nowadays. There are also countless tutorials that help developers deploy their Rails apps if there are any problems on the way.
Pro Meta-programming capabilities
Pro Rapid development through code scaffolding
Yii takes care of repetitive tasks through Gii, a web-based scaffolding tool. Gii takes care of code generation and creating code templates for:
- Models
- Controllers
- Forms
- Modules
- Extensions
- CRUD controller actions and views
- There are a lot of scaffolding templates made by community for Gii, that improve generated code functionality by a lot.
- Gii is very easy to extend yourself.
Pro Comes with important security standarts
Since security is a crucial part of any application, Yii comes with great security features out of the box to help developers create a secure and reliable application. These security features contain but are not restricted to:
- Input validation
- Output filtering
- Features against SQL injection
- Cross-site scripting prevention
Pro Highly extensible
Yii is built to be extremely extensible. Virtually every component of the framework can be extended programmatically. For example, if you want to add a unique id to your views, it's very easy to do:
namespace app\components;
class View extends yii\web\View {
public $bodyId;
/* Yii allows you to add magic getter methods by prefacing method names with "get" */
public function getBodyIdAttribute() {
return ($this->bodyId != '') ? 'id="' . $this->bodyId . '"' : '';
}
}
Pro Integrated with a testing framework
Yii makes use of Codeception, a great PHP testing framework that helps developers run their tests. They can be unit, functional or acceptance tests since Codeception supports them all.
Pro Lots of plugins available
Yii has about 2000 addons hosted on Yii's official website. These addons significantly decrease development time and increase the developer's efficiency.
Pro License
Yii is free and open source and is distributed under the BSD License.
Pro Strong community support
Yii has a strong and rather large community behind it. This is proven by the great number of blog posts, tutorials, guides and reviews on the Yii framework as well as the great number of extensions developed for it.
Pro Easy to install
Yii uses Composer to handle it's dependency installation. This is rather easy and not very time consuming, although it should be noted that Composer is very resource-intensive considering what it's job is. But that is not really Yii's fault.
Pro Best framework for CRUD operation
Yii Framework Provides most of features require for crud functionalities like GridView, Listview and DetailView (with jquery search and validation functions) by generating using GII.
Pro Highly extensible without effort
Cons
Con Learning curve seems low at first, but starts becoming steeper
Rails' simplicity is deceptive. It's learning curve is really low at first, and the huge number of tutorials and guides out there for starting with Rails make it even easier. But it starts getting harder and harder as apps become more complicated. If good code conventions and OO design are not followed, then the codebase will be all over the place and it becomes impossible to maintain it.
Con Too much magic
So much behavior is implemented with dynamic behind-the-scenes changes to existing classes that obscure bugs are way too common. Conflicting interactions between multiple plugins that both try to change the same objects are a particularly pernicious example.
Con Too much convention
Con Not a very popular language outside of web development
Con Bad performance
Among the slowest frameworks. If you want to scale, you will have to migrate to another land.
Con Can be hard for beginners
Since Yii requires developers to write code following certain rules, or in other words, it requires developers to follow the "Yii way of doing things" it can be hard for beginners to warm up to it and start using it right away.
Con Not very good at many to many relations
(but there is a good plugin, namely CAdvancedArBehavior extension to do this)