An interview with Michał Ślaski about TDD and testing in Erlang

February 16, 2015 Leave a comment

Hello! After a very veeeeeeeeery long time I had the chance to write again in this blog and for me this is awesome: this year I promise myself to keep this blog up and running (or restart doing it using a supervisor 😛 ).

Getting back to serious stuff, today you may read my interview to Michał Ślaski from Erlang Solutions Kraków. Because of his experience as a developer and trainer I strongly recommend this interview not only to Erlang developers, but also to all the readers interested in TDD, testing and automation.

 Exploring TDD and testing in a functional world


Paolo – Hello Michał, thank you for being here with us! Would you like to introduce yourself to our readers?

Michał –  Hello, thanks for having me. My name is Michał Ślaski and I’m a senior architect at Erlang Solutions, branch manager of the Kraków office, founder of Lambda Academy and co-chair of the Lambda Days conference.

Paolo – Can you tell us how you started working with Erlang and how you discovered Test Driven Development?

Michał – In 2004 my friend and I came up with a proposal for our Master’s Degree project, which was a massively multiplayer on-line game. At the time we were working as C++/DirectX developers at one of the game studios in Kraków. We went to our supervisor, described the proposal, and he suggested we use Erlang on the server side. My friend implemented the front-end in Java3D and I implemented the back-end in Erlang + Mnesia. One year later I graduated and soon after got an interview at Erlang Solutions in London. I met with Francesco Cesarini and presented my Master’s Thesis about prototyping MMOGs with Erlang. It is a mystery to me why I got the job at Erlang Solutions, because the thesis was written in Polish…Francesco helped me publish a presentation at the Erlang User Conference in Stockholm and you can find it here:

Paolo – You give courses about Erlang and TDD. Can you please explain to our readers new to TDD what it is and why we should apply this practice when writing our Erlang code?

Michał – Let me quote our training material here as it answers your question well. Testing is as old as programming itself. It is useful to document behaviours and demonstrate that a program has the required properties. Testing was traditionally done after writing code. Test-Driven Development dictates that tests should be written before the code. Writing tests before the code is not used for testing, but for design. Tests represent the specification to be implemented. Testing before writing code asks the developer to think about interfaces and how to use the code. It ensures that the application is written for testability, and ensures that parts of the application are modular and reusable. Tests are a side effect of test-driven development.

Paolo – Many confuse TDD with the so-called “test first”, but TDD is not only about tests, is also about design. Do you think that in Erlang as well we can apply TDD to explore the system and to build software with a better design?

Michał – Yes, Erlang being a functional language is a good fit for TDD. When we design Erlang systems we need to think not only about unit testing, but also about integration testing, system testing and acceptance testing. If you can have test cases on different levels it helps ensure both the design and the implementation are leaning towards a solution which will be acceptable by the end user or customer. Additionally, test suites provide information about your intentions to other developers who will work on your code later.

Paolo – There are many tools one can use to test Erlang code. Can you give to our readers a brief overview over the most common testing frameworks available and explain for what kind of tests they should be used?

Michał – We typically implement test cases as Erlang functions. For unit testing we use the common_test library, which is part of Erlang/OTP. Some developers would suggest using eunit instead, but we are interested in not only unit testing, but also integration testing. Integration testing means that software modules or units are combined and tested as a group. It allows to test for requirements in performance, reliability and functionality. I believe common_test is better suited for integration testing. Having all unit tests and integration tests implemented with common_test framework makes it easier to execute and maintain.
We teach how to use common_test from unit tests to large scale testing. This covers unit test, testing with state, test groups and suites, how to configure tests, write specifications and do distributed testing. During the training we also cover the principles behind property-based testing. We use QuickCheck Mini to see how to write property-based tests: generators, properties, symbolic representation of tests, etc. This also briefly covers shrinking strategies to find errors. Property-based testing is not applicable to all testing scenarios, but it exceptionally good in protocol testing, finding edge cases and I think TDD with property-based testing can help build even better designs.

Paolo – In OOP, TDD usually goes hand in hand with mocking. I had the chance to use Meck for some of my projects and I really liked it, still many Erlang programmers don’t like mocks. What do you think about mocking in Erlang?

Michał – Mocks are good if you can’t setup the whole system, but would like to execute some unit tests anyway. While I believe it makes sense to write mocks in meck in many situations, I also like the approach of the team at Erlang Solutions, which is responsible for the MongooseIM project. For MongooseIM testing we use common_test and we setup the whole system up front. The same tests suites are run in CI against serveral different server configurations, ensuring MongooseIM behaves according to spec, regardless of the backends used for storage, etc.
The reason why some Erlang programmers don’t use mocks that much is because it is so easy to setup an Erlang/OTP system that it sometimes pays off to test against a real one, not a partially-mocked one.
I believe meck works great when testing library code, especially in tandem with QuickCheck. Here, the boundaries of your library are well-defined, and you can verify (for example) that a particular internal component always receives messages corresponding to the data that’s coming in from outside. Or, alternatively, you can mock some bit of internal state and verify that the whole system satisfies a set of properties when it’s in that particular state.

Paolo – In your opinion, what are the main resources (e.g. online documentation or books) an Erlang developer interested in TDD should take a look at to grasp these concepts in a better way?

Michał – Each Erlang/OTP library has a user’s guide and for me it is often a starting point when I need to learn something new. For example you can find the Common Test User’s Guide at
For property-based testing there are quite a few articles on Erlang Central, see here
The best way to grasp these concepts is to practice them. One can contribute a test case to an open source project or try TDD with his/her next hobby project and see what happens. When you try TDD for the first time there will be a lot of questions arising and then you are sort of forced to find an answer to your questions – that is the best way to understand the concept. Ideally you would have someone experienced sitting next to you and answering your questions, but the social networks at Erlang Central or IRC channels are also good fellows.

Paolo – There aren’t many books or blog posts about best practices or real world examples of TDD and testing in Erlang. (one of my favourite is Gianfranco Alongi’s blog). Why do you think there are so few information about the topic available to the masses?

Michał – I’m not sure how to answer this question. Instead, let’s improve the situation 🙂


An interview with Alvaro Videla (@old_sound ) about RabbitMQ and Erlang

June 4, 2014 Leave a comment

Hello everybody! The Erlang User Conference in Stockholm is approaching!!! Today you may read in this blog post my interview to one of the speakers: Alvaro Videla. Alvaro is in the RabbitMQ team and one of the authors of “RabbitMQ in action“! I hope you will enjoy this interview!

Down the RabbitMQ hole!


Paolo – Hello Alvaro, thank you for being here! Please introduce yourself to our readers.

Alvaro – I’m a developer based in Switzerland working for the RabbitMQ team. Before coming to Switzerland I used to work in Shanghai building a quite popular German website. I very much like Erlang and every other language that doesn’t show an “Algol like” syntax and mindset, like Factor for example. I write open source here: and write about several ideas here:

Paolo – How did you end up using Erlang? When you started learning Erlang, what was the thing that intrigued you most about the language?

Alvaro – I started learning/using Erlang when I was in China, probably in 2009. The feature that made me learn Erlang, was fault tolerance. The idea that a supervisor could restart a child and the app will keep running. The other idea that I find quite interesting and that place Erlang over other programming languages is pattern matching.

Paolo – I know that you are acknowledged not only as a RabbitMQ advocate, but also as a proficient PHP developer. Can you describe your feelings in switching from a object oriented programming language to a functional one?

Alvaro – For me learning Functional Programming showed that OOP is far from being the only way one could do things. Also it showed me how using the right tool for the job, in this case, the right paradigm, one could achieve solutions to problems than in popular OOP languages would be too complex. Another interesting feature from FP languages in general are the more advanced and high level flow control operators/techniques that facilitate programming.

Paolo – Can you give in a few words a brief description of what RabbitMQ is and what kind of problems it solves efficiently?

Alvaro – RabbitMQ is a Queueing and Messaging Server. It can be used to decouple applications, to integrate different apps, written for various platforms and languages, and that offers a queueing system that can help applications scale, whether by using a basic produce/consume model, or to offer reliability by handling offline consumers, among other things.

Paolo – Many developer know RabbitMQ because it allows the achievement of decoupling, high scalability and reliability. Do you think these features are somehow related to the fact that it is implemented using Erlang and OTP?

Alvaro – I think high scalability and reliability are thing facilitated by Erlang when it comes to operating RabbitMQ. For clients using RabbitMQ, it really does not matter that RabbitMQ is written in Erlang or not.

Paolo – You are one of the authors of RabbitMQ in Action by Manning. Would you like to tell to the folks out there some words about your book?

Alvaro – It’s a book that tries to teach you the basic concepts of Messaging and AMQP so people reading the book can go and implement applications that use messaging by themselves. We tried to achieve a friendly and relaxed style as well, trying to write the book we wished it was there when we started learning about RabbitMQ.

Paolo – At the Erlang User Conference 2014 you will give the following talk: “Building a Distributed Data Ingestion System with RabbitMQ Tutorial: Scaling Applications With RabbitMQ”. Can you give to our readers a brief summary of the talk?

Alvaro – The talk will teach how by using some advanced but very simple features from RabbitMQ, we can achieve reliable cross-datacenter replication with what RabbitMQ provides out of the box.

The tutorial will be an intro to RabbitMQ and messaging.

Paolo – How should follow the talk and why? What levels of Erlang and RabbitMQ are needed in order to fully understand your talk?

Alvaro – A basic understanding of Erlang would be enough, mostly just to read the code examples. Still, not knowing Erlang won’t prevent you from understanding the main ideas presented on the talk.

Paolo – Given your experience on the field, what are the most common mistakes teams do when working with implementations based on Advanced Message Queuing Protocol and especially on RabbitMQ?

Alvaro – The most common mistake is when people try to use RabbitMQ or any message system as a database. The converse can be said about databases being used as messaging systems.

Paolo – What are the next frontiers in the use of RabbitMQ? What are the new fields we can explore and challenges we can win using this technology?

Alvaro – It would be quite interesting to build decentralised architectures with RabbitMQ, like what the New York Times is doing with RabbitMQ and the Shovel plugin, and also learn more about how RabbitMQ can help on the Internet of Things space, by using MQTT.

Talking about Erlang, Riak and Vector Clocks with Christopher Meiklejohn (@cmeik)

February 16, 2014 1 comment

Hello! Today you may read here my interview to Christopher Meiklejohn, one of the speakers at the upcoming Erlang Factory in San Francisco. Christopher is working on Riak at Basho Technologies.

Erlang, Vector Clocks and Riak!


Paolo – Hello Chris! It’s great to have another Basho Erlanger here! Can you introduce yourself please?

Christopher – It’s great to be here! My name is Christopher Meiklejohn, and I’m currently a software engineer at Basho Technologies, Inc., where I work on our distributed datastore, Riak. In addition to that, I’m also a graduate student at Brown University, in Providence, RI, where I study distributed computing.

Paolo – Before joining Basho you were working in a different company (i.e., Swipely) where you dealt with Ruby code. Did you already know Erlang when you started at Basho? How would you describe the switch between these two languages?

Christopher – During the time I was at Swipely they had Riak deployed in production, which was what initially got me interested in Basho, Riak, in particular, Erlang. When I joined Basho, I knew very little Erlang and spent my first few weeks at the company learning it.

That said, I love Erlang as a language and as platform to build application on. I wouldn’t necessarily say that the change from Ruby to Erlang was anything that was unexpected, specifically because I already had functional programming experience using languages like Scheme and Haskell.

Paolo – Rubyists tend to be addicted to TDD. Were you able to maintain such a good practice also when coding Erlang?

Christopher – Well, I’ll start with a disclaimer. I was primarily responsible for the introduction of behavior driven development at Swipely for feature development, in addition to promoting pair programming within the development team.

That said, testing and verification of software is a very interesting topic to me.

While I believe that all software should be properly tested, I’ve never been particularly dogmatic about when in the cycle of development testing is performed: whether it’s done during development to guide the design of the software or whether it’s done afterwards to validate the authored components. I do, however, have one major exception to this rule: when attempting to reproduce a customer issue and validate a fix for the issue.

This is purely a pragmatic decision that’s come from working on large scale distributed systems: testing and verification of distributed systems is extremely hard given the number of cooperating components involved in completing a task.

At Basho, we take two major approaches to testing Riak: integration testing using a open source test harness we’ve developed that allow us to validate high level operations of the system, and QuickCheck for randomized testing of smaller pieces of functionality.

Paolo – At the upcoming Erlang Factory in San Francisco you will give the following talk: “Verified Vector Clocks: An Experience Report”. Can you introduce in a few words the arguments you will treat during the talk?

Christopher – My talk is going to look at an alternative way of asserting correct operation of software components, commonly known as formal verification.

The talk will specifically focus on modeling vector clocks for use in the Riak datastore using an interactive theorem prover called Coq. This allows us to assert certain mathematical properties about our implementation, and perform extraction of the component into Erlang codewhich we can directly use in our system.

Paolo – Who should be interested in following your talk and why?

Christopher – Given the topics involved, I’m planning on keeping the talk pretty high level and will touch a variety of topics: the theorem prover Coq, which implements a dependently-typed functional programming language, the basics of using Core Erlang, a de-sugared subset of the Erlang programming language, and how we put all of the pieces together.

Paolo – Lamport’s vector clocks are well known by people working in fields connected to distributed systems. Can you explain briefly what they are and in what fields they can be used?

Christopher – Vector clocks provide a model for reasoning about events in a distributed system. It’s a bit involved for this interview to get into the specifics about how they work and when they should be used, so I’ll refer to you two excellent articles written by Bryan Fink and Justin Sheehy of Basho.

“Why Vector Clocks Are Easy”

“Why Vector Clocks Are Hard”

Paolo – About the application vvclocks, are you planning to keep the development on? If so how can people contribute?

Christopher – At this point, the project mainly serves as a playground for exploring how we might begin to approach building verifiable software components in Erlang. What has been done so far is available on GitHub, it’s actively being worked on by myself as my time allows, and if you’re interested in helping to explore this further, feel free to reach out to me via e-mail or on Twitter.

Talking about Erlang with Fernando Benavides

February 3, 2014 Leave a comment

Hello! Probably most of you already know the Erlang Factory Light will be held in San Francisco between 3 and 15 March . Among the 50 talks there will be the one held by Ferndando Benavides. Fernando is an Erlang developer from Argentina, currently working at Inaka as director of engineering. Let’s talk with him about Erlang, Inaka and his talk!

Let’s get started!

Paolo – Hello Fernando, thanks for making yourself available for the interview. Would you like to introduce yourself?

Fernando – Hi! Well… I’m an software developer from Argentina. I started programming when I was 10 using QBasic and “improving” gorillas.bas :P. From that point on I studied computing and programming my whole life until I graduated as a computer scientist in the Universidad de Buenos Aires, a couple of years ago. I started working when I was 18, coding in Visual Basic, then moved to .Net after several years. But thanks to my career path in the university I discovered functional programming (Haskell) and fell in love with it, so when I had a chance to actually work doing functional programming (this time in Erlang) I had no doubt I wanted to do so. That was 5 or 6 years ago. And I’ve been doing Erlang development ever since. About an year ago, I’ve been assigned as the Director of Engineering at Inaka. That basically means I’m now in charge of the architecture and design of all Inaka’s systems, whether they’re written in Erlang or not.

Paolo – You are currently working as Director of Engineering at Inaka: would you like to give some insight about Inaka?

Fernando – Well… you should check out our website: 🙂
Inaka was found on September 2008 by Chad DePue, and I’m glad to say I was there. We were just 5 people working in a small apartment in Buenos Aires and we had just one project. Now we are a much much bigger team, with people working from different countries, in a big number of projects. But the idea behind our work was always the same: Our clients have beautiful startup ideas… and we do our best to turn them into real systems or applications that they can quickly launch and grow. Most of our products are iOS/Android applications with Erlang and/or Ruby servers on their backend. And most of the products we build have some important large-scale and/or high-concurrency requirements.

Paolo – How does Erlang fit in Inaka’s ecosystem? Why did you start using it?

Fernando – Erlang is our #1 language choice (at least since I’m Director of Engineering :P) for server developing.
We started using it since our very first system. That was a second screen system that provided additional content to display on iOS devices when a particular show was on air on TV. It also let users interact, by writing comments and “kinda” chatting. When designing the system, Chad detected the high concurrency and real-time demands that it had: during the hour the show was on air, lots of users would be connected and interacting and they devices had to be showing the right content in the right moment, not later. Erlang was the right choice for a language to write the servers with. BTW, making that system scale was not an easy task, even when written in Erlang, and that was what my last talk in an Erlang Factory was about 😉

Paolo – At Inaka you have been using Erlang for many years. How would answer to this question? Do you confirm what Bob Ippolito wrote in his answer?

Fernando –  Being a Haskell fan myself, I can tell you I nodded in approval on almost every paragraph he wrote, including the last one ;). So, yes… I confirm what he wrote.
As him, I’m also not aware of another platform that has the right combination of features, performance and maturity to make it possible to build the kind of systems that we build at Inaka. Maybe instead of binary matching syntax, I would mention that one of the main parts of most of our servers is a RESTful API that usually has a SSE component that keeps clients up to date with server pushes. How easy, clean and nice it is to write the code to implement that and make it scale in Erlang is hardly comparable to any other language that I know.

Paolo – In your talk at Erlang Factory Lite you will talk about: “Lucene Server: From Erlang to Java and Back Again”. Do you mind giving us some information about the talk?

Fernando – It will be a similar talk as the one I gave on the last ErlangDC. I’ll talk about a system that I’ve built and it’s now open-source, thanks to TigerText: Lucene Server. It’s an Erlang application that lets its users index, delete and query documents (i.e. proplists, in Erlang terms) using Lucene (which is written in Java). The key point here is that no Java knowledge is required for lucene_server users. All Java compilation, running, handling, stopping, etc. is managed internally by the lucene_server application. I’ll tell you how it’s works and how it’s implemented, and I’ll show you some lessons I learned along the way 😉

Paolo – Who should attend your talk and why?

Fernando – My talk is mostly aimed at Erlang developers that once faced JInterface, got scared and then decided to implement their solution in a different way… I was there, too 😉
Also, those devs that need a great indexing solution like Lucene as part of their systems. They will learn about an open-source application that may be exactly what they need.

Paolo – About Erlang and Java, I really liked your blog post on Inaka’s blog. Can you talk briefly about it?

Fernando – I wrote that post before lucene_server was open sourced and, in the same way that I couldn’t talk about the second screen system I described before but nevertheless I wrote a blog post about its story, I wrote this post (or rather this still unfinished series of posts) about lucene_server’s history.

You worked both with JVM and Erlang VM which are widely acknowledged among developers. Talking about performances and tuning, can you give some pros and cons for both?

I never feel comfortable talking about performances and tuning of VMs. I’m not sure I know enough about Erlang VM to talk about that and I’m positive I know nothing about JVM in this respect. Also, comparing the performance of two virtual machines for two completely different languages is tricky to say the least. It’s not like you can run the same code in both of them and see which one behaves better 😉

Paolo – Last question: lately I have seen a lot of tweets complaining about the Erlang syntax. What do you think about this?

Fernando – I’m not much of twitter user myself, but the same topic raises up every now and again at Inaka’s office. Personally, I have worked/coded in a big number of languages including Basic for Commodore (where you had to write the line-number before each line yourself), Javascript, Haskell, Prolog, etc. and I never had any problem with any language syntax. Ok, I know, I’m not talking about brainfuck or shakespeare or any other esoteric language. But, besides those funny examples, I always saw syntax as just something to learn and get used to. I would never quit learning or using a language just because I don’t like the way it’s code is written. That said, I love Smalltalk syntax and how easy it is to read and write Smalltalk code. And I also like Haskell syntax even when it’s so hard to just read a Haskell program when there are monads around. About Erlang syntax, well it’s not that I love it specially, but I never had an issue with it… ¯\_(ツ)_/¯

Paolo – BTW, I am really puzzled about your name: is it Brujo or Fernando?

Fernando – Well… According to my passport, I’m Fernando Benavides Rodriguez. According to anyone else, I’m just “Brujo” :). In other words, “Brujo” is my nickname, it means something close to “sorcerer” or “shaman” in spanish. The nickname was taken from my favorite character in a series of books I love (La Saga de Los Confines, by Liliana Bodoc) and it stuck with me forever. So, just call me Brujo 🙂

Talking about Elixir and the Erlang VM with José Valim

November 30, 2013 Leave a comment

Hello! CodeMesh 2013 is coming and if you are planning to attend this wonderful event you may have the chance of learning more about Elixir from his creator: José Valim. For those of you who will not be able to be in London the 4th, 5th  December I prepared this interview to José. In the interview we talked about Elixir, its roots in the Erlang VM and the future of this newborn language. Enjoy! 😀

Elixir of life

Paolo – Hello José! It is a great thing to have you here in my blog for an interview. Would you like to introduce yourself in few words?
José – Hello Paolo! In few words, I am co-founder of Plataformatec, a consultancy based in Brazil and the creator of the Elixir programming language!
Paolo – José, you were previously known for you work in the Ruby on Rails Core Team. What was you experience with Erlang before writing Elixir? Why did you decide to write a new language and for what reason did
you choose the Erlang VM?
José – Before writing Elixir, I already had a good knowledge of the Erlang language and the Erlang VM. At the time, I was unhappy with the tools available to solve the concurrency issues in the Ruby ecosystem and the fantastic Seven Languages in Seven Weeks book helped me lay out the options out there. After reading the book, it solidified my opinion that the Erlang VM is one of the best environments to build and deploy robust concurrent software (my goals at the time).
After digging deeper into the Erlang language, I missed some of the flexibility and constructs that I find important in my toolbox, like meta-programming and polymorphism, as well as a better unicode support and other things, which led me to write Elixir.
Paolo – Elixir is based on the Erlang VM but has a syntax close to Ruby: for what reasons an Erlang developer should learn Elixir? What about Ruby developers?
José – Erlang developers know quite well syntax is often one of the first things that come up when discussing a new language. So while the syntax is similar to Ruby, the semantics are mostly from the Erlang VM. So leaving syntax out, an Erlang developer would find appeal in Elixir if he/she misses the same tools I missed when I started it. For example, we provide a macro system which gives developers the ability to meta-program, i.e. to write code that generates code. Another example is polymorphism, where Elixir provides something called protocols, heavily inspired by Clojure’s protocols, which allows developers to provide well-defined extension points in their libraries.
It is hard to explain such features in broad terms, so let me try to give some examples. Erlang developers are familiar with typespecs. In Elixir, we also have typespecs, except they were all implemented in Elixir itself using macros. There is no language extension because macros give users the ability to access and modify existing code. Another good example of macros is how we embed the unicode database into Elixir, at compilation time, which allows us to speed up many Elixir string operations by avoiding work at runtime.
Elixir also aims to provide a tidier standard library. For example, we provide an Enum module that is able to enumerate (i.e. map, fold, take, etc) all the collections in the language and such module is powered by protocols: Elixir knows how to enumerate your collection as long as you implement a protocol. After all, it is preferable to have a small set of functions that work well with a handful of collections than a completely different set of APIs for each data structure.
For any other developer, be a Ruby, Java, Python or Javascript programmer, learning Elixir means learning the semantics in the Erlang VM and all the amazing tooling existent for building robust, concurrent, fault-tolerant applications and that is more than enough reason for giving it a go.
Paolo – I have read the enthusiastic blog post “A week with Elixir” by Joe Armstrong. I also know that you are giving several talks around the world about Elixir. What kind of feedback do you receive from the Erlang community?
José – In general the feedback is quite good as the community agrees that the power lies on the Erlang VM and, while Elixir offers a slightly different perspective on it, the more developers using the Erlang VM translates into more knowledge, tools and enthusiasm in the ecosystem altogether.
Paolo – Some of our readers maybe want to contribute to some open source project based on Elixir. Do you want to suggest some projects in particular?
José – The community is still very young so the best suggestion right now is to try to solve a problem and see if there are any tools available and, if not, wright your own! We see some efforts converging though, we already have an “official” monad library, another for talking to postgresql, other to work with data and time, and so on.
Also I want to point out that Elixir is mostly written in Elixir, with the exception of a dozen of macros that we call “special forms”. This makes it very easy to contribute to Elixir itself, once you start learning the language!
Paolo – The 4th and 5th December you will give a talk at Code Mesh 2013. The talk title is: “Ecto: A language integrated query for Elixir”. Can you give to our readers some insights on you talk?
José – Besides the keynote about programming and Elixir, which I will give with Dave Thomas, I will also talk about Ecto.
In a nutshell, Ecto is a language integrated query to talk to relational databases in Elixir, heavily inspired by LINQ (from .NET). The goal of the talk is to introduce Ecto but, more importantly, also show how features provided by Elixir made the implementation of Ecto in the first place!
Paolo – Looking at the future: what should we expect from the new Elixir releases? In which part of the language will you focus the most?
José – In the short-term, we want to integrate with maps (when Erlang R17 comes out) while we work on a solid logging system to be shipped with the language, that builds on Erlang’s logger. Once that is done, we will release Elixir v1.0.
After Elixir v1.0 is out, we have many options to explore and the interesting thing is that we can explore those outside of the language, because macros give us all support we need. Some plans include providing better comprehensions, improving how we work with nested data structures, support to discriminated unions and more!

Talking about Erlang and Agile Methodologies with Gianfranco Alongi

October 21, 2013 Leave a comment

Hello! Today in this blog you can read my interview to Gianfranco Alongi. Gianfranco is a Senior Software Developer at Ericsson with a strong passion for Erlang, Extreme Programming and Agile Methodologies. I am sure you will enjoy his answers 😀

Erlang, TDD, XP, agile….what else?

Paolo – Hi Gianfranco! It’s a pleasure to have you here today. Can you please introduce yourself to our readers?

Gianfranco – Hi, and thank you! I’m honored to be interesting enough to be mentioned in this blog!
My name is obviously Gianfranco, but my full name is Gianfranco Franco Alongi, the middle name is a relic from the laws regulating concatenation of first names.
I have always felt a deep satisfaction in programming and problem solving involving abstraction through rule sets. I get a feeling of emotional purification when crystalizing a concept, or even a crude feeling of something into a formalization that can be analyzed, executed and mechanized. I can only imagine this is what Vulcan[1] ‘enlightenment’ feels like, when you see a clear path through reality, a sense of very vivid focus and understanding.

I am a Senior Software Developer at Ericsson, doing Erlang and other things, such as lecturing about good Design, Clean Code, TDD and Software Craftsmanship. I get paid to do Erlang, but my cognitive breath mint equivalent is APL, Haskell or CLISP. I have lately got totally hooked on APL, and will travel to Florida the 19th to hold a workshop on TDD and present a Testing Library[2] I developed for the APL community.

To me, programming is a hobby, and I get paid to do this hobby during the day, but do my hobby without pay during the rest of the day (don’t tell my managers: but I would probably do the same thing even if I was not paid ; ))

My mind is to intellectual challenges what a husky is to physical exercise, I need it every day, and a lot of it. If I go without it for too long, I get restless and depressed.

Paolo – Would you like to tell us something more about your personal experience with programming and especially with Erlang? How did you start using it?

Gianfranco – Ah, yes. I got into contact with programming through my father. He worked as an IBM mainframe developer for many years, and we always had lots of books and stuff at home. He had a whole shelf with RPG, Assembly and instruction sets for different architectures. However, none of this was interesting to me. I got going with Quick Basic in 7th grade (I must have been 12 at the time), and wrote some useless stuff like text adventures.

From there, it moved on quite steadily, and in high school (Gymnasiet in swedish) – I had a math teacher who handed me a (gasp!) Pirated Copy of a Redhat enterprise edition. This is where I got serious with C++ for a while. I was now 15 and got a lot of help by this man. I knew that this was what I wanted to do! This felt so right. The programming.

When I later moved to Gothenburg, and studied at Chalmers, I met John Hughes, a very influential man with a keen sense for Functional Programming.
During this time I did a lot of Haskell, it was the main weapon of choice, but in one of John’s courses, we just happened to glance at Erlang and this was enough to catch my interest. I got hooked. And since that day, I’ve been doing it. For some reason, I have never felt that C, C++, Java, or C# has the right ‘feel’.
My cognitive mind has chemistry issues when it comes to those languages, but Haskell, Erlang, CLISP and now APL has been like hanging out with a really good friend. It’s a silent understanding between two friends. It is beautiful.

Leaving Chalmers, I was contacted by Ulf Wiger, and I started working for Erlang Solutions.

Paolo – You had the opportunity of being an Erlang developer in two of the biggest Erlang companies out there: Ericsson and ESL. Can you tell us something more about these two experiences?

Gianfranco – Erlang Solutions is a company with a lot of young talents and a lot of opportunities. You can be sent to Mexico, work with people in the USA, and basically see and do anything, as long as you are willing and able. This was a fun and interesting time, moving to London, leaving Sweden and meeting a lot of new friends. As ESL is mainly a contractor company, you get to work on a lot of different projects, this suited me well, and I loved the high pace. It is an environment where the fast movers and strong fighters can grow quickly, accumulating a strong CV with various technologies.

Ericsson is different from this. It is a corporation, thus,  by default, the pace is lower. Much lower. Ericsson does not attract the passionate developers as well as smaller companies like ESL, and there can be a lot of bureaucracy which prevents the fast movements I was used to. However, Ericsson, being a large corporation, has the money  to support and lift the passionate developers on its strong shoulders, and it can be a very different experience based on different managers. All my managers have been great, and value skill and craftsmanship, giving me the opportunity to act with a lot of freedom – and the accompanying responsibility to go with that freedom.

At the end of the day, it is us, the developers who form the culture we live in, the wrong people can make gold turn to lead even in the best places. If we are willing to change ourselves, we can do anything.

Paolo – In your current position at Ericsson you are also teaching Extreme Programming values and principles. Even though I know Ericsson has a solid story on agile methodologies I have to ask: is it difficult sometimes to advocate agile principles in such a big company?

Gianfranco – Yes.

Like most large corporations, the ‘Agile Transformation’ is first hand an adoption of ceremonies and not really about the governing values and principles. What should be a common understanding and discussion on values and goals, becomes quickly an act of doing the right things, instead of reflecting on why we do things, and how we do them. My belief is that part to blame for this,  is that Agile is being pushed down from the top, and not being something perceived necessary from the largest part of the organization.

I have yet to meet a developer who is positive about Agile. Few have even heard the term Agile Software Development, and even fewer know about XP. We have a large legacy of Telecom experts, and a dwindling few who are Software Developer Experts. As a result of this, few care how things are done, the majority cares for doing things. And, as you know – the price is paid in sweat, bugs, and blood.

The only way to go fast – is to go clean.

Paolo – In the company where I work, Kent Beck’s book on XP is a must-read  book. Beck states that XP helps developers to deliver better software. What do you think about this sentence?

Gianfranco – I agree.

My only remark is that we must never get stuck in one particular school of thought and shall always explore, educate ourselves and invest in our own career as Software Craftsmen. It is not only  a matter of professionalism, but also a matter of survival. By learning new practices and principles from others, if I can reduce my own cognitive load by using a certain technique[3], and therefore spend more time optimizing for maintainability, it is definitely worth the time and effort to learn.

We all leave a legacy behind us, daily.  If I take an extra hour refactoring my code, after passing all the tests and removing
duplication, it may seem like a large cost, but I know that in my unit, with ~200 developers, if I can reduce the time they spend
reading to comprehend it, there is an economy of scale that makes a good case to optimize for maintainability.

To me, XP is a lot about being a good developer with great practices[4], delivering value and being a pleasant man to work with.
The ‘team’ is very important to me, and I believe the best place to work at, is a place where you feel that you go to work with friends, the kind of people you feel would have your back in a Zombie Apocalypse.

Paolo – Another great book by Beck is Test Driven Development By Example. When I read it I really appreciated the part about eliminating the fear using tests. I know you also appreciate this approach, so how would you encourage a developer to start adopting TDD?

Gianfranco – My best tip to learn anything, is to do it during dedicated practice time. Children are fearless learners, they just do, and fail, and do, and fail. Eventually the feedback mechanisms allow us to tune ourselves, and we start succeeding more than failing.

With dedicated practice time, there is absolutely no pressure to succeed, and so, we loose the fear. Fear is the mind killer that puts the mind into an accelerated mode of anger and self pity, instead of the relaxed state necessary to tune properly on the feedback.

 – Do a Code Dojo together with team mates
 – or just book a 2 hour slot alone, at home.

Start by reading about TDD, and then choose a small practice problem, maybe a Kata[5][6] or any other problem you can think of.
The main point is that it is not the problem in itself that is important, it is the practice.

It does not matter that you do not finish anything, is it the journey, and the act of noticing what you notice, that is the important bit.

Once you feel that you have a grip on TDD, then you can apply it on production code.
Because if you have to get stuck, if you have to fail, do it in a safe place, don’t do it during work time.

Paolo – I appreciated very much your blog posts about TDD and Erlang. What are in your opinion the best tools an Erlang developer can use for testing his code? EUnit? Common Tests? Something else?

Gianfranco – I do not have a favorite, to me they are tools which apply well for their respective tasks. The only thing I am very careful about, is the feedback time the tool gives me.

I always use EUnit for Unit Testing.

Then I can use Common Test for Function Testing, but if the specific test case would take 20 minutes to get into place properly with CT, and I can do the same thing in 2 minutes using a bash script with netcat, then I go for the speed choice.

In my unit, we have a  different tool which is based on top of CT, but with it’s own syntax. Mostly I try to avoid it, and the straw that broke the camels back, was when I could test a certain use-case by manual configuration and some bash’ing, in just under 10 minutes, and we had tried achieving the same thing using this tool, for 3 days.

Paolo – What do you think about continuous integration and continuous development? Do you recommend any specific framework or service for Erlang code? 

Gianfranco – I think they are necessary practices that give a lot of value and make life easier. By exposing complexity early, and dealing with stress up front, we remove the pressure of doing integration and delivery later in the project.

No recommendation, sorry.

It is the doing of the work that exposes what needs to be done.

Paolo – Last question: emacs, vim or what else? 😀 

Gianfranco – Emacs, and vim when there is no emacs. I use this together with Tmux, and the no-mouse environment I use, enables a very high bandwith between my brain and the computer.

[1] Star Trek Reference
[3] such as TDD
[4] Yes, I did it, I stole the quote ; )

Four years of Erlang blogging!

September 12, 2013 Leave a comment

Hello! September 2013 has come and here I am once more to give you some information about another year of Erlang blogging 😀

Would you like to know something more about what I posted in this blog during 2013? Are you sure? Well, just keep on reading!

I can’t recall every single post I wrote this year, so I have to ad lib during this summary.

Since I noticed that you readers appreciate my interviews to famous Erlangers I kept on writing this kind of posts. I think nobody will be offended if I say that two of my favourite interviews this year were the one to Kenji Rikitake and the one to Steve Vinoski. I obviously want to thank all the others Erlangers that accepted my request for an interview and I hope that you had the chance to read at least some of their inspiring ideas and thoughts!

As promised during 2012 I tried to transform this blog into a space where Erlangers can get useful information about Erlang projects, events and books. In this sense I had the opportunity to write my impressions about the bookLearn You Some Erlang(thanks No Starch Press) and my thoughts about “Erlang by example with Cesarini and Thompson” (thanks to O’Reilly).

I also promoted Erlang Conferences all around the world and I hope that many of you attended the  EUC2013 or the recent Erlang Camp in Amsterdam (or the one that will be held soon in Nashville!).

Some posts were as usually  more technical, in this sense I enjoyed very much writing the one about TDD and kata, the one about the cost in terms of time you have in your supervisor when spawning multiple gen_servers. I also liked sharing with you the most interesting Erlang articles I read online lately in my recent post.

That all! As always I want to thank all you guys for your support and patience. Hope you will keep on following my blog during these last months of 2013 and during 2014! Have a nice Erlang year!

Categories: English, Erlang Tags: , , , ,

Interesting stuff to read about #erlang

August 25, 2013 3 comments

Hello there! 

Even though I haven’t been writing in this blog very much during the last moths, I had the chance to read many new (and old) interesting blog posts, articles and tutorial about Erlang.

Some of the stuff I had the chance to read was really well done and inspiring, therefore I would like to share these contents with you. In this blog post of mine I am going to make a list of the 4 articles that I loved most, with a brief description for each of team. Let’s start then!

Interesting Erlang stuff you should take a look at!


Here is my brief list; as I did in one of my previous blog posts I would like to remember that the order of the links is totally random!

  • Create and Deploy Your Erlang/Cowboy Application on Heroku in 30 Minutes: In this blog post, Roberto Aloi explains how to create and deploy easily a web application written using Erlang and Cowboy. I liked this article very much: Roberto is one of the most famous Erlangers out there and even though the application he presents is really easy it’s always a pleasure to read some of his code. Moreover the part related to deploy focuses on Heroku the well known cloud platform, showing how easy it is to deploy our Erlang application there.
  • Continuous Integration for Erlang With Travis-CI: continuous integration (CI) is a powerful tool. While I was searching for a good CI service to be used with one of my Erlang projects I ended up reading this nice blog post  by Ward Bekker. In his tutorial Ward explains briefly what are the main tool we have in Erlang to automate our tests and teaches how to connect a public GitHub repository to Travis-CI. I really liked this blog post, and if you are new to CI I suggest you to read as well this article by Martin Fowler: Continuous Integration.
  • Meck and Eunit Best Practices: TDD and testing in general are one of the things I am trying to learn more in these months. Even though this post by David Reid is not very recent (2011) I suggest you to read it if you want to learn more about Meck, the most famous Erlang mocking library written by Adam Lindberg.  Once more, if you are new to mocking and so on, I suggest you once more to read a great article by Martin Fowler: Mocks Aren’t Stubs.
  • A Week with Elixir: That’s true, Elixir is not Erlang, but I think we all should read what the great Joe Armstrong  thinks about this new interesting language written by José Valim. In his blog post Joe gives his impressions about Elixir and its syntax, providing code samples and really wonderful insights. If you want to know more about Elixir you can go to the official web page or consider buying this book by Dave Thomas.

And that’s all folks! I hope you will enjoy these stuff as much as I did! 

An interview with John Koenig about YMIR

August 2, 2013 3 comments

Hello there! Today I want to introduce you my interview to John Koening. John is a PhD student at University of Minnesota in the fields of distributed and real time simulations. John is also working in the game studio he founded. Currently they are developing the game The Electric Adventures of Watt which has some Erlang in it.

Learning something more about Ymir

Paolo – Hello John and welcome to my blog! Can you please introduce yourself to our readers please?

John – Hi Paolo, thanks for having me. My name is John Koenig and I am a PhD student at the University of Minnesota (UMN) studying distributed, real-time simulation. I am going into the third year of my PhD program preparing for my written and oral defenses. I have been a regular Erlang-user for about 6 years.

Prior to, and inter-mixed with my time at UMN I worked at Cray Inc. Most recently I was contracted under Cray’s Chapel team where I worked on several language improvements in the area of portability. A majority of my time at Cray was spent as part of their Custom Engineering initiative. Together, we engineered unique super-computing platforms and software stacks for various customers.

In 2010, I founded a game studio, Called Shot LLC, with my good friends Gabriel Brockman and William Block. We are currently in the first round of funding for our flagship game title: The Electric Adventures of Watt.

Paolo – This is a common question I ask during my interviews: how did you start using Erlang? What are the features of Erlang that made you learn it?

John – I was first introduced to Erlang while pursuing my undergraduate degree at University of Wisconsin – Eau Claire (UWEC), I think it was around 2006. As part of a Programming Languages course we were tasked with picking a new language and implementing a solution to a sufficiently interesting problem which applied to the language’s domain. At the time, I was big into Plan 9 and distributed software in general so I chose Erlang and implemented a distributed prime number sieve.

Being more of an applied school, UWEC had me spending most of my time programming C and C++ and I remember being really impressed with how Erlang modeled processes and inter-process communication directly in the language. Once I got past Erlang’s syntax learning curve and my newness to functional programming, I found myself able to express distributed solutions very naturally in Erlang. After that, I was hooked. I picked up Joe’s book, Programming Erlang, and started keeping up with the Erlang community online.

I first started using Erlang professionally at Basho in early 2008 when I was brought on as a Reliability Engineer. I had thought, coming out of UWEC, that I knew Erlang fairly well, but I grew considerably during my six months at Basho. Justin and his development team are incredibly talented and being around that level of skill and enthusiasm was highly contagious. I remember that time fondly.

Paolo – Would you like to introduce and describe in a few lines what Ymir is? Where will Ymir be used?

John – Ymir is an open-source (GPL), cross-platform, distributed 3D game engine written in Erlang.

With the number of cores available to gamers on the rise, it is Ymir’s purpose to break games out of the traditional, single-core-dominate game-loop and, in doing so, achieve faster, larger simulations which grow in proportion to the number of available cores.

Paolo – Why did you decide to use Erlang for Ymir? Was there any other candidate language at the beginning of the project?

John – Ymir grew out of a desire to create a multi-player RPG that got away from the traditional client/server model. Myself and a few friends enjoyed online RPGs but didn’t enjoy the MMORPG scene. We were interested the approach of Neverwinter Nights 2, however, which featured smaller worlds developed and hosted by members of the community. Hosting of these worlds could get terribly expensive, as the worlds were hosted on a single server and, as their player base grew, admins of these worlds would be required to either co-locate their server or pay for expensive home internet access with sufficient upload speed. I set out to change this, wanting instead to see a game capable of simulating a world in a more peer-to-peer fashion. Namely, a game engine capable of utilizing the additional computational power and bandwidth present as players login to enjoy the simulated world.

I didn’t consider anything other than Erlang for this task. Along with OTP, Erlang is still the best language for distributed development as it allows me to focus more on the high-level challenges of distributed real-time simulation and less on the gritty details of implementing my own task-queues, inter-process communication, etc. This choice was further cemented when I proved that communication to port drivers, with minimal trickery, was sufficiently fast to support online rendering.

Paolo – Reading your paper I spotted many words often used among Erlang developers: scalable, soft-thread, message passing and minimal amount of synchronization. Would you like to discuss the meaning of each term with respect to Erlang and Ymir?

John – Game engines are traditionally frame-centric. Their primary goal is to compute and render frames as quickly as possible. Two aspects make this approach difficult when scaling over multiple cores: first, computing a frame is recursively dependent on the frames which came before it and, second, traditional spatial data structures used in collision detection require all game entities to be synchronized in order to function.

Ymir takes an object-centric approach and aggregates frames as quickly as possible. Game objects (entities) are represented as Erlang processes (soft-threads) and each entity is responsible for simulating itself locally. Discrete events (e.g. collisions, user-input) are modeled as messages which occur at a specific point in simulation time. As an optimization we allow entities to exist at various points in simulation time and to resolve events in the recent past by application of timewarp. Entities proceed through their local simulations, streaming updates to their physical state to relevant renderers. To enforce fairness, a sense of global time is defined as the minimum of all entity simulation times. This introduces a small amount of global synchronization as entities “vote”on the value of this global time through various shared ETS-based counters.

To break away from traditional spatial data-structures, Ymir applies map/reduce to spatial reasoning in order to achieve scalable collision detection. When simulating forward in time, entities volumetrically hash their physical extents against a fixed cube to various buckets (also soft-threads) and aggregate contacts which result from writing their latest physical states into each selected bucket. The act of mapping to spatial buckets is analogous to selecting nearest-neighbors (broadphase) and the buckets themselves compute points of contact for each pair of entities overlapping within its given volume of simulation space. In short, Ymir serializes only those objects which are sufficiently close together while permitting objects sufficiently separated in space to simulate unimpeded.

Using map/reduce in this fashion allows Ymir to scale-out over many cores very well. Currently, we are able to realize ~11x speedup in overall simulation time on 16 cores and sustained frame rates of ~500 fps. Ymir’s performance is dependent on many factors, however, chief among these is the degrees of freedom between entities. As entities are serialized based on spatial proximity, scenes where all entities exist in persistent contact are currently unable to obtain such lofty speedups. I am currently expanding our methods to better model persistent contact which will help Ymir obtain better speedups in these scenarios. Furthermore, using map/reduce to compute contacts works well locally or over low latency networks but as we scale up to many machines connected with higher latency other approaches will be needed. I am currently investigating network overlays between entities which capitalize on spatial assumptions present in game simulations.

Paolo – Do you have any partial results about Ymir our readers can take a look at? What kind of tests do you do on Ymir?

John – We are actively maintaining performance results on Ymir’s indiedb page, and as time permits I will be documenting Ymir more completely on our development blog.

This video showcases the three testing scenarios we used to gather our preliminary results. All three scenes are rendered offline using Ymir’s built-in support for Mitsuba. Parallel is rather boring to watch, but provides a best case performance. Cylinders features a stack of spheres falling onto an static array of cylinders and is more representative of the types of rigid body interactions one might see in an interactive game. Last, is Bounce in which spheres move randomly within fixed scene boundaries. Bounce is currently being used to measure Ymir’s performance as it relates to scene density.

Paolo – Is there any way our readers can contribute to the development of Ymir? Is there any fund-raising? Can other developers join the project?

John – Glad you asked, yes! We are currently on indiegogo seeking funding for The Electric Adventures of Watt which will be powered by Ymir. In supporting The Electric Adventures of Watt, contributors will be directly helping us mature Ymir into its first public release.

We will be advertising the public repositories for Ymir concurrently with its first official release. In the meantime, if developers are interested in working on Ymir, please, don’t hesitate to get in touch with me: john

Paolo – You are a PhD student at the University of Minnesota and your studies are mainly focused on parallel and distributed real time simulation. Do you think Erlang could be widely used in these fields?

John – Without a doubt, that is what is what Erlang was designed for. There is even a precedent for using Erlang server-side for games: MuchDifferent and SMASH. I feel that as CPUs continue to have more cores and affordable CPU accelerators (i.e. parallela) become available, game developers will turn to solutions like Ymir to grow their games. Scalable, real-time simulation is not an easy undertaking and savvy developers will be looking for the right tools for the job.

As many Erlang enthusiasts know, there are at times substantial resistance to using languages that are outside of other developer’s comfort zones. This is especially true for academia. I can’t even count the number of times I have had to defend Erlang to my lab mates at UMN. That said, we are not expecting that all developers wishing to use Ymir will embrace Erlang, and we have on our roadmap to develop front-ends for languages most game developers will find familiar: C/C++/Lua.

Paolo – Did you find any help in the Erlang community? Did any Erlang developer give you feedback or support online during your development?

John – Several times I got frustrated with the performance of Mnesia and ETS for Ymir’s collision detection and I turned to the Erlang IRC channel for support and guidance. The Erlang community has been nothing but insightful and supportive every time I have turned to them. Although for the life of me I cannot remember that handles of those who offered help, I owe the Erlang community thanks.

We also owe special thanks to you, Paolo, for featuring Ymir on your blog, Peer Stritzinger for helping us reach out to the Erlang community, and to your readers.

An interview with Kenji Rikitake (@jj1bdx)

June 27, 2013 4 comments

Hello there! In this post you can read my interview to Kenji Rikitake. Kenji is a famous Erlang developer and security expert. I really loved this interview because Kenji provided some really interesting anectodes connected to his personal life and many insights on the IT in Japan.

The Erlanger from Japan

Paolo – Hello Kenji! It’s great to have you here! Please, can you describe yourself to our readers.

Kenji – My name is Kenji Rikitake. I am a relatively new user and programmer of Erlang; my experience is only about five years.

I’ve been working on various aspects of internet and distributed computing for 25 years. I started as a intern of VAX/VMS sysadmin in 1987. A couple of years later, I became a VAX/VMS Asian screen management library programmer and the product tester in 1990 at Digital Equipment Corporation Japan.

After leaving Digital in 1992, I decided to start my career as an internet sysadmin, or “devops” in the latest trendy word, and a volunteer evangelist of explaining how internet would change the world. I worked for a systems integration company called TDI, and co-designed and implemented a corporate firewall with BSD/OS systems and dedicated routers, including a simple fault tolerance. The firewall system was running until 2000 when I left the company. I’ve also written two books about internet engineering and technologies in Japanese.

From 2001 to 2005, I was a researcher at KDDI R&D Labs, about network security on intrusion systems, DNS protocol, and teleworking. During the period, I also conducted a joint research with Osaka University as a PhD student. My PhD thesis was about DNS reliability and security.

From 2005 to 2010, I was a researcher for National Institute of Communications and Information Technology (NICT), a research body of the Telecom Ministry of Japan. I involved in the preliminary design of a network intrusion early warning and analysis system called “nicter”, and later I pursued the DNS reliability research especially on the behavior of DNS packet fragments. I also worked in IPv6 and NGN security.

After I met Erlang/OTP in 2008, my research interests have shifted into the concurrency programming and the various related issues, including security, efficiency, and the robustness. Distributed database design is my latest research topic, for the obvious reason that I am currently working on building Riak. I’ve presented four talks at Erlang Factory SF Bay Area from 2010 to 2013, one for each year.

From 2010 to 2012, I was a Kyoto University full professor, though my primary role there was to implement and supervise the campus network security policies and procedures. I worked on two Mersenne-Twister random number implementations for Erlang, called SFMT and TinyMT, which are published in ACM Erlang Workshop 2011 and 2012. I also organized the 2011 Workshop held in Tokyo, as the Workshop General Chair.

I’m currently working for Basho Japan, a Japanese subsidiary of Basho Technologies.

I’m an electronic geek, and my Twitter handle @jj1bdx is derived from my primary ham radio call sign in Japan, which I’ve been assigned since 1976. Morse Code on the shortwave is one of my favorites on the radio, though from 1986 to 1990 I also involved in the packet radio activities
based on TCP/IP. Music is another thing that makes me happy.

Paolo – First real question: how did you meet the functional programming world?

Kenji – I first read a Lisp book in the early 1980s when I was a teenager. I was not that interested in the S-expression though, because I didn’t have an execution environment then. It was even before the C language for the personal computers; I was playing around with my Apple II, mostly in the assembly language, and two tiny programming languages called GAME and TL/1. I even wrote a GAME compiler for 6502 running on Apple II.

Before starting my real career, I was a lab member of Professor Eiiti Wada from 1988 to 1990, at the University of Tokyo. Prof. Wada and his lab members created a Lisp implementation called UtiLisp, and the lab was the most advanced place in the campus networking. I was also learned some basic ideas on the functional and even logic programming, because of the nationwide buzzword called The Fifth Generation Computers. Some of the Wada lab alumni were the key designers and implementers of the language called Guarded Horn Clauses, which has surprisingly similar design philosophy to Erlang, although it is a logic programming language.

My problem about understanding functional/logic programming was, however, that I couldn’t really grasp the core reasons why those programming paradigms were effective and even required for a large-scale system design. I failed on a Prolog course in 1989 either because I didn’t find the unification principle was anything meaningful. So I was a very bad student. I wish I could have learned it in the Erlang way of the pattern matching then!

And unfortunately my mind in the late 1980s was too focused on how to run UUCP and email systems in an inexpensive way without UNIX, so any functional or logical programming paradigms seemed redundant to me, because they were so slow. I didn’t like regular commuting from my home to the university, so I wanted a way to discover a way of working from home. At that time my main target of code hacking at home was MS-DOS then; I had to wait until 1993 when I could use BSD/OS at home for experiencing the real UNIX at home. I later moved into FreeBSD in 1997. And I’ve been running Erlang/OTP mostly on FreeBSD since 2008.

Paolo – And when did you first hear about Erlang?

Kenji – I first saw a Japanese translation of Joe Armstrong’s “Programming Erlang”, published by Ohmsha in November 2007, at a bookstore I visited in Tokyo downtown in February 2008, on my way back home from Tokyo to Osaka. I instinctively found out this was the once I had to learn and go for, so I immediately bought it and started discovering the world of Erlang since then.

Paolo – You told me that you had some bad times during your experiences as developer and University Professor, but also that Erlang and functional programming helped you to overcome your difficulties. Can you tell our readers something about that?

Kenji – Let me start from my programming middle-age crisis first.

I have concentrated my programming effort to C since 1986. I haven’t really grasped the idea of the strict control of the module name space in Java, neither the template-based extension made by C++, even at this moment I am answering to the interview in 2013. Of course I can manage to handle other script based languages such as awk, Python (which is quite good), Ruby, or even JavaScript. I know programmers can no longer choose the languages because every system has chosen the best language for running. But that doesn’t mean you can just improvise all the code; you need to have deep knowledge base on at least a few languages.

I was looking for something completely new and innovative for a programming system to learn, after I thought working only on C was no longer sufficient to keep myself up as a modern programmer. I was sick and tired of understanding and modifying the BIND 9 DNS server code, written mostly in C, for a DNS research paper I was writing then. I don’t blame the BIND 9 programmers because it does really complex magic things, and I admire ISC people especially Paul Vixie, one of my mentors in Digital Equipment and the father of BIND. Nevertheless, having to read hundreds of header macro lines to reach the actual code looked no longer practical to me at that time. And I thought I would have lost my competitiveness as a programming person then, if I stuck into the old way of C programming. So eventually I become a polyglot programmer; I use C, awk, Python, Perl, and Erlang.

I knew multi-core or massive-parallel computing hardware is coming and I wanted to learn something very much different from the past sequential and inherently procedural programming languages and systems. While Erlang is *not* specifically designed for a massive-parallel execution environment, Erlang does have a lot of practical constraints for modern computing hardware requirements embedded in the language, for example the single-assignment variable principle, and the OTP system themselves, for example the gen_server behaviour [sic] framework, to solicit the programmers to do the least wrong things. This is something which other languages cannot emulate or mimic.

Next about the University Professor life crisis.

During my Kyoto University career, most of the things I had been doing there was talking, negotiating, and dealing with people, not with computers. The university is a very large organization, and keeping the campus network secure is something practically impossible without the university member’s help, namely from the administrative, education, research staff, and of course from the students. I am an introvert person and most of the university people are not geeks although many are excellent researchers, so the human communication tasks were the toughest thing to do in my life. Also the long-time commuting from my house to the office, spending four hours in total every day, literally killed me.

Fortunately I was allowed to do the CS research activity, however, during the Kyoto University career. And I was eligible to run a large batch jobs on a large Linux supercomputer cluster. So I decided to run some Erlang code and do the fun things over there. One good thing about Erlang is that it is mostly OS independent, so I did the prototyping on my home FreeBSD machines, and let the huge multi-core jobs run on the cluster. I’ve put the research result into GitHub. So I didn’t have to throw away the possibility of my career as a CS researcher 🙂

Paolo – You are widely respected not only for your knowledge on Erlang/OTP but also for your expertise on distributed system security. What is the intersection between these two fields?

Kenji – Erlang/OTP is a very good candidate for making a reliable system. This means it would be a prospective candidate even for a secure system, if properlydesigned. In other words, an unreliable system could *never* be secure. And every system is not 100% reliable.

The word “security” has a lot of implications in many different aspects, and is widely misused in many contexts, even if I exclude the militaristic and socialistic implications, which may be out of scope of this interview, though very serious issues themselves indeed.

I believe that the foundation of a secure system is a reliable and fault-tolerant system. This has been frequently ignored even by many “security” experts; for many of them, security is only about cryptography, or about restricting the user’s behavior in a system, or just about analyzing the behavior of the pieces of malware. I do not deny those aspects, they are very important, and the outcomes of those research activities are surely essential for making a better computer system, but those aspects are not only *the* security. A very broad perspective is needed for a computer security expert.

Also, I have to stress that security is mostly about people and how people behave. People want convenient systems; at many circumstances, security and convenience do not coexist. For example, if you really want a secure system, do not connect it to the internet. But such a special system, which could enable you to provide sufficient communication capability within the system while rejecting all the attack thwarts and zero attack vector, is virtually impossible to make, from the financial point of view. See the Stuxnet case? Consider what if the power plant were using Erlang/OTP as the core and the end-point controllers.

I wish Erlang/OTP developers always think about making a reliable software. It’s not that difficult; thinking carefully when programming will solve most of the cases.

Paolo – What is the best way to “secure” an Erlang distributed systems?

Kenji – Traditionally, putting the whole systems in a protected network, is the only solution. And unfortunately it has still been so.

This is a very good question to answer, because in the current Distributed Erlang (disterl) system on the OTP, the security model is very weak if any existed. TLS-based disterl (with the ssl and crypto modules) will be a good solution to protect the communication between BEAMs, but the problem is that the communication between BEAMs and the port-mapper daemons are plain text and it’s not trivial to incorporate necessary authentication and cryptographic features.

Erlang/OTP has been depending on the assumption that the whole disterl cluster is in a protected network without any attack vectors. In other words, the disterl cluster itself was considered a system without protection. Opening the communication ports to the internet, however, makes this assumption rather unrealistic; the Erlang/OTP devops must think about all the possible attack vectors for the disterl cluster as a whole system.

One possibility on protecting BEAM-to-BEAM communication is to establish cryptographically authenticated links between the BEAMs and let the links be used persistently, with proper periodic re-keying, without using any port-mapper daemon. I believe incorporating such a facility into Erlang is not that difficult, though the rendez-vous problem between the multiple BEAMs should be solved in another way.

Paolo – During your experience as Professor at Kyoto University, you did also research activity using Erlang and OTP. You worked in particular on SFMT and TinyMT. Would you like to introduce these two projects to our readers?

Kenji – Mersenne Twister (MT), a BSD-licensed innovative long-period (typically 2^19937 – 1) non-cryptographic pseudo random number generator (PRNG) by Profs. Makoto Matsumoto and Takuji Nishimura, has become the de facto standard on popular programming languages such as Python and R. SIMD-oriented Fast MT (SFMT) and TinyMT are the improved algorithms, by Profs. Makoto Matsumoto and Mutsuo Saito. The MT algorithms have all a very high order of equidistribution, which fits very well on a large-scale simulation, including the software testing.

SFMT is an improved version of the original MT, which is even faster than the MT, and has a tunable characteristics of the generation period and the sequence generation. TinyMT is another variant of MT, which has a much shorter generation period (2^127 – 1) and smaller memory footprint, but is still suitable for most simulation use. The algorithm of TinyMT is much compact than SFMT or MT, and can generate a massive number (~ 2^56) of independent orthogonal number sequences, which is suitable for massive-parallel asynchronous PRNG.

For the further details on SFMT and TinyMT, please take a look at:

I am not a mathematician so I cannot mathematically prove how MT and the derivatives are better than the other algorithms. But I have to emphasize very much that Erlang/OTP’s random module is still using an archaic old algorithm invented in 1980s which has a significantly shorter generation period (~ 2^43), and that has already become an indirect source of security vulnerability once (CVE-2011-0766, discovered by Geoff Cant). SFMT and TinyMT have much better characteristics than the random module, and I strongly suggest you to try them out if you really need a better non-cryptographic PRNG.

The sfmt-erlang repository is:
The tinymt-erlang repository is:

Recently I have put 256M (= 2^28) precomputed keys of TinyMT 32-bit and 64-bit generation parameters. This archive is huge (~82GB), but if you would like to use TinyMT for a serious simulation, it is worth taking a look for. The archive is at:

Paolo – Currently you are working at Basho Japan. Can I ask you what is like to work in one of the most acknowledged Erlang companies? How much Erlang code do you see in your working daily routine?

Kenji – Basho developers are all superb and are very energetic on making Riak and recently-open-sourced Riak CS even more better products. Working with such talented engineers and keeping yourself up with them is very very tough, but if you are capable to point bugs and propose contributions which have proven to work correctly to Basho’s open-sourced projects, you will surely be welcome.

I would also like to emphasize that Basho is not just an Erlang company. You need to know every programming languages and the computer science elements, from C, C++, Java, Python, Ruby, to the gory details of distributed database, including how the vector clocks work and commutative/conflict-free replicated data types (CRDTs). Riak, Riak CS, and rebar, include a lot of their by-products. See the deps/ directory under Riak and you will be astonished. On the other hand, there might be many ways to contribute your skills.

I would also like to emphasize that Basho’s client service engineers, sales and marketing people including the documentation experts, and all the other staff members, are closely working together with the developers and maintain the high standard of delivering the quality service and products.

I can only answer that the amount of Erlang code I have to see is *enormous*. 🙂

Paolo – I am very interested about Erlang and Japan. Is Erlang a niche programming language there as well or is it spreading fast as in the US and north Europe?

Kenji – I would rather want to ask the question back: is Erlang a popular language in anywhere in the world? I think the answer is probably no, comparing to the popularity of Java or C++. Looking at the TIOBE index will prove this. And I’d rather say nobody cares about that, because whether a language is spreading fast or not has already become irrelevant, comparing to the jobs or tasks what you want to get done with the language.

I do understand Erlang has gained a larger momentum in Sweden, where the language is from. And I see many people solving problems with Erlang in Europe. And in the USA and Canada (hi Fred!). And in Japan too, especially for the server-side programming solutions. So I feel the developers in Japan are slowly but surely showing more interests.

Getting back to the situation in Japan: I think not many people are interested in whatever the new paradigm of programming, except for relatively small number of communities. Fortunately, those communities surely exist. And some visionaries have discovered some languages, such as Haskell, OCaml, or Erlang, to solve *their* problems and helping others solving the problems. But for the majority of programmers, most of the details are “not really something to be carefully taken care of and to be blindly delegated to the experts”, also called the *omakase* attitude in Japan. So most programmers just do the omakase to the Rails, or to Java libraries, or to the pre-built C++ libraries. And that irresponsible attitude towards their profession, though not necessarily only of their sole responsibilities, cause a lot of sometimes lethal or disastrous bugs in the production systems. Unfortunately, many of programmers in Japan are not well-educated as the software engineers, and their supervisors are sometimes even worse. Their mindset of dumping the risks (or *doing the marunage*) for every difficult problem makes things even worse.

I think programming is not something for omakase and the quality of code will not be sufficient so long as major users of computers are doing the marunage to the developers in Japan. And I believe Erlang/OTP is not for the people who are not willing to take the risk of their own computer systems. On the other hand, for those who want to maintain the system by themselves or at least to eagerly, deliberately, and willingly take the responsibility of running the system without major outage, Erlang/OTP will become a great tool because the system provides the critical and essential functions such as non-stopping module replacement.

Paolo – As many other Erlang gurus out there, you are very active not only when it comes to promote new Erlang applications but also when Erlang newbies ask for support or suggestions. In your opinion what are the factors that make the Erlang community so nice?

Kenji – I was pretty much impressed by the friendly environment of the erlang-questions mailing list and the modest attitude of the experienced Erlang community-driving people there, when I first asked some questions. I just read and read and read all the things in the Erlang-related mailing lists as much as I could. Erlang Workshop papers were also a set of excellent source of information. And now we’ve been full of good code in GitHub, including the OTP itself. So we’ve got many many more things ready to learn now for free!

I’ve heard that one of the old sayings in the Erlang community is “no prima donna allowed”. This is so important for maintaining a community. I understand everybody wants to get grumpy sometimes, and quite often flame wars occur, but many people just endure and keep silent. I respect this rather European or even Swedish way of getting rid of chaos 🙂

Paolo – I think that the Erlang community is growing fast: many applications, conferences and new books, still most of the developers out there don’t know that behind many of the tools they use every day there is a piece of Erlang. How would you explain that?

Kenji – I think this is in fact a very good thing. People want to solve their own problems in whatever tools they have to use, or they think suitable to use. Erlang has flexible package release tools which can minimize the users of the package to think about the installation of Erlang/OTP itself. In many popular applications, the Erlang virtual machine and the necessary libraries are silently built-in and being there; and most people don’t care whether it uses Erlang/OTP or not so long as the software works OK. Erlang/OTP has become a part of the infrastructural ecosystem.

Of course, there is a strong negative side of this trend, too; developers are doing the marunage with the omakase attitude to the developer of those infrastructural tools with no knowledge about the tools. I try not to fall in this trap by building all user-land programs, kernels, and the Port programs of my FreeBSD development servers, at least for the past ten years. You have to think about the bugs if you have to build your own tools; this is a very good way to learn a new thing. You need to forcefully do so frequently.

Paolo – OK, Kenji. Many thanks for the interview!

Kenji – You’re welcome!