Modern Erlang Teaching from Code Refactoring to Actor System Verification
Abstract
This paper summarizes the author's many years of experience teaching the functional Erlang language in the Master's program "Software Engineering". Original methodological techniques aimed at bridging the cognitive gap in the transition from imperative to functional thinking are presented. In particular, the following are considered in detail: systematic refactoring of imperative code into functional code by eliminating sequential operators ("commas"); the use of recursive Taylor series decomposition as an exercise that changes students' understanding of recursion; a comparison of the declarative style of Erlang with pattern matching and Java code overloaded with object transformations via JInterface; a demonstration of lightweight processes using the example of a TCP server that withstands a huge number of connections on weak hardware, with a brief comparison to modern Java virtual threads; a case study of a simplified model of the PoET consensus protocol; verification of actor models in the Promela language as a logical continuation of the study of actors; and an end-to-end approach to laboratory work, in which students sequentially develop a single distributed system from simple processes to OTP supervision, Java integration, verification, and optional porting to Cloud Haskell. The paper also discusses how the course addresses the challenges posed by generative AI in programming education, emphasising live coding and incremental code construction as a countermeasure to over-reliance on AI-generated code.