{"id":16957831,"url":"https://github.com/awetzel/imt_actor_course_2017","last_synced_at":"2025-04-11T21:52:27.175Z","repository":{"id":73263066,"uuid":"112355246","full_name":"awetzel/imt_actor_course_2017","owner":"awetzel","description":"Live coding for IMT actor oriented programming course 2017","archived":false,"fork":false,"pushed_at":"2017-12-01T10:50:46.000Z","size":1624,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T21:52:24.015Z","etag":null,"topics":["actor-model","course-material","elixir","erlang-otp"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awetzel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-28T15:45:43.000Z","updated_at":"2023-05-14T14:42:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"751ad9fd-0c16-4603-a43d-77495cc40c54","html_url":"https://github.com/awetzel/imt_actor_course_2017","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awetzel%2Fimt_actor_course_2017","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awetzel%2Fimt_actor_course_2017/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awetzel%2Fimt_actor_course_2017/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awetzel%2Fimt_actor_course_2017/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awetzel","download_url":"https://codeload.github.com/awetzel/imt_actor_course_2017/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487733,"owners_count":21112188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actor-model","course-material","elixir","erlang-otp"],"created_at":"2024-10-13T22:20:02.830Z","updated_at":"2025-04-11T21:52:27.166Z","avatar_url":"https://github.com/awetzel.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IMT Atlantique : Elixir live coding for the erlang Actor Model\n\nUnprepared live-coding session to explain concepts during the course.\nFor those interested in a job or intern position, please contact me through :\n`contact@kbrw.fr` or add my associate linkedIn (he is aware of the IMT class\nand your interest) : https://www.linkedin.com/in/jerome-benoliel-6b260316/. No\nneed to be hesitant Jerome can explain you the company, and our big and\ninteresting projects for large industry and retail groups.\n\nPlease :\n- first install elixir to really test the files :\n[http://elixir-lang.github.io/install.html](http://elixir-lang.github.io/install.html).\n- Then read the course slides : [slides in this repo](slides.pdf)\n- Then clone this repo to test : `git clone https://github.com/awetzel/imt_actor_course_2017`\n- Then read this README and each part `course_part_x.exs` files\n- Then and only then (actor principles are more important than the given\n  language) read the Elixir language documentation\n  [http://elixir-lang.github.io/getting-started](http://elixir-lang.github.io/getting-started)\n- If you want to read the same in the erlang language : read\n  [http://learnyousomeerlang.com/content](http://learnyousomeerlang.com/content)\n\nThe use case is to manage a bank account \n- with an initial credit hold of `4` €\n- then credit 5€\n- then credit 2€\n- then debit 3€\n- then show current credit hold : should be 8€\n\nThis course try to \"show\" the principles of the actor model, how it is\napplied in practice in a functional language (Erlang/Elixir).\nThe idea is to build the \"account application\" incrementally :\n- part0: from scratch first : with only a raw functional language\n- part1: then with a micro-process/coroutine system sending message\n- part2: then splitting the generic server logic from the business account logic\n- part3: then with the Erlang/Elixir libraries to create the coroutine\n- part4: then with a supervisor to handle error and restart the coroutine\n- part5: then with the Erlang/Elixir libraries to create the supervisor\n- part6: then with the Erlang-OTP/Elixir-tooling way to create the concept of \"application\" \n\n## Part 0 : Functional programming\n\n```\nelixir course_part_0.exs\n```\n\nstandard functionnal programming : the function transform immutable\ndata : stateless.\n\nProblem : is you want the system to manage the bank account state,\nand not let an external stateful system (database, filesystem) to\nmanage it... You need your software to be a permanent server with\naccount in the server RAM : see `course_part_1`\n\n## Part 1 : Server as a linked processes with message communication\n\n```\nelixir course_part_1.exs\n```\n\nUse `spawn_link`, `receive` and `send` (core low level functions of erlang)\nto create the account server.\n\n## Part 2 : functional split : the same with a generic server\n\n```\nelixir course_part_2.exs\n```\n\nCreate 2 different modules : \n- one to handle a generic server.\n- one other to handle the way you want the server to behave\n\nPut the second module (behaviour module) in the generic server state.\n\n## Part 3 : generic server IS in standard library\n\n```\nelixir course_part_3.exs\n```\n\nShow that a complete and featurefull generic server is in the\nstandard Library : GenServer : to build server nodes in a supervision\ntree.\nShow that it behaves exactly the same as the custom generic server\ndeveloped in part 2.\n\n## Part 4 : error management : let it crash ! but supervised\n\n```\nelixir course_part_4.exs\n```\n\nDevelop a special simple type of server, which role is to start child\nservers, and restart them when they fail.\nIntroduce a bug to make `credit 2` fail, then show that the code is\nstill \"working\" - but the account server came back to it's initial working state.\n\n## Part 5 : supervisor IS in standard library\n\n```\nelixir course_part_5.exs\n```\n\nShow that a complete and featurefull supervisor server is in the\nstandard Library : Supervisor : to build supervisor nodes in a supervision\ntree.\nShow that it behaves pretty much the same as the custom simple\nsupervisor developed in part 4.\n\n## Part 6 : put the supervision tree into an OTP application\n\n```\ncd course_part_6\nmix test\n```\n\nErlang OTP applications includes : a configuration system, a standard\nway to layout your code, a standard way to start a named \"root\nsupervisor\".\nElixir gives you a way to build these applications with nice tooling :\n\n- config/config.exs manamement\n- mix.exs to describe application\n- test/*_test.exs files for unit testing\n\n`mix test` launches the application then unit tests where the test cases has\nbeen put.\n\n`iex -S mix` launches the application then give you an elixir shell connected\nto this application. You can try to call `GenServer.call(:account_server,:get)`\nin this shell to communicate \"in live\" with the account server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawetzel%2Fimt_actor_course_2017","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawetzel%2Fimt_actor_course_2017","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawetzel%2Fimt_actor_course_2017/lists"}