Switching from C# to Elixir – a programmer’s story
Table of content
Sometimes programmers need to change the language they use for software development. Whatever the reason (project requirements or simple curiosity), this process can be difficult, especially if the new language is radically different in terms of syntax and paradigm. Recently I had to make the switch from my favourite language, C#, to a language that was completely new to me, Elixir. Here is what came of it: a C# vs Elixir comparison from someone who made the switch.
Prehistory
After successfully completing the previous project, I was asked whether IÂ wanted to try something new. As you probably guessed, I agreed without hesitation and started to download the code for the Elixir project, on which programmers had already worked for some time.
First impressions
While I was downloading the project source, I decided to read more about Elixir online. To my great surprise, it was an Erlang-based language with no C-like syntax, and it was hard to understand. I decided to postpone the analysis of the language and began to launch the project. For obvious reasons, my much loved Visual Studio environment did not suit working with the Elixir code and I decided to install Atom editor and several plug-ins in order to work with it, which provided a comfortable working setup. The installation of extra software didn’t create any problems in terms of running the project, although it took some time because before that developers worked only under Linux (and I had Windows). After some minor configuration, I launched the web server from the command line (command «mix phoenix.server»), and the project successfully appeared in the browser window.
Then it was time to study the basics of the language. The syntax was difficult to understand, but I had years of experience in software development, Google and my work colleagues to help me. This was my first experience working with a language based on a functional programming paradigm rather than OOP, so I spent a lot of time familiarizing myself with the development life cycle and code structure.
Two months later
After a few weeks, I felt relatively comfortable working with Elixir. I understood why this language was chosen for the project: creating channels to communicate client-side code with the server side and doing broadcasts are easy in Elixir. These features were important because it was a chat project. For C# in such cases developers mostly use SignalR, but in my experience it was slower than a solution built with Elixir and the Phoenix Framework.
As a modern language, Elixir works perfectly with JSON and has its own database library (Ecto) and package manager (Hex).
What I did not like
- No C-like syntax;
- Ecto, the database library for Elixir: despite its power, it is not convenient to use (but other aspects of the language partially compensated for this);
- Elixir lacks the powerful IDE of Visual Studio.
What I liked
- Elixir is designed for easy and flexible work with parallel processes (it is simply difficult to overestimate all the possibilities);
- List and Map data types provide exceptional ease of data management;
- Tuple data type that allows you to easily control the branching of logic based on the call function results;
- Ease of work that is provided by different operators for working with data;
- Highly convenient type specifications with the @spec attribute, which also appear in the generated documentation;
- Code execution speed;
- Functions overloading based on parameter values;
- Pipeline of operations that reduces the amount of code that needs to be written.
Conclusion
Elixir is an extremely powerful language with a wide range of possibilities. However, for programmers who have worked extensively with C#, making the switch can be difficult. Although I don’t regret the time I devoted to learning Elixir and I plan to continue working with it, I’m not planning to leave C# development. I can recommend to anyone who works with C#, Java, Delphi or a similar language that they at least learn the basics of Elixir to experience an alternative code writing approach.
Update (October 2026): GitHub retired the Atom editor on 15 December 2022, so Elixir developers now use editors such as VS Code with an Elixir language server. Since Phoenix 1.3, the development server starts with mix phx.server instead of mix phoenix.server.