Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a commercial system: Pure Erlang or Erlang/OTP?

I am about to build a system with Erlang (my problem can be solved better with multiple CPUs) and I have skimmed through:

  1. Learn You Some Erlang;
  2. Erlang/OTP in Action
  3. Programming Erlang (Armstrong);
  4. Erlang Programming (Cesarini).

The Erlang/OTP in Action book (2) says: "...writing non-OTP Erlang code is really an advanced topic, and something that should be done only when you really really have to. So perhaps not ever having done it the non-OTP way is a blessing because you will pick up the right habits straight away with regard to things OTP..."

(2) insists that commercial systems should be built with OTP only, whilst (4) gently shows that OTP is not the only way to do this.

Additionally, by reading (4) I have found out that building the knowledge from the very basics of Erlang helps to understand how OTP works (but not in the opposite way).

So, the question is: Should I choose Erlang/OTP to build a commercial system or can it be done with pure Erlang?

like image 724
skanatek Avatar asked Sep 04 '11 09:09

skanatek


People also ask

What does multi Erlang OTP do?

What is OTP? OTP is set of Erlang libraries and design principles providing middle-ware to develop these systems. It includes its own distributed database, applications to interface towards other languages, debugging and release handling tools.


2 Answers

can it be done with pure Erlang?

Yes, it can, subject to the analogue of Greenspun's Tenth Rule: your system will contain an ad hoc, informally-specified, bug-ridden, slow implementation of half of OTP.

like image 140
Alexey Romanov Avatar answered Oct 17 '22 15:10

Alexey Romanov


If you read through the "Learn You Some Erlang" (like you said you have) you'll notice the author spends the Designing a Concurrent Application chapter building something half-useful in "plain Erlang". Then in the next 2 chapters, he basically throws it all away, and uses OTP to achieve the same thing with far less code (add to that the fact that because it's OTP code, it's standard - so other developers with familiarity with OTP will have a much better idea of where to look to understand it!)

The OTP has been developed and refined over a lot of years (initial release 1998 according to Wikipedia) with a large number of developers, and the backing of a large international company (Ericsson), and peer reviewed as it's all open source. I think it'd be a little audacious to assume you could single-handledly build something equally robust and scalable!

So use the OTP. Even for "play" projects, still use the OTP as it can only help you learn to make your "commercial" code better :)

like image 43
Seb Avatar answered Oct 17 '22 15:10

Seb