Erlang / Erlang Advanced Interview questions
What is an OTP application (.app file) and how does it differ from a single module?
An OTP application is a packaged, independently startable unit of functionality — typically a
whole subsystem (a web server, a connection pool, a whole product component) — described by a
.app file that declares its name, version, modules, registered processes, and dependencies on
other applications.
{application, my_app, [{description, "My application"}, {vsn, "1.0.0"}, {modules, [my_app_sup, my_worker]}, {registered, [my_app_sup]}, {applications, [kernel, stdlib, sasl]}, {mod, {my_app, []}}]}.
Where a module is just a unit of compiled code, an application is a lifecycle-managed unit: it has a defined
start function (the mod entry, typically starting a top-level supervisor), can declare
dependencies that must start first, and can be started, stopped, and monitored as a whole via
application:start/1 and application:stop/1, rather than by manually spawning
individual processes yourself.
More Related questions...