Elixir is a dynamic, functional language designed for building scalable and maintainable applications
A framework is a logical ordering of code that implements a certain idea, as well as a set of tools for easy development of software products. But the main role for the framework, including what it can allow for the developer, is the programming language on which it is written.
The Phoenix Framework is written in elixir. In essence, its language is a "syntactic sugar" for another well-known programming language - erlang. But the most important thing about it is that it's written in the rubyst (Jose Valim) and it is very similar to Ruby on Rails. But some similarities can be found only in the syntax. Everything else - data structures, control blocks is different. The main thing to remember about Elixir is a functional programming language.
Phoenix is an MVC framework. Structuring is very Rails look-alike:
- Web/controllers - here are the controllers;
- Web/models - here are the models;
- Web/views - here are the views.
But if you go to the Web/views, you will not find a single template there. Here begins an interesting feature of phoenix.
Templates are located in another place - Web/templates. It turns out that views are not what we are used to seeing in the Rails. The Phoenix Framework views perform the following functions (at least what I was able to figure out at the moment):
- Rendering templates.
- Additional functions that can be used in templates.
Access to data
There are several options for where to store the data:
- DB mnesia, which is written in erlang and is native to elixir as well;
- Ecto, analogue of Active Record. At the moment, there are adapters for postgresql and mysql. ActiveRecord this library, of course, a little like, but it immediately goes out of the box and is, by itself, a standard solution.
Ecto supports almost all the necessary functionality to work with this data, which we are accustomed to using in the rails:
- Creating a database using a special mix of the task;
- Creating models;
- Generation of migrations;
- CRUD operations, etc.
By default, the compilation of the asserts is done using the node.js from brunch package. So, you will have to install node.js
Another bunch of similar Rails-style features:
- Batch manager;
- A large number of libraries, plug-ins;
- There is an analogue of the rake of the tusks - mix;
- Generate an application using a mix;
- Different scaffold generators;
- There is an analog Gemfile'a - mix.exs.
In general, everything is quite similar to Rails. Commands are only named differently, but semantically they perform the same actions.
Given all the factors, and also that product is still active development, Phoenix Framework will be an excellent alternative to Ruby on Rails. We will be happy to observe the development!