Custom-Built Transpiler Rewrites Point of Sale Application (POS) Extension from IronPython to C#

laptop with code and hands

SITUATION AND BUSINESS CHALLENGE

A large international food and beverage retailer was operating a point of sale (POS) application that enabled cashiers to enter customer orders, accept payments, and apply customer rewards to purchases. The POS application had been built over a decade ago with 3rd party software on the Microsoft stack and extended with IronPython to support customization outside the scope of the product vendor’s core planning for features.

Although the extension was an innovative and cutting-edge solution years ago, over time it had accumulated a significant amount of technical debt. Due to Microsoft’s and the vendors’ discontinuation of active development and support for IronPython, it was expensive and time-consuming to maintain and upgrade, requiring significant extensions and extensive testing between vendor versions upgrades. In addition, the POS application struggled to match features now offered out of the box by newer POS solutions on the market.

Leadership recognized a need to rewrite the POS application onto a newer codebase that was more modern and modular, but the effort was daunting. A dedicated internal team had attempted to manually re-platform the dynamic-language IronPython code to a compiled C# code base several times, but because of the difficulty in mapping code from different language types, it was forced to roll back due to the number of critical bugs.

Frustrated, the company looked for outside help. Based on previous successful partnerships with AIM Consulting, stakeholders called on AIM to transform the POS into a modern solution.

SOLUTION

A team of AIM developers, led by a Solution Architect with deep experience building systems based on the Microsoft technology stack, built an innovative custom transpiler that ingested the existing Python code and automatically translated the code into C#.

To ensure accuracy and promote confidence that the rewrite would provide full feature parity with the Python application, the team employed an iterative method to convert and test the new code:

Applying a test-driven development (TDD) approach to mature the transpiler

Developers located snippets of unique Python code, wrote their equivalent in C#, then created a test suite that fed the Python code into the transpiler and compared the transpiler output with the original code to see whether the output C# code was the same as the expected result. With every use of this process, the transpiler produced more accurate code and an increasingly higher degree of confidence in the results.

Leveraging user interface (UI) automation that the client was currently using for regression testing

AIM leveraged the client’s Microsoft UI Automation test suite, an API that accesses and identifies UI elements of other applications. The team ran nightly UI automation tests from Python and C# code side-by-side to find and eliminate errors and reach parity quickly.

Holding an internal bug bash

AIM and the internal team hosted a bug bash, which was new to the client, to encourage developers and business analysts outside the project to test the new code aggressively.

AIM’s transpiler automatically converted an astounding 98% of the Python code to C#, in only one-fourth of the time estimated for the project. Only ten errors were found in extensive testing performed by the client’s certification team, which involved a large suite of scenarios including edge cases. The bugs were simple fixes.

The client was pleased with the low bug count and the ability to quickly fail forward if any additional errors were found in production.

RESULTS

With the conclusion of the project, the POS with its new C# code was successfully deployed in phased releases to the client’s stores. The retailer now has a POS platform that is easier to maintain and upgrade. Impressed with the high level of innovation AIM conveyed to the project, the client has awarded several additional contracts to AIM and is advocating for AIM throughout the company. AIM remains engaged with the team as it moves forward with POS feature enhancement projects.