Programming Erlang Book Club

Awww :orange_heart: I miss Joe too :cry:

Iā€™ve been trying to get @rvirding to write one for a few years now - Iā€™m hoping he might change his mind one day :blush:

Have you thought about approaching PragProg? Last time I spoke to @Dave he mentioned they actually translate many of their books to Germanā€¦ so who knows maybe Russia is also on their radar :smiley:

Iā€™d probably read it from the beginning and post an update here once per chapterā€¦ that way you wonā€™t miss anything important Itā€™ll help keep you (and the rest of us!) motivated too :sunglasses:

2 Likes

@rvirding has a lot of stories to tell and something to share by book I hope. He recently gave an interesting interview (via smartlogic podcast).

Super! It is goo for you. I prefer active reading: ā€œreading + coding + thinkingā€ circle. Thus, I better perceive new educational material and find my own approaches and solutions.

2 Likes

Yep I am sure he does - I reckon he could provide a really good opinion/insight on Erlang and how it and the BEAM world has been expanding these past few years :sunglasses:

Awesome, keep us posted!

PS, I noticed youā€™ve put youā€™re interested in the zotonic framework - any particular reason why? (I wonder if we need a dedicated thread to chat about it!)

2 Likes

I think it can be right tool when you would like to develop web app with thick client part (Angular framework). For instance merging Erlang power with Angular. I think it would be useful stack of technologies.

zotonic has all I need at backend part.

If you prefer Erlang for web zotonic is handy tool. Its API actively developed - (zotonic news).

2 Likes

Iā€™ve never heard of #zotonic but Iā€™ve tested #nitrogen !

Already bought the ā€œBuild it with Nitrogenā€ book which his kindaā€¦thick.

3 Likes

Youā€™ll have to start a thread (or Journal) about it @Maartz - I am sure loads of us will be interested in hearing your thoughts about it :nerd_face:

4 Likes

Thatā€™s a terrific idea!

4 Likes

Chapter 1 - Introducing Concurrency

About concurrent and parallel:

  • Distinguish between concurrent and parallel.
  • Computer with only a single-core, it can never run a parallel, but it could be possible to run concurrent, because the computer use time-share between the different tasks and give the parallel illusion to run these tasks.
  • Concurrent program is a program written in a concurrent programming language.
  • Concurrent Programming Language is a language that has explicit constructs for writing concurrent programs. These constructs are an integral part of the language.
  • Parallel Computer is a computer that has several processing units(CPUs or Cores) that run at the same time.

PS: Concurrency has to do with software structure; parallelism has to do with hardware.

Module declaration:

  • Syntax -module(). The first line -module(some_module_name) and should be the same as the filename without the .erl extensions.

  • Module name, itā€™s written with a small letter.

  • Module name is an atom.

Public functions:

  • Syntax -export(). E.g. -export([FunName1/N1, FunName2/N2,]).
  • The square brackets [...] mean ā€œlist ofā€, list of public functions and arity(e.g. /1).

The spawn it is an Erlang most primitive way to create a concurrent process and returns a process identifier(pid).

spawn(ModName, FuncName, [Arg1, Arg2, ..., ArgN])

And with the process identifier, it how to interact with this process.

In Erlang, processes share no memory and can interact only with each other by sending messages. Itā€™s an actor model.

John ! {self(), "Hello World"}

The syntax Pid ! Msg means send the message Msg to the process Pid. The self() argument in the curly brackets identifies the process sending the message.

How to receive messages where are sent?

receive
  {From, Message} ->
    ...
end

Benefits of Concurrency:

  • Improve performance
    • running in concurrent and parallel based on the numbers of CPUs the computer had to improve performance. Itā€™s necessarily to write concurrent programs. The sequential code doesnā€™t fit with a multicore computer to run parallel.
  • Create scalable
    • concurrent programs are made from small independent processes, and help to scale easily to increase the number of processes and add more CPUs.
  • Fault-tolerant
    • it means processes will run independent, and if any error occur in one process cannot accidentally crash another process, its protect against the failure.
  • Clarity, be more reliable
    • use sequential language to write real-world, made things run in parallels more difficult, because it necessarily uses another services and solutions where the language is native support, but Erlang can map the real-world parallelism more clear and easily to understand.
2 Likes

A post was split to a new topic: What do you use to read Erlang docs?

Speaking in analogies I loved this one:

I am not reading the book yet, bought it today in the spring promotion and just skimming its contents.

Until now I have read a bit here and there and I really enjoy how Joe expresses himself :slight_smile:

2 Likes

Joe certainly had a flair for articulating his thoughts very eloquently :orange_heart:

I need to get back to this book soon! Keep posting in here when you get around to it Paulo! :023:

1 Like

Hi there,

Can anyone explain to me why (page 107) mp3_sync:find_sync(Bin, 1) is called with 1 instead of 0?
Calling it with 0 returns nothing, like no frame was found. But calling it with one, seems to me, that we are gonna skip the first frame on purpose.

1 Like

I havenā€™t got as far as there yet Pedro but I think @Rainer did (any thoughts Rainer?)ā€¦

Sorry, no idea :wink:
Really should finish the bookā€¦

1 Like

I thought you finished it :043:

Maybe I confused things with @mafinar :lol:

Itā€™s still on my list, currently halfway through Prag Daveā€™s Elixir courseā€¦

Almost :smiley:

1 Like