BrandAirport is one of the leading Marketing Resource Management (MRM) systems in Sweden providing services such as a media bank for marketing assets and a specialized brand management Content Management System (CMS). The product suite enables marketing departments to centralize their assets and provides a single place for the entire organization to look for material for marketing campaigns and brand communication.
One of BrandAirport’s systems is a “Sign and Print Creation System”, which is integrated with the media bank and that can generate signs from generic print templates combined with specific content and assets from the media bank.
The previous system was Java EE based with a print engine, print templates, and other subsystems implemented entirely in Java.
The application was very sophisticated, with a large and complex code base. Interaction with the template engine had initially been well defined but had over time slipped and become very hard to understand. Templates had grown a complex multi-step lifecycle with no other way to gain understanding about how an individual print was created than to than to actually carefully look at the calling logic before any modifications could begin. Obviously, this was a big problem and made new template creation extremely time consuming; additionally the system needed additional features since:
Mejsla helped BrandAirport to develop a small Scala DSL for expressing templates in a very concise and clear way resembling the language that a human would use for describing a layout. The DSL implementation also decoupled the system from the PDF library, making the system much easier to maintain for the future.
By using functional programming concepts, the interaction with the templates during a print creation was simplified from the multi-step lifecycle to the point of being a stateless function taking parameters and generating a PDF based on those. This made it much easier to understand how print is created, and it vastly simplified the development of unit-tests.
This new DSL allowed a new set of templates for one of the biggest retail chains in Sweden to be developed with only about a tenth of the amount of code needed to implement the previous Java based templates.
An important requirement was to keep the existing set of templates implemented in Java working while being able to develop new templates in a more effective way. A thin adapter was implemented to hide the complex lifecycle of the old template system from the new templates. Scala's seamless integration with Java allowed the implementation to snap into the old template engine without any changes to the existing engine or templates.
BrandAirport did not have any developers with prior knowledge of Scala. Instead the choice was to learn Scala along the road. With the help of mentoring and Scala literature a seasoned Java developer was able to learn Scala well enough to be productive within the first two or three weeks of the project - in spite of only having a part time commitment in the project.
Inspired by this story? Contact us to learn more about what Lightbend can do for your organization.