Posts

As Zalando kept growing to become an ecommerce giant, at some point they have decided to switch from Java to Scala. Although it’s a major move that required a lot of effort, they managed to do it in less than three months.

Want to see how they did it? Wondering if this might be the right choice for your company? Keep reading to find out more!

Java vs. Scala – the main differences

We’ll start with a quick introduction so you can see clearly what are the main differences between Java and Scala: 

  • Amount of code – This is the main difference you’ll surely notice at first sight. Scala is a drastically more concise language than Java. The number of lines is visibly reduced, thanks to the use of type inference, function passing and several other factors. 
  • Parallelism – Scala is a much better fit for parallel programming, as it’s designed to express patterns in a very concise manner. 
  • Objects and functions – While Scala is both functional and object-oriented (we’ll cover that in more detail later), you need to keep in mind that functions are acting as objects in Java. Scala treats every function as a variable, which means than one Scala function can accept another. This is one of the most impressive features of this language. 
  • Syntax – This is one of the reasons while Scala’s learning curve can be so steep. Although concise, the syntax seems a little off-putting at first, which is why some people consider Java more readable. This might be a problem for these who want to get started with Scala. 

Why Zalando chose Scala

Alright, so why exactly did Zalando decide to look for a Java alternative, then? Here’s why they thought Scala might be a better choice for some of their needs:

  • The company had years of previous experience with the Java Virtual Machine – Javier Arrieta, one of the Senior Software Engineers at Zalando, had a whopping 18 years of previous experience working with JVM. This solution is fast, efficient and quite convenient for debugging as well. Java worked fine, but there was one problem: the amount of code needed to ensure stability. The team thought that it would also be nice to use lambdas for transforming collections.
  • Scala works well with Java libraries and frameworks – This made the transition from Java to Scala much more convenient. The developers didn’t have to let go of all the libraries they’ve already been used to. They could also stick to Play, which is used for both Java and Scala development. This framework is intuitive, extensive and trustworthy, as it’s backed by Typesafe.
  • It combines functional programming and object-oriented programming – Why choose one when you can have both? Scala presents a hybrid approach, as it combines both object-oriented (OOP) and functional programming. The possibility to choose one or the other paradigm, depending on the situation, makes Scala a really flexible choice. 
  • Scala is great for parallelization – This is one of the main advantages of functional programming. What’s more, Scala comes with a Futures API, which makes parallel programming much smoother. You can use this solution instead of sticking to traditional methods like locks, callbacks and threads. 

What kinds of challenges come with Scala

Although the Zalando team is still positive that moving to Scala was the best choice they could make, there are some challenges they had to face:

  • Compilation times – Advanced languages features in Scala make the compilation time longer. Luckily, there’s a solution to this issue. Zalando team turned to incremental compilation. This trick helped them solve the problem. 
  • Language problems – The same thing in Scala can be written in many different ways, which is both a blessing and a curse. There is no canonical style guide available and the code can get unreadable quite. When implementing Scala, it definitely pays off to implement some sort of in-house style guide. This will help you achieve consistency. 
  • Possible operator overloading – In Scala, the operator can have a different implementation depending on the argument. This case of polymorphism can lead to confusing constructions. 
  • Learning curve – As we’ve already mentioned in the Java vs. Scala comparison, Scala’s syntax can seem highly complicated to those who want to learn it. It’s a hybrid language, which is a double-edged sword: it makes work easier, but you need to consider more aspects to understand how it works. 

How Zalando introduced Scala

The team has to admit that Scala’s learning curve is pretty steep. All developers had to be introduced not only to a new language, but also new frameworks, new build tool and, above all, functional programming concepts. 

So, how do you tackle such a complex project? Of course, you need to start by providing high-quality educational materials. The team at Zalando picked Scala courses from Coursera, which turned out to be a great fit for their needs. 

The developers proceeded to learn through prototypes and greenfield projects. They were creating systems for a new environment, without integrating them with other systems yet. Another method used to introduce Scala was the layered approach. All these measures helped the team learn new skills in a controlled environment. 

Internal workshops worked quite well, as many senior Java developers were willing to learn Scala. Actually, all-Scala developers are quite a rare phenomenon – most of them have transitioned from another programming language. When it comes to exact numbers, 40% of engineers and Zalando expressed interest in learning Scala. 

In Zalando’s Dublin office, most services and data pipelines are written in Scala. The Irish team is using that language to develop the Customer Data Platform.

How the developers at Zalando adapted to Scala

It is also worth mentioning that there were two main types of Scala adoption in the company: 

  • Using Scala as Java – For developers who already had years of experience working with Java, it was almost certain to happen. You could say that they’re using Scala as an improved version of Java, with all the lambdas, pattern matching and case classes involved. 
  • Functional programming nerds – The second group, on the other hand, really got into Scala and all the exciting new opportunities that come with functional programming. They treat Scala like an entirely new programming language and are more open to trying new things. 

It’s good to keep this pattern in mind, as it’s quite likely that introducing Scala will take a similar turn in your company. Some developers may prefer to stick to their own habits and only adopt certain features of the new languages, while some may be particularly excited about implementing a new solution.

What Zalando loves about Scala

Now that Zalando has been working with Scala for quite some time, they can definitely list some of their favorite things about it:

  • Types – The team at Zalando absolutely loves types. They help them understand what kind of value they’re working with, whether it’s the customer’s password, their name, or maybe their email address. They prefer using either tagged types or value classes to manage this data.
  • Referential transparency – It’s about the substitution model. Referential transparent computation allows the team to substitute a function with parameters, which makes work so much easier. It’s also incredibly helpful for testing a program.
  • Using monads for function composition – One of the main advantages of Scala is how it allows composing functions to create more complex ones. Monads one of the most popular ways to make that happen. Thanks to them, many operations can run sequentially.

Key takeaways

As you can see, the Zalando team is very happy with using Scala instead of Java. They love to explore the wide possibilities that come with the hybrid of object-oriented and functional programming. Why not have a closer look at their process and implement a similar solution in your company? Who knows, maybe Scala is the alternative you were looking for. The case of Zalando proves that it can be successfully implemented in just a couple of weeks. 


The article is based on the following sources:

https://www.infoq.com/presentations/scalability-zalando/ 
https://jobs.zalando.com/en/tech/blog/why-we-do-scala/?gh_src=4n3gxh1 
https://www.slideshare.net/ZalandoTech/zalando-tech-from-java-to-scala-in-less-than-three-months 

Check out also:

Kubernetes is not a novelty anymore – but somehow, its potential is still far from being exploited. It started being adopted on a massive scale only recently, and is now in production at 78% of enterprises surveyed by The Cloud Native Computing Foundation (CNCF). Before that, however, Kubernetes didn’t really get the attention it deserves.   

If you’re still sceptical about Kubernetes for some reason, it might be the right time to change your mind and join these change-makers, instead of struggling to understand what this platform is all about. To make it easier for you: Here’s what Kubernetes is, along with the reasons why the tech world is going crazy about it (and why you should, too). 

Read more

It is inevitable that COVID-19 will disturb not only health but also the economy.

Companies need to lock their businesses down and big decisions are being put aside while waiting for better times to come. However, putting the brakes on some projects may not be the way to go, since no one knows when the dust will settle down. 

The coronavirus outbreak is just a recent example, but any crisis is a potential threat to a project if the concerned parties are not prepared for persevering.

The crisis doesn’t have to fully disturb work, though. While we can’t forget about what’s happening all around us, we’re still able to accomplish tasks and take on new projects with the help of a few adjustments.

One of them is remote work. 

Today, we’ll talk a bit more about remote working and why it might save your business during these turbulent times, even if you assume otherwise.

What are some issues with running a business in challenging times?

KPMG have identified a few common contractual issues for businesses in troubling times, which you can see below. 

Source: KPMG

While all of the aforementioned issues could have created problems a few years ago, they can be easily solved via online, remote management of the projects today.

How does remote working deal with these issues?

Well, it can probably solve them all. For many businesses, a lack of work on site definitely leads to problems with contracts, but it does not apply to technology.

While there is still plenty of uncertainty going forward, the work must go on and work still needs to be done. Even those businesses that are on complete lockdown need to handle the situation somehow. The environment is challenging, but companies must do their best to run their business as usual. The same should apply to internal and external collaborations. 

Being prepared to cater for this new environment is not a choice any longer, especially when nobody knows when the turbulent times will end and business will return to normal. 

If work progresses as usual, except for being managed and reported remotely, then there’s no reason to worry about signing, terminating or breaching contracts. 

Today shows why this is, but should not be, a challenge for many. 

Those who had already adapted to remote working don’t necessarily win today, but more importantly they don’t lose. 

Work can’t stop

It’s understandable that the crisis may dampen the mood for launching, investing or spending resources. Of course, some businesses that are under financial pressure might face problems when it comes to upholding contracts and continuing work. However, if nothing except for the method of working and the economical lockdown changes, then putting technological projects on hold is very often not necessary. Actually, in certain cases, doing so could even be considered irresponsible

Any projects that were launched before the outbreak are likely to be continued now, so those that were scheduled to launch and are ready to go shouldn’t be put on hold either. 

What’s more, and what might be a tad controversial: this may be a really good time to work on certain projects while the World is slowing down a bit, especially if nothing really changes except for the type of work. This is where the following question arises:  how to make it work?

Finding the right partner to run a project is crucial. Nearly everyone is working remotely nowadays, but not many software houses know how to properly sort out their remote workflows. 

Change your approach

Facing the crisis isn’t a perfect situation for either side of a project and the atmosphere can be tense, it’s true. What’s most important is to stay safe, but also to be proactive, productive and keen to find workaround ways to deliver. 

Many businesses facing an external crisis need to quickly adjust to remote working.

Regardless of whether or not they have previously been remote working evangelists, they’re often now being thrown headfirst into a brand new situation that they need to handle.

There’s a hurtful opinion that remote working means a lack of productivity and missing deadlines. The problem doesn’t lie with remote working itself, but rather with business partners who don’t live up to expectations and put more groups off the idea as a result.

It’s a test for collaboration

While external collaboration (with software houses or agencies) is important, the crisis situation also puts internal collaboration to the test. This is another reason why it’s better to persevere on projects with those for whom remote working is their bread and butter. They may share their best practices and help you survive the transition to remote working, while maintaining the project stays up and running. 

It won’t happen overnight. First of all, it takes a lot of work and understanding.

Long story short: being surrounded by business partners who know the nature of remote working can save a whole project.

Keep growing, regardless

In turbulent times, you need to find a way of running your projects and also evaluating any potential risks. Of course you may be concerned about how the whole situation could affect your business, but to survive and be successful you need to grow and, eventually, scale.

If your team is not ready for this, your first thought might be to hire more people to accomplish some tasks. But how can you safely hire someone and conduct appropriate onboarding now, when you have been thrown in at the deep end in terms of working remotely and trying to sort out project management?

Well, you should think about contracting a software development company that is able to complete the project for you. That way, it can be done without you hiring extra people, or spending time on the searching, screening and onboarding process that go with it. Not to mention the additional never-ending costs that you would eventually have to cover.

With contractors, you don’t have such strings attached: if all goes well, you can scale the collaboration. If not, it’s fine to  part ways. What’s more, contracting can be much cheaper than hiring someone full-time, since you will hand a whole project over instead of providing benefits and business expenses for a particular employee. 

Contractors can therefore help you grow and adjust your activities to any current situation,despite reducing costs. So why not jump on a call and talk about it?

To wrap-up

The outbreak may stop some business for a while, and it will probably have an impact on operations. Does this mean that you need to stop too? Not if you don’t have a valid reason to do so, no. Running a business as usual may be one step too far, but if your team has the capabilities to work remotely then make the most of it. If not, provide them with the necessary tools to make remote working easier. In terms of external collaboration, choose those companies that know how to organize their work remotely and have already been doing so for quite a while. 

There are a lot of things to worry about right now, but remote working shouldn’t be one of them. Not with us, anyway.

Do you want to learn tactics, strategies, and tips on Managing Remote Employees?

Get our Ebook for free!

If you like this article, check out also: