Rescuing your Legacy Code with Erlang
This workshop will examine some of the challenges posed by having to work with a large legacy codebase while attempting to leverage more modern, powerful and appropriate languages and ways to overcome them.
- Your existing C/C++ code is not Erlang (or Haskell or any of the good languages).
- Your existing code assumes all the other code it directly talks to is in the same un-good language.
- You really want to use a good language, but your manager won't let you because of the above two.
At a minimum, you'll need marshalling / de-marshalling to be able to communicate between old and new code. But creating this often results in a maintenance nightmare where any time you want to change a structure, you need to change its description in each language specific declaration as well as the (de)marshalling code.
This workshop will build up, from the basics, a system that will automatically generate language specific structure declarations as well as marshalling code, all generated from a single canonical source, leaving you only one place to edit when you need to change the structure.
Outline/structure of the Session
- Review and analysis of the problem
- Architecture of the solution:
- Canonical data schema
- Schema parser
- Per-language metadata generator
- Per-language code generator
- Let's design a schema language
- The Erlang yecc parser generator
- Generating language specific metadata
- Metaprogramming with erlyDTL
Attendees will learn some of the pitfalls involved in trying to interface between native-compilation languages and higher level VM-encapsulated languages like Erlang, as well as some techniques for simplifying the process.
Developers who work with multiple languages or who wish to introduce new languages into an existing legacy system
Anyone wishing to follow along and try it out for themselves should bring along a laptop with a relatively recent version of Erlang, a C compiler and 'make' installed.