SurfGen

Our own solution, designed to speed up development by automating routine tasks
Contents

Project Idea

  • Creating our own solution to automate routine tasks

The Solution

Our philosophy is based on not only building high-tech mobile apps but also continuously improving our talent and development methods. In our technical cases, we describe in detail the technologies we have built to streamline our in-house procedures, reduce the time-to-delivery and increase product quality.

One of these tools is SurfGen.

SurfGen: the essence, the journey, and the purpose 

The essence of SurfGen

SurfGen is a tool that generates app code automatically. It is in charge of making queries to a server using a Swagger API (OpenAPI). 

Due to routine job automation, it helps developers spend 3-4 times less time creating a service layer of an app.

API (Application Programming Interface) is a combination of tools and functions in the form of an interface designed to create new apps. Thanks to that, programs can interact with one another.

Swagger (OpenAPI) is a tooling ecosystem. In the form of an API, it provides a way for front-end systems, library code, and proprietary solutions to interact.

API under the hood

The purpose of SurfGen

SurfGen was intended to help us save time writing code for model server queries and responses. Even though it is a simple process, it’s tedious and time-consuming due to the large amount of code involved. Developers wasted time rewriting models and queries in different formats. Consequently, we chose to automate the process, creating our own generator. The primary goal was to relieve our developers of mundane work, allowing them to focus on other tasks.

The journey to SurfGen

SurfGen first started as an inside project of our iOS team. The new tool proved effective, and we assumed it was logical to scale it up to code generation for other platforms. To make that possible, we had to transfer all platform-specific logic out of the generated code and into templates and create templates for Android and Flutter.

The original version of SurfGen was only able to generate code for iOS apps. Right now, however, SurfGen has become so much more flexible and can be used for both Android and Flutter.

In real-world Android development, SurfGen has already proven effective; we’ve had a chance to apply it in a quick food delivery project and, as a result, sped up its development. Further down the road, we are planning to employ the generator in all of our projects and make it more usable for developers.

SurfGen under the hood

SurfGen reads the API definition it is passed and tries to build a model according to the structure of each request (passed parameters, expected response, etc.).

The generator follows a chain of consecutive steps

To create the finished code, it uses templates—specific files containing the frame for the future code. This frame is then filled with data we receive from API specifications and turned into application code, complete and ready to use. Templates can all be different depending on where you want to put data. This exact quality ensures the flexibility of the approach: whenever we generate code for specific platforms, the only thing changing is a template.

Here’s how SurfGen handles templates

Another task we address with SurfGen is checking the OpenAPI file. Because the OpenAPI standard isn’t really strict, API files would often become lengthy and messy, maing it difficul to track changes effectively. We approached this situation from two different angles: first off, we put together an in-house standard for Open API files. As a result, each project has the same format, making it easier for developers and analysts to work with. Secondly, SurfGen checks the OpenAPI files for accuracy. And only after they are checked can the files be used to generate application code.

The Result

SurfGen has successfully met the biggest challenge: sparing developers their routine tasks. For example, writing the network layer for a single screen (queries and models) used to take 3-4 hours. With this generator, all we have to do is execute a single command and then check whether the program ran accurately. This normally takes less than an hour — an average of 15 minutes plus some manual tweaks makes up about an hour.

When it comes to time-to-deliver reductions in general, the exact amount depends on how much a particular app interacts with the server. 

Code generation can be an advantage for the service layer of any app, no matter how big or small. A single command can make flexible changes to the existing project. As a result, rather than doing routine tasks that involve manual service layer updates, SurfGen does only one task of regenerating the existing files and performing a final check at each of the stages.

That way, we addressed the main challenge of routine tasks. With SurfGen, developers waste much less time on tasks revolving around APIs, thus allowing them to focus on much more complex strategic tasks. At the moment, we are expanding SurfGen, adding support for rare and less evident API elements.

Contact Us

Fill the form and get an estimate of your project
Drop a file here or click to upload Attach file
    Hidden span
    Estimate project