Mejsla is a Stockholm-based consulting firm with a focus on the Java platform combined with extensive experience utilizing Play Framework, Akka and Scala from Lightbend. BrandAirport is a leading provider of Marketing Resource Management systems in Sweden and a customer and partner of Mejsla. When BrandAirport needed to develop a new version of a sign and print module, they engaged Mejsla. The solution included a brand new Scala module smoothly integrated with the existing Java environment.

About BrandAirport

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 Problem

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:

  • It was difficult for a user to determine which graphical components a template actually consisted of
  • Different template implementations were coupled to other templates in such a way that it was hard to change a template without having to worry about unintended side effects in other templates
  • The system output is created with a proprietary PDF generation library, and the template engine was built with library interaction sprinkled throughout the code of individual templates. This made the language for expressing the template layouts verbose and very PDF-centric

Improvements with Scala

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.

Java and Scala living together

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.

Learning Scala along the way

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.

GET IN TOUCH

 

×

Welcome to the Lightbend Enterprise Suite


You are excited about Reactive applications. And you want to build, manage and monitor them easily and reliably in your environment.
We get it. So we built Lightbend Enterprise Suite to help you do that, and more, with a range of powerful Application Management, Intelligent Monitoring, Enterprise Integration and Advanced Tooling features.

×

Welcome to the Lightbend Enterprise Suite


You are excited about Reactive applications. And you want to build, manage and monitor them easily and reliably in your environment.
We get it. So we built Lightbend Enterprise Suite to help you do that, and more, with a range of powerful Application Management, Intelligent Monitoring, Enterprise Integration and Advanced Tooling features.