Zalando Tech: From Java to Scala in Less Than Three Months

Preview:

Citation preview

From Java to Scala in Less Than Three Months

Alexander Kops

Started at Zalando in 2010

Delivery Lead, Brand Solutions

15 countries3 fulfillment centers16+ million active customers2.2+ billion € revenue 2014130+ million visits per month10.000+ employees, ~900 in tech

Zalando at a Glance

Visit us: tech.zalando.com

Legacy Tech Stack

2008 - 2010

Legacy Tech Stack

Complete rebuild in 2010

Zalando Tech Employees

Radical Agility

Purpose

Autonomy

Mastery

Rules of P lay

Microservices

REST APIs

API First

SaaS principle

Cloud: Build on top of AWS

Brand Solutions

Formed in 2014

Creating a CMS for our fashion brands

Uploading their own content to the Zalando shop

Five teams, 50+ people

My Team’s Challenge

Build new analytics product

Gather + compute data from different sources

Potential future growth

Work with legacy applications

Be ready for cloud deployment

Why we chose Scala

Experience with the JVM

Works well with Java libraries

Mature ecosystem

Backed by Typesafe

Functional programming good for parallelization

Why we chose Play

Intuitive to use

Excellent performance

Extensibility

Backed by Typesafe

Scala: the Good Parts

Concise

Combines FP and OOP

Library design choices

Easy parallelization

Great DSLs for testing

Scala: the bad parts

Compilation times

Advanced language features add to compile time

scalac -Xshow-phases

But sbt’s incremental compilation helps!

Language problems

The same thing can be written in many different ways

No canonical style guide

Allows “operator overloading”

FP code can get unreadable

Introducing Scala

Steep learning curve

New language

Functional programming concepts

New frameworks

New build tool

Helping the transition

Assume 3-4 weeks overhead

Two weeks exclusively for learning

Encourage study groups

Bring in freelancers

Incremental learning OO -> FP

Provide material

Fitting projects

Prototypes

Greenfield projects

Modular projects: Layered approach

Two types of Scala converts

Using Scala as Java

Functional programming hipsters

About coding style

Develop own or embrace existing style guide

Pair programming and code reviews

Strict compiler settings

Tooling

IntelliJ > Eclipse IDE

sbt provides benefits over Maven and Gradle

Hiring Scala developers

Genuine Scala developers are rare

Senior Java developers eager to learn Scala

Provide internal trainings

Spread the word that you are doing Scala

Our application

Typesafe Stack in Zalando

40% of engineers want to learn Scala

>12 teams are developing in Play and Scala

>40 engineers

Four Typesafe-certified Scala and Play trainers in-house

Other applications

Merchant Center

Fraud analysis

Stylist website

A/B testing tool

Payment services

Play-Swagger

“API First” library for Play

Developed in-house by two engineers

Collaboration with Typesafe’s James Roper

https://github.com/zalando/play-swagger

Follow us

Tech Blog: tech.zalando.com

GitHub: github.com/zalando

Twitter: @ZalandoTech

Instagram: zalandotech

Recommended