Team

3 Things I Learned Extracting a Service

3 Things I Learned Extracting a Service

A few months ago, foodora’s “Search and Discovery” team extracted an elasticsearch population service from a PHP monolith (I won’t call it a microservice because our population service is still a large and complex application).

Here are three bits of advice that I wish I’d heard before we started:

1: Mark deprecations as early as possible.

Even if your internal communications are fantastic, when several teams are contributing to the code-base of a monolith it’s easy to forget what everyone is working on.

Since creating the new service might take some time (and even if it just takes one iteration of your sprint-cycle) it’s worth noting ahead-of-time that extraction work is in progress. It doesn’t take much effort to deprecate the things you’ll replace, optionally with a note about the service that will replace it and who the person / team in charge is.

This helps in a number of ways:

  • It increases the chances that anyone who has to modify or make use of any concerned classes will be aware of the upcoming change.
  • Hopefully, anyone who needs to modify or make use of the deprecated classes will keep the team creating the service in the loop know about changes that might also need to be mirrored in the new service.
  • Having a pull-request with a set of deprecations provides an easy “watch-list” for logic changes that might occur during the service development process.
  • Marking deprecations can increase your understanding of the scope and complexity of the operations that you’re trying to extract.

2: Automation will only take you so far.

In a scripting language like PHP, recursive dependency mapping can be very complex, especially with the potential for “magic” method usage, dependency injection, direct object creation, Symfony-framework containers and interface constants.

Tracing required and non-required dependencies can be easily automated with an IDE or on the command line (e.g. grepping for classes referenced with PHP’s “use” keyword). I spent some time creating scripts to help with some of the more repetitive elements of dependency tracing. While this did speed up the process of removing unused files, in the end I found that there’s no real substitute for simply going through the code that your service will replace class-by-class and often method-by-method.

This was tedious at times, but it created a much better understanding of the service’s functionality. It was also a prime opportunity for some (test-driven) refactoring.

3: Make integration tests a priority.

We started thinking about making all existing integration tests pass quite early in our development process, but I had no idea about the complexity of this task.

Next time I extract a service I’m going to try to divide this task up into smaller tickets, each of which could have been focused on more specific sub-tasks such as:

  • Ensuring existing integration tests have correct coverage.
  • Creating an area-specific (e.g. city or country) master switch to toggle old and new functionality.
  • Packaging the new service in a Docker container, perhaps even in a preliminary, “mocked” state.
  • Creating an automated process to pull down a “Dockerized” container of the service before running tests.
  • Making sure that all output, especially from error conditions, are handled correctly by the existing application.

Overall, this process provided a lot of potential for optimising the interface between the monolith and the new service as well as finding the minimum system requirements for our service.

What’s next for “Search and Discovery”?

We’re currently working on a new Scala app that will wrap the search side of elasticsearch, with a focus on auto-generation of SDKs, controllers and documentation from swagger files using tools such as Zalando’s api-first-hand. Some members of our team are actively contributing to the api-first-hand project as well. I think that’s worthy of at least one blog post, coming soon…

Posted by Stuart on 30 Mar 2017 in Architecture, DevOps, Team
Tech Team Q&A

Tech Team Q&A

During the interview process candidates usually have a lot of questions about the team at foodora. This post tries to address the most common questions. Continue reading →

Posted by Mathias on 1 Mar 2017 in Team
foodpanda joins foodora

foodpanda joins foodora

Following the recent acquisition of foodpanda by Delivery Hero (https://www.deliveryhero.com/delivery-hero-acquires-foodpanda/) since today the Technology Team of foodpanda has joined foodora. With combined forces the now much bigger team will support all foodpanda and foodora countries – working together towards our common goal of creating the worlds most customer friendly food ordering platform.

In the same step this blog got rebranded and moved from foodpanda.io to tech.foodora.com.

Posted by Mathias on 13 Feb 2017 in Team
Our Hong Kong team

Our Hong Kong team

Learn more about our corporate product and our team based in Hong Kong. This article covers our internal processes, development methodology and the technical setup.
Continue reading →

Posted by Agata on 25 Jan 2017 in Team
Merry Christmas!

Merry Christmas!

The whole foodpanda tech team wishes everybody wonderful holidays and a few relaxing days with their beloved ones! Continue reading →

Posted by Mathias on 24 Dec 2016 in Team
Pandas @ SymfonyCon 2016

Pandas @ SymfonyCon 2016

SymfonyCon 2016 was held in Berlin last week and foopanda sent a team of developers hailing from nine different countries to learn about the latest developments in the Symfony Framework and how the PHP developer community is using it. Continue reading →

Posted by Stuart on 5 Dec 2016 in Conferences, Team
Hello World!

Hello World!

The foodpanda tech team is super exited to announce that we will start our own Tech Blog in 2016. Continue reading →

Posted by Mathias on 20 Dec 2015 in Team