nodemodule

nodemodule

Should I choose Elixir for web apps?

Hi, I’m having trouble deciding on whether to use Elixir as my main programming language for building web apps which usually won’t involve much of a need for concurrency.

I would prefer a language that is fun, productive, and that is easy to scale. Elixir seems to check all these boxes better than any other language out there but there’s just one thing that’s holding me back.

I would prefer to use an OOP language in order to further my OOP skills in case I want to land a job or build a team (both easier with OOP).

I’ve been learning Elixir for a few weeks now and it seems to be mostly functional from what I’ve learned but I’ve also read about how it’s (arguably) The Most Object-Oriented Language.

The object oriented nature of Elixir appears to mostly be related to the fact that all Elixir code runs inside of isolated processes which communicate via messages. So it appears to be functional on the dev side of things and OOP on the runtime (correct me if I’m wrong).

Should I be concerned about using a Functional language for most of my work? I read so many developers on Quora saying that OOP is the only way to go for building apps and that Functional programming is awful for real world applications. Perhaps they are confusing impure functional languages like Elixir and Clojure with a pure functional language like Haskell, not sure. Elixir does appear to be a lot more useful for building non-trivial web apps than other functional languages so I’m kind of confused as to what I should do.

The only other languages which are meeting my criteria are TypeScript, Go, and Python. I find Elixir to be more fun than those three but Python is harder to scale than Elixir from what I’ve heard.

What would you do in this situation?

Marked As Solved

Cruz

Cruz

Elixir is a great language for Web Development, and it would be my choice if everything else was equal. That said, it’s not an OO language, and try to use it like that will have you fighting against its strengths.

Have you thought about Ruby (and Rails)? It’s an object-oriented language with a syntax similar to Elixir. Actually, it’s really the other way around but that’s another story.

Ruby doesn’t scale as well as Elixir, but neither does Go or Phyton. A lot of Elixir developers (including its author) were Ruby developers first. The end result is that you can find lots of tutorials and examples that help you with the transition. Also, the new version of Ruby supposed to improve performance and scalability.

I understand Rails makes it a breeze to get a new app up and running. If you learn both languages, you could use Ruby for rapid prototyping, and Elixir for the real system. Or, even use Ruby in production until you really need to bring Elixir into the picture.

Whatever you decide to do, choose a language that you enjoy working with. Good luck

Also Liked

axelson

axelson

Scenic Core Team

I think the users on Quora are most likely talking about languages like Haskell when they are advocating against functional languages for web development. I’d also like to make a (possibly controversial) point about syntax. When someone says “functional programming language”, the languages that probably come up in the listener’s mind are Haskell, Lisp, and Clojure (and possibly Elixir and Erlang of course). Out of those, the syntax to all of them except Elixir is far enough away from the common algol-derived programming languages (e.g. C, Java, Javascript) to feel a serious amount of alien-ness. I think that the basic familiarity of the Elixir syntax (which in part derives from the influence of Ruby) is a major benefit of Elixir over other functional programming languages.

The bottom line is that Elixir is an excellent language for web applications (IMHO) and it is a relatively easy language to pick up for newcomers. You still have to deal with learning about the functional-style and immutability, but you can do that without worrying about type classes and monads (or a completely foreign syntax).

joeerl

joeerl

Creator of Erlang - Fondly Remembered

I always think of web apps as the quintessential concurrent problem.

I suppose their might be web apps that have only one session at a time but
not many.

Each session might process one event at a time, but web apps should manage dozens to millions of parallel sessions - this is where the concurrency comes in.

easco

easco

All in all it depends on your definition of “Object Oriented”

Alan Kay, the person who is credited with coined the term “Object Oriented Programming” described it as a programming model with lots of independent processing units that maintained their own data and could communicate with one another through message passing.

That is the very essence of the Erlang (and by extension, Elixir) programming model. The units, independent in memory and compute, are known as Processes and they can communicate using message passing. This aligns very closely with the model that Alan Kay described. (He has since lamented the term saying if he had to do so again he might call it “Message Oriented” - to increase the emphasis on the separation of the processing units).

“Object Oriented Languages” grew from this concept to describe a language which sets aside a small piece of memory, of “state”, and controls access to that memory through language constructs (Encapsulation). The paradigm grew to include concepts like Inheritance (or prototyping) to allow for code reuse. And Polymorphism to help a developer apply problems solved in the abstract to concrete solutions. The task of learning “Object Oriented Programming” then, is focused on learning and applying these concepts - understanding how to use Encapsulation, Inheritance, and Polymorphism to solve problems. While these are good concepts - they are not fundamental to the “pure” concept that Alan Kay described.

If your goal is to learn those concepts, and how to work with them effectively, so that you can use any “Object Oriented Language” (C++, C#, Java, JavaScript, Objective-C, Swift, etc.) then learning Elixir is probably not the best vehicle to study. In some sense this the “practical” definition of “Object Oriented” in the modern lexicon.

If you are looking for an environment that is much closer to the “pure” concept of “Object Oriented Programming” as described by the person that coined the term then the BEAM and associated languages, including Elixir, may be your best bet.

Where Next?

Popular in Questions Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement