Hero Image

Giving Something Back: gravity9 Goes Open Source

 

14 Nov 2023 | Bartłomiej Styczyński,

The status quo for digital technology and software businesses is to develop “closed source” or proprietary software. That is, software that comes with usage restrictions or charges wholly or partly applied to its use. At gravity9, we’re no exception: we develop custom digital products and services for our clients using the same approach.

But what if we decided to develop something and make it available for free?

Well, we have. And that’s where open-source software comes in.


Open source? What’s that?

“Open source” is a label rooted in the free software movement of the 1980s and, like that movement, promotes the free sharing of source code to facilitate redistribution and further modification. The Open-Source Initiative (OSI) provides more in-depth information. But, in essence, open source allows anyone to freely view, modify, and redistribute the code as they deem fit.

There are several advantages to open-source development: it is flexible, customisable, cost effective, and, as the source code is freely available, very transparent. Examples of popular open-source technologies include Mozilla Firefox (a popular web browser), VLC Media Player, and LibreOffice (a free alternative to Microsoft Office products).

Additionally, one of the most widely used cloud-based platforms for open-source software development, collaboration, and version control is called Github.

Why did gravity9 get involved?

While working with a gravity9 client (a large telecommunications provider), one of our project teams found out that they were using JSON Pointer for querying data. JSON Pointer defines how to access a single value within a JSON document. Despite its name, the JSON format is an open, standard file format that is independent of any programming language.

However, JSON Pointer can be quite limited compared to JSON Path, which is the current industry standard. JSON Path is a more powerful tool which allows for operations such as union (extraction of multiple values), filters, and deep search (recursive path matching). In other words, JSON Path allows you to do more with fewer requests.

An open-source library called json-patch resides on Github. The library implements both JSON Patch and JSON Merge in Java using Jackson (a JSON processor for Java, able to parse and generate JSON files). Unfortunately, the authors of this library abandoned the project in 2020, leaving some existing bugs unfixed and a variety of public feature requests unimplemented.

gravity9 recognised the benefit of this library to the client, public users, and our own projects, as it can be used in any project which requires JSON Pointer or JSON Path. However, first, it required fixing and updating.

What did we do?

To continue to ensure public access and pick up where the previous developer stopped, we needed to establish a presence on Github. With this in mind, we created the gravity9-tech account, where our repositories (existing and future) are stored and made publicly available.

Meanwhile, our own development began. We introduced JSON Path alongside JSON Pointer so that the familiarity of the latter and the benefits of the former could both be easily accessed and harnessed, providing the best of both worlds.

The library was moved from Java 7 to Java 11, all other dependencies were updated to their latest versions, and several test cases were added to ensure that the library functions as expected, both for us and for the public. Additionally, we took it upon ourselves to fix several outstanding bugs and feature requests present in the original project that were not addressed by the original author. For example, we resolved this exception error and this dependency error and added SonarQube functionality to inspect code quality.

Outcomes

With the project completed, we released our fork (iteration) – our first open-source library – to the public via our Github account. The library has also been made available on Sonatype and can be found here, so that the public may add it as a dependency for their use. We intend to maintain it going forward.

Our client uses the library in all their services where JSON Pointer or JSON Path is required. Its versatility and suitability have proven valuable time and time again, and that versatility will make it usable for future projects and clients.

We don’t plan on stopping. In fact, we’re already working on a new project library to enhance MongoDB Change Streams. So, look out for that and more from gravity9 in the future.

“Even though our initial goal was to continue using the library as a key tool in our project, it eventually became something we are proud of and dedicated to. Taking over code that wasn’t originally authored by you can be tricky, but we were adamant that we could deliver. With the help of many more test cases, and code analysis tools, we are confident that what we did fits into the legacy of the project.”
– Bartłomiej Styczyński, Software Developer

Visit our Insights page to find more articles around emerging technology trends, the IT industry, interviews, and much more!