zalando tech: from java to scala in less than three months

35
From Java to Scala in Less Than Three Months

Upload: zalando-technology

Post on 14-Apr-2017

3.254 views

Category:

Technology


1 download

TRANSCRIPT

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

From Java to Scala in Less Than Three Months

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

Alexander Kops

Started at Zalando in 2010

Delivery Lead, Brand Solutions

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

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

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

Legacy Tech Stack

2008 - 2010

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

Legacy Tech Stack

Complete rebuild in 2010

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

Zalando Tech Employees

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

Radical Agility

Purpose

Autonomy

Mastery

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

Rules of P lay

Microservices

REST APIs

API First

SaaS principle

Cloud: Build on top of AWS

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

Brand Solutions

Formed in 2014

Creating a CMS for our fashion brands

Uploading their own content to the Zalando shop

Five teams, 50+ people

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

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

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

Why we chose Scala

Experience with the JVM

Works well with Java libraries

Mature ecosystem

Backed by Typesafe

Functional programming good for parallelization

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

Why we chose Play

Intuitive to use

Excellent performance

Extensibility

Backed by Typesafe

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

Scala: the Good Parts

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

Concise

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

Combines FP and OOP

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

Library design choices

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

Easy parallelization

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

Great DSLs for testing

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

Scala: the bad parts

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

Compilation times

Advanced language features add to compile time

scalac -Xshow-phases

But sbt’s incremental compilation helps!

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

Language problems

The same thing can be written in many different ways

No canonical style guide

Allows “operator overloading”

FP code can get unreadable

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

Introducing Scala

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

Steep learning curve

New language

Functional programming concepts

New frameworks

New build tool

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

Helping the transition

Assume 3-4 weeks overhead

Two weeks exclusively for learning

Encourage study groups

Bring in freelancers

Incremental learning OO -> FP

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

Provide material

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

Fitting projects

Prototypes

Greenfield projects

Modular projects: Layered approach

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

Two types of Scala converts

Using Scala as Java

Functional programming hipsters

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

About coding style

Develop own or embrace existing style guide

Pair programming and code reviews

Strict compiler settings

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

Tooling

IntelliJ > Eclipse IDE

sbt provides benefits over Maven and Gradle

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

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

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

Our application

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

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

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

Other applications

Merchant Center

Fraud analysis

Stylist website

A/B testing tool

Payment services

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

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

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

Follow us

Tech Blog: tech.zalando.com

GitHub: github.com/zalando

Twitter: @ZalandoTech

Instagram: zalandotech