Synopses & Reviews
This book is an in-depth introduction to Erlang, a programming language ideal for any situation where concurrency, fault tolerance, and fast response is essential. Erlang is gaining widespread adoption with the advent of multi-core processors and their new scalable approach to concurrency. With this guide you'll learn how to write complex concurrent programs in Erlang, regardless of your programming background or experience.
Written by leaders of the international Erlang community -- and based on their training material -- Erlang Programming focuses on the language's syntax and semantics, and explains pattern matching, proper lists, recursion, debugging, networking, and concurrency.
This book helps you:
- Understand the strengths of Erlang and why its designers included specific features
- Learn the concepts behind concurrency and Erlang's way of handling it
- Write efficient Erlang programs while keeping code neat and readable
- Discover how Erlang fills the requirements for distributed systems
- Add simple graphical user interfaces with little effort
- Learn Erlang's tracing mechanisms for debugging concurrent and distributed systems
- Use the built-in Mnesia database and other table storage features
Erlang Programming provides exercises at the end of each chapter and simple examples throughout the book.
This work provides an in-depth explanation of the basics and essentials of the functional programming language Erlang.
This is the most comprehensive book on Erlang, a language that's seen exponential growth due to increasing interest in concurrent programming. Erlang Programming provides an in-depth explanation of the essentials of Erlang, now poised to become a major language alongside C and Java. All readers, regardless of programming background or level, will learn how to write fairly complex concurrent programs with Erlang. The book focuses the language's syntax and semantics, and explains pattern matching, proper lists, recursion, debugging, networking, and concurrency.
A Concurrent Approach to Software Development
About the Author
Francesco Cesarini is the founder and CTO of Erlang Training and Consulting http://www.erlang-consulting.com/. Having used Erlang on a daily basis since 1995, he started his career as an intern at Ericsson's computer science lab, the birth place of Erlang. He spent four years at Ericsson working with flagship Erlang projects, including the R1 release of the OTP middleware. He has taught Erlang/OTP to all parties involved in the software cycle, including developers, support engineers, testers as well as project and technical managers. In 2003, he also started teaching undergraduate students at the IT University of Gothenburg.
Soon after Erlang was released as Open Source, he founded Erlang Training and Consulting. With offices in the UK, Sweden, Poland (and soon the US), they have become the world leaders an Erlang based consulting, contracting, support, training and systems development. Their client base is spread on five continents and ranges from small start-ups to blue chip companies. In his role as CTO, is currently leading the research, development and consulting teams.
He is active in the Erlang community not only through regularly talks, seminars and tutorials at conferences worldwide, but also through his involvement in international research projects. He organises local Erlang user groups and with the help of his colleagues, runs the trapexit.org http://www.trapexit.org/ Erlang community website.
Simon Thompson is Professor of Logic and Computation in the Computing Laboratory of the University of Kent, where he has taught computing at undergraduate and postgraduate levels for the past twenty five years, and where he has been department head for the last six.
His research work has centered on functional programming: program verification, type systems, and most recently development of software tools for functional programming languages. His team has built the HaRe tool for refactoring Haskell programs, and is currently developing Wrangler to do the same for Erlang. His research has been funded by various agencies including EPSRC and the European Framework programme. His training is as a mathematician: he has an MA in Mathematics from Cambridge and a D.Phil. in mathematical logic from Oxford.
He has written three books in his field of interest; Type Theory and Functional Programming published in 1991; Miranda: The Craft of Functional Programming (1995) and Haskell: The Craft of Functional Programming (2nd ed. 1999). These are all published by Addison Wesley.
Table of Contents
Foreword; Preface; Francesco: Why Erlang?; Simon: Why Erlang?; Who Should Read This Book?; How to Read This Book; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Introduction; 1.1 Why Should I Use Erlang?; 1.2 The History of Erlang; 1.3 Erlang's Characteristics; 1.4 Erlang and Multicore; 1.5 Case Studies; 1.6 How Should I Use Erlang?; Chapter 2: Basic Erlang; 2.1 Integers; 2.2 The Erlang Shell; 2.3 Floats; 2.4 Atoms; 2.5 Booleans; 2.6 Tuples; 2.7 Lists; 2.8 Term Comparison; 2.9 Variables; 2.10 Complex Data Structures; 2.11 Pattern Matching; 2.12 Functions; 2.13 Modules; 2.14 Exercises; Chapter 3: Sequential Erlang; 3.1 Conditional Evaluations; 3.2 Guards; 3.3 Built-in Functions; 3.4 Recursion; 3.5 Runtime Errors; 3.6 Handling Errors; 3.7 Library Modules; 3.8 The Debugger; 3.9 Exercises; Chapter 4: Concurrent Programming; 4.1 Creating Processes; 4.2 Message Passing; 4.3 Receiving Messages; 4.4 Registered Processes; 4.5 Timeouts; 4.6 Benchmarking; 4.7 Process Skeletons; 4.8 Tail Recursion and Memory Leaks; 4.9 A Case Study on Concurrency-Oriented Programming; 4.10 Race Conditions, Deadlocks, and Process Starvation; 4.11 The Process Manager; 4.12 Exercises; Chapter 5: Process Design Patterns; 5.1 Client/Server Models; 5.2 A Process Pattern Example; 5.3 Finite State Machines; 5.4 Event Managers and Handlers; 5.5 Exercises; Chapter 6: Process Error Handling; 6.1 Process Links and Exit Signals; 6.2 Robust Systems; 6.3 Exercises; Chapter 7: Records and Macros; 7.1 Records; 7.2 Macros; 7.3 Exercises; Chapter 8: Software Upgrade; 8.1 Upgrading Modules; 8.2 Behind the Scenes; 8.3 Upgrading Processes; 8.4 The .erlang File; 8.5 Exercise; Chapter 9: More Data Types and High-Level Constructs; 9.1 Functional Programming for Real; 9.2 Funs and Higher-Order Functions; 9.3 List Comprehensions; 9.4 Binaries and Serialization; 9.5 References; 9.6 Exercises; Chapter 10: ETS and Dets Tables; 10.1 ETS Tables; 10.2 Dets Tables; 10.3 A Mobile Subscriber Database Example; 10.4 Exercises; Chapter 11: Distributed Programming in Erlang; 11.1 Distributed Systems in Erlang; 11.2 Distributed Computing in Erlang: The Basics; 11.3 The epmd Process; 11.4 Exercises; Chapter 12: OTP Behaviors; 12.1 Introduction to OTP Behaviors; 12.2 Generic Servers; 12.3 Supervisors; 12.4 Applications; 12.5 Release Handling; 12.6 Other Behaviors and Further Reading; 12.7 Exercises; Chapter 13: Introducing Mnesia; 13.1 When to Use Mnesia; 13.2 Configuring Mnesia; 13.3 Transactions; 13.4 Partitioned Networks; 13.5 Further Reading; 13.6 Exercises; Chapter 14: GUI Programming with wxErlang; 14.1 wxWidgets; 14.2 wxErlang: An Erlang Binding for wxWidgets; 14.3 A First Example: MicroBlog; 14.4 The MiniBlog Example; 14.5 Obtaining and Running wxErlang; 14.6 Exercises; Chapter 15: Socket Programming; 15.1 User Datagram Protocol; 15.2 Transmission Control Protocol; 15.3 The inet Module; 15.4 Further Reading; 15.5 Exercises; Chapter 16: Interfacing Erlang with Other Programming Languages; 16.1 An Overview of Interworking; 16.2 Interworking with Java; 16.3 C Nodes; 16.4 Erlang from the Unix Shell: erl_call; 16.5 Port Programs; 16.6 Library Support for Communication; 16.7 Linked-in Drivers and the FFI; 16.8 Exercises; Chapter 17: Trace BIFs, the dbg Tracer, and Match Specifications; 17.1 Introduction; 17.2 The Trace BIFs; 17.3 Tracing Calls with the trace_pattern BIF; 17.4 The dbg Tracer; 17.5 Match Specifications: The fun Syntax; 17.6 Match Specifications: The Nuts and Bolts; 17.7 Further Reading; 17.8 Exercises; Chapter 18: Types and Documentation; 18.1 Types in Erlang; 18.2 TypEr: Success Types and Type Inference; 18.3 Documentation with EDoc; 18.4 Exercises; Chapter 19: EUnit and Test-Driven Development; 19.1 Test-Driven Development; 19.2 EUnit; 19.3 The EUnit Infrastructure; 19.4 Testing State-Based Systems; 19.5 Testing Concurrent Programs in Erlang; 19.6 Exercises; Chapter 20: Style and Efficiency; 20.1 Applications and Modules; 20.2 Processes and Concurrency; 20.3 Stylistic Conventions; 20.4 Coding Strategies; 20.5 Efficiency; 20.6 And Finally...; Using Erlang; Getting Started with Erlang; Tools for Erlang; Where to Learn More; Colophon;