Erlang

Author
Ericsson
License
Apache License 2.0
Active since
1986-01-01
Platforms
Linux, FreeBSD, macOS, Windows, Solaris

Introduction to Erlang

Erlang is a concurrent, functional programming language developed by Ericsson in the late 1980s. It was designed to address the challenges of building scalable, fault-tolerant systems, particularly for telecommunications applications. Erlang’s unique features include lightweight process creation and management, robust error handling, and a "let it crash" philosophy for building resilient systems. Its processes communicate via message passing, making it well-suited for distributed systems and real-time applications.

Erlang also features a powerful error-handling mechanism that is central to its design philosophy. Processes are allowed to fail without affecting the entire system. Supervisors monitor these processes and can restart them if necessary, ensuring the system remains operational even in the face of unexpected errors. This approach, combined with Erlang’s hot code swapping capability—which allows code to be updated without stopping the system—contributes to building highly reliable and maintainable systems.

Main usages of Erlang

Erlang's primary usage lies in building highly concurrent and distributed systems, particularly in the telecommunications industry. Originally developed by Ericsson for managing telephone exchanges, Erlang excels at handling large volumes of simultaneous connections with minimal latency. Its lightweight process model and efficient message-passing capabilities make it ideal for applications that require real-time communication and high availability. This has led to its adoption in various telecommunications systems, from mobile networks to VoIP services, where reliable and scalable performance is critical.

Beyond telecommunications, Erlang is widely used in other industries that demand robust, fault-tolerant systems. One notable example is the financial sector, where Erlang powers high-frequency trading platforms, payment gateways, and online banking services. 

Authors of Erlang

The main authors of Erlang are Joe Armstrong, Robert Virding, and Mike Williams, who were part of a research team at Ericsson in the mid-1980s. Joe Armstrong is often regarded as the principal creator of Erlang. He was a computer scientist and engineer who played a pivotal role in designing the language's core concepts and features. Robert Virding is another key figure in the development of Erlang. He contributed significantly to the design and implementation of the language, working alongside Armstrong and Williams to refine its features and improve its performance. Mike Williams, the third co-creator, brought valuable expertise in systems engineering and software development to the Erlang project. He collaborated closely with Armstrong and Virding to ensure that the language met the practical needs of Ericsson's telecommunications infrastructure.

Current developers of Erlang

The current development of Erlang is primarily overseen by the open-source community, with significant contributions from Ericsson, the company where Erlang originated. The Erlang/OTP (Open Telecom Platform) team at Ericsson continues to play a crucial role in maintaining and evolving the language and its associated libraries and tools. This team ensures that Erlang remains robust, performant, and relevant to modern technological needs.

The Erlang Ecosystem Foundation (EEF) is a key organization that fosters collaboration and innovation within open-source community. The EEF organizes working groups focused on various aspects of the language, such as documentation, tooling, and community outreach. These working groups bring together developers, researchers, and enthusiasts to collaborate on projects, share knowledge, and promote best practices. The collective efforts of the EEF and the broader community help to drive the continuous improvement and adoption of Erlang.

Package management systems used in Erlang

Erlang uses several package management systems to manage libraries, dependencies, and applications, with the most prominent being Rebar3. Rebar3 is perhaps the most widely used build tool and package manager in the Erlang ecosystem. It simplifies the process of compiling and managing dependencies, packaging applications, and running tests. Rebar3’s plugin system allows developers to extend its functionality, making it a versatile tool for a wide range of Erlang projects.

Hex is essential package management system for Erlang. Hex provides a repository for sharing and managing packages, offering a centralized platform for the community to publish and discover libraries and tools. The Hex.pm website serves as the primary interface for accessing the repository, where developers can search for packages, read documentation, and explore dependencies. By using Hex, Erlang developers can leverage a vast ecosystem of shared libraries, which facilitates rapid development and encourages code reuse.

Frameworks used in Erlang

Erlang boasts several robust frameworks that facilitate the development of various types of applications, with the most notable being the Open Telecom Platform (OTP), Cowboy, and Phoenix. OTP is the cornerstone framework for building Erlang applications, offering a comprehensive suite of libraries and design principles for creating fault-tolerant, scalable systems. It provides standard components for common tasks such as process supervision, state management, and event handling.

Cowboy is a widely used web server framework in the Erlang ecosystem. Designed for low latency and high concurrency, Cowboy is ideal for building HTTP-based applications and services. It provides a minimalist, efficient server architecture that can handle a large number of simultaneous connections with minimal resource consumption.

Phoenix, while primarily an Elixir framework, is built on top of the Erlang VM and leverages many of Erlang's strengths, such as concurrency and fault tolerance. Phoenix is used for building high-performance web applications and real-time systems. It features a powerful, developer-friendly interface with support for real-time communication through WebSockets, making it ideal for applications like chat systems, live updates, and collaborative platforms.

Static and dynamic analysis tools used in Erlang

In the realm of Erlang programming, both static and dynamic analysis tools play vital roles in ensuring code quality, performance, and reliability. Dialyzer is one of the most prominent static analysis tools used in the Erlang ecosystem. It performs type checking and identifies potential discrepancies in the code without requiring explicit type annotations. By analyzing the code's abstract syntax tree and type information, Dialyzer can detect a wide range of issues, such as type errors, unreachable code, and function specification violations.

On the dynamic analysis front, tools like Concuerror offer valuable insights into runtime behavior. Concuerror is a systematic testing tool designed to identify concurrency errors in Erlang programs. It simulates different execution paths and schedules to uncover race conditions, deadlocks, and other synchronization issues.

Testing tools used in Erlang

One of the most widely used testing frameworks in the Erlang ecosystem is EUnit. EUnit provides a lightweight and easy-to-use environment for writing and executing unit tests. Its integration with the language's syntax allows developers to write concise and expressive test cases directly within the modules being tested. EUnit supports features like test fixtures, assertions, and test case grouping, making it an essential tool for ensuring code correctness at the unit level. The ability to run tests automatically during the build process also enhances continuous integration practices.

For more extensive testing scenarios, Common Test is a comprehensive framework designed for large-scale testing, including system and integration tests. Common Test is part of the OTP suite and offers robust features for writing, executing, and managing complex test suites. It supports test case specification, logging, and reporting, making it suitable for testing distributed systems and applications with intricate interactions.

Another notable tool in the Erlang testing arsenal is PropEr (Property-Based Testing for Erlang). PropEr allows developers to define properties that the system should satisfy, and it automatically generates test cases to check these properties. This approach helps uncover edge cases and unexpected behaviors that might not be evident through traditional example-based testing