OSCON 2014 - The Epic Battle: Scala at PayPal

57
The Epic Battle Scala @ PayPal A semi-sarcastic illustrated journey

description

From my presentation at OSCON 2014 http://www.oscon.com/oscon2014/public/schedule/detail/37779 Abstract: There’s only one way to do it here at PayPal – with a framework. Everything you’ll ever need is done if you stay inside the lines. Imagine my reaction when I joined PayPal with Scala and high hopes. We have many reasons to avoid the monolithic framework, so we were going against the grain from day 1. My team came on to “shake things up” and we’ve been doing just that. We brought Scala to PayPal, built small components to defeat “framework-itis” and generally pissed some people off. Now we want to open source the stuff we’re building. I’m going to talk about our challenges so far, and how we overcame them. I’ll have tales (both funny and sad) to tell about my experience so far, and I’ll share plenty of lessons learned along the way.

Transcript of OSCON 2014 - The Epic Battle: Scala at PayPal

Page 1: OSCON 2014 - The Epic Battle: Scala at PayPal

The Epic BattleScala @ PayPal

A semi-sarcastic illustrated journey

Page 2: OSCON 2014 - The Epic Battle: Scala at PayPal

Sr. MTS, PayPal!github.com/arschles!

@arschles

Aaron Schlesinger

Page 3: OSCON 2014 - The Epic Battle: Scala at PayPal

PSA Slide

• I’m good at writing software

• This talk is about things I’ve noticed when I wasn’t writing software

• All opinions are mine only

Page 4: OSCON 2014 - The Epic Battle: Scala at PayPal

History

• StackMob acquired by PayPal

• We write Scala servers at scale

• We’ve felt the pain

Page 5: OSCON 2014 - The Epic Battle: Scala at PayPal

It Might Suck to Code at PayPal

Page 6: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 7: OSCON 2014 - The Epic Battle: Scala at PayPal

We’re Getting Better

Page 8: OSCON 2014 - The Epic Battle: Scala at PayPal

Good PeopleDon’t (yet) do their best work

Page 9: OSCON 2014 - The Epic Battle: Scala at PayPal

If you feel like you aren’t in control of your destiny, you will give up and accept whatever situation you are in.

Learned Helplessness

http://youarenotsosmart.com/2009/11/11/learned-helplessness/

Page 10: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 11: OSCON 2014 - The Epic Battle: Scala at PayPal

The FrameworkLH @ PayPal

Page 12: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 13: OSCON 2014 - The Epic Battle: Scala at PayPal

FrameworksDo it all, one line of code!

Unless you can’t. Then you’re f**cked.

Page 14: OSCON 2014 - The Epic Battle: Scala at PayPal

Needz Moar Frameworks

Page 15: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 16: OSCON 2014 - The Epic Battle: Scala at PayPal

We Live with Failure

• Real != Ideal

• Just say no

• Walk away

Page 17: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 18: OSCON 2014 - The Epic Battle: Scala at PayPal

The Trump Card

Page 19: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 20: OSCON 2014 - The Epic Battle: Scala at PayPal

ComponentsBuild out

Page 21: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 22: OSCON 2014 - The Epic Battle: Scala at PayPal

Unix Philosophy

Page 23: OSCON 2014 - The Epic Battle: Scala at PayPal

DocumentationExplain your component in 1 sentence

Page 24: OSCON 2014 - The Epic Battle: Scala at PayPal

Spring FrameworkIntroduction

!The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level:

Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

!Features

!Dependency Injection

Aspect-Oriented Programming including Spring's declarative transaction management Spring MVC web application and RESTful web service framework

Foundational support for JDBC, JPA, JMS Much more...

!

http://projects.spring.io/spring-framework/

Page 25: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 26: OSCON 2014 - The Epic Battle: Scala at PayPal

Spray Framework

spray is an open-source toolkit for building REST/HTTP-based integration layers on top of Scala and Akka. Being asynchronous, actor-based, fast, lightweight, modular and testable it's a great way to connect your Scala applications to the

world. !

Page 27: OSCON 2014 - The Epic Battle: Scala at PayPal

PSA SlideSpring is a great framework that’s battle tested by a bunch of huge,

successful companies that make tons of money. It obviously has huge value!

!Also, there are smart people behind it and they deserve tons of

recognition for building a great framework. !

I’m picking on Spring here for illustrative purposes.

Page 28: OSCON 2014 - The Epic Battle: Scala at PayPal

Meatspace Frameworks

Page 29: OSCON 2014 - The Epic Battle: Scala at PayPal

Communication != Meetings

Page 30: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 31: OSCON 2014 - The Epic Battle: Scala at PayPal

I Don’t Believe YouUnless it’s Working Code

Page 32: OSCON 2014 - The Epic Battle: Scala at PayPal

Communicate With Code

I want people to talk about the code they’ve written

Page 33: OSCON 2014 - The Epic Battle: Scala at PayPal

InnerSource

Page 34: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 35: OSCON 2014 - The Epic Battle: Scala at PayPal

Inner SourceThink outside the firewall!

Page 36: OSCON 2014 - The Epic Battle: Scala at PayPal

My Trust Issues

Page 37: OSCON 2014 - The Epic Battle: Scala at PayPal

Open Source

Page 38: OSCON 2014 - The Epic Battle: Scala at PayPal

Krakenkrakenjs.com

Page 39: OSCON 2014 - The Epic Battle: Scala at PayPal

KrakenGlue code

Page 40: OSCON 2014 - The Epic Battle: Scala at PayPal

KrakenBYOF

Page 41: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 42: OSCON 2014 - The Epic Battle: Scala at PayPal

PayPal-Isms• Tightly coupled with Security

• Tightly coupled with Ops

• Tightly coupled with deployment

• Tightly coupled with monitoring

• Tightly coupled with logging

Page 43: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 44: OSCON 2014 - The Epic Battle: Scala at PayPal

My Team Will Do Better

Page 45: OSCON 2014 - The Epic Battle: Scala at PayPal

Open Sourcing Our ScalaStealing ideas from Kraken

Page 46: OSCON 2014 - The Epic Battle: Scala at PayPal

BundlingStuff my team knows works, has support, has community

Page 47: OSCON 2014 - The Epic Battle: Scala at PayPal

Beyond BundlingGet experience, be opinionated

Page 48: OSCON 2014 - The Epic Battle: Scala at PayPal

Being Opinionated• Enforce Style Guidelines

• Use the Type System

• Enforce Compiler Warnings

• Make Failing Builds Critical

• Use the Best Testing Frameworks

• Have Real Time Statistics

• Demand Non-Blocking I/O

• Use Akka Properly (that’s another talk)

• Profile Regularly

Page 49: OSCON 2014 - The Epic Battle: Scala at PayPal

Being OpinionatedMy team is being “confident” on purpose.

We’re ready to be wrong.

Page 50: OSCON 2014 - The Epic Battle: Scala at PayPal
Page 51: OSCON 2014 - The Epic Battle: Scala at PayPal

I WantTo have a voice in the Scala Community

Page 52: OSCON 2014 - The Epic Battle: Scala at PayPal

I WantThe community to make my team better

Page 53: OSCON 2014 - The Epic Battle: Scala at PayPal

I WantFame and fortune for me and my colleagues

Page 54: OSCON 2014 - The Epic Battle: Scala at PayPal

That’s it

Page 55: OSCON 2014 - The Epic Battle: Scala at PayPal

github.com/arschles @arschles

arschles.github.io I exist in person too

Page 56: OSCON 2014 - The Epic Battle: Scala at PayPal

LogisticsIn case you care

Page 57: OSCON 2014 - The Epic Battle: Scala at PayPal

Scala$NAME