this repo has no description

style: improvements suggested by Magda

Changed files
+24 -28
content
+24 -28
content/post/elixir-application.md
···
- programming
---
-
By reading this article I assume that you already have written some Elixir code.
-
Even if you haven't (yet) then I think that you can find it interesting as
-
a story how BEAM handles it's applications. But back on topic, when you start
-
your new Elixir project via `mix new my_awesome_project` you will end with
-
something like this in `mix.exs`:
+
When you start your new Elixir project via `mix new my_awesome_project` you will
+
end with something like this in `mix.exs`:
```elixir
defmodule MyAwesomeProject.Mixfile do
···
```
And in most cases you will focus on `deps/0`, sometimes on `config/0`, but the
-
`application/0` you will almost never touch, and if you do you probably only
+
`application/0` you will almost never touch, and if you do, you probably will only
need it to add new entry in `:extra_applications` or sometimes
-
`:included_applications`. Except that this function interns are almost terra
-
incognita, place where you never look unless you are forced to, just like "Read
-
it later" list in Safari. And that is sad, as this is quite powerful and useful
-
piece of code, that hides really useful stuff.
+
`:included_applications`. Except for, that this function interns are terra
+
incognita, a place where you never look unless you are forced to, like "Read
+
it later" list in Safari. This is sad, as it is quite powerful and useful
+
piece of code.
But first things first.
## What `application/0` is for?
-
In Erlang the running system is built from applications. These applications are
-
like processes in your system that are managed by your system supervisor (SysV,
-
systemd, OpenRC, launchd, etc.) and are launched either during VM startup or on
-
direct user request via `Application.start/1-2` and it's family. How to start
-
such application is described in `my_awesome_app.app` file which is commonly
+
In Erlang the running system is built from applications. Those applications are
+
like processes in your system managed by your system supervisor (SysV, systemd,
+
OpenRC, launchd, etc.). They are launched either during VM startup or on
+
direct user request via `Application.start/1-2` and its family. Starting
+
this application is described in `my_awesome_app.app` file which is commonly
generated by the build system from the template. In Rebar3 projects this
template is `src/appname.app.src` and in Elixir it's the return value of the
named `application/0` function. This generated file is known as [Application
-
Resource File][app file] and is just tuple in form of `{:application,
+
Resource File][app file]. It is just tuple in form of `{:application,
:my_awesome_app, opts}` where `opts` is a keyword list of additional properties
(to be exact it's output of the `application/0` function).
-
Two of these optional fields are quite known in the Elixir community:
+
Two of those optional fields are quite known in the Elixir community:
-
- `:mod` which is a tuple `{module(), term()}` which contain the starting point
-
of our application, in most cases it's module that will return main
+
- `:mod` which is a tuple `{module(), term()}` containing the starting point
+
of our application; in most cases this is the module that will return main
supervisor of the application.
-
- `:applications` which contain all applications that are required by our
-
application. Younger Elixir developers possibly never seen that as since 1.5
-
this field is automatically filled by parsing `:deps`, we still can add
-
entries there though via `:extra_applications`.
+
- `:applications` contains all applications required by our application; younger
+
Elixir developers possibly never seen that as since version 1.5 this field
+
is automatically filled by parsing `:deps`, though we still can add entries
+
there via `:extra_applications`
-
There are also few Elixir specific fields, that are sometimes used in bigger
-
projects:
+
There are also few Elixir specific fields, sometimes used in larger projects:
-
- `:extra_applications` - applications that should be included in the release
-
and automatically started before running this application but aren't in the
+
- `:extra_applications` - those should be included in the release
+
and automatically started before running current application; but aren't in the
dependencies list because, for example, are in default distribution, for
example `logger` or `inets`.
-
- `:included_applications` - applications that should be included in the
+
- `:included_applications` - applications which should be included in the
release, but not automatically started on boot.
But wait, there is more!