making the case for play framework and scala- budapest ping-conf (2014)

Post on 17-May-2015

632 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Children’s interactive

Making the case for Play

Children’s interactive

Adam Evans

Asher Glynn

CBeebies Tech Lead

Technical Architect

Children’s interactive

CBeebies

Children’s interactive

What is it?

• Website for children aged 4-6

• An aggregate view of BBC content

• 2 million unique users a week

• High UX demands, our audience cry’s

• Built using PHP and a long forked version of Zend MVC

Children’s interactive

The (old) Architecture

CBEEBIES

SOLR ELECTRON NITRO GAMES GRID

PAL

RESTFUL SERVICES

FORGE

Children’s interactive

The Issues• Large legacy codebase

• Cutting edge in BBC at time

• Original developers long gone

• Hard to work on new features with confidence

• Quality of tests vary

• Retro fitted on top

• Hard to do well with the existing codebase

• PHP’s not designed for aggregating data from multiple restful services

• Business needs have changed

Children’s interactive

The Opportunity

“Responsive”

Children’s interactive

What we done on our summer holiday• Clear message to management

• What the problems were

• What we should do about it

• What they should expect

• Used experience and judgement for recommendations

• Time critical - we were in trouble

• No beauty competitions

• Had clear justifications

• Confidence and decisiveness gave management confidence for a spike

Children’s interactive

Play frameworkWhy did we choose it?

• Scala

• Full stack Web Framework

• Reactive architecture is great when calling web services, non blocking - fits

exactly our problem type

• Typed template system is amazing

• Lots of industry buzz

Children’s interactive

The First Spike

• Addressed stakeholder concerns:

• Business value of the product is in the front end

• Could show (visually) immediate progress

• Backends aren’t (visually) impressive

• Created responsive templates from a mocked data layer

• Setup basic build pipeline to AWS - immediate productivity impact

• Demonstrated skills transfer to existing team members

Children’s interactive

The First Spike

• Success!!!

• Compelling enough to have our stakeholders commitment

• A 2 man team of Java/Scala + PHP/Javascript

• Collaborate effectively

• Become productive quickly

Children’s interactive

Moving forward

• How do we take a team of developers into Scala?

• How do we resource?

• How do we manage the risks?

AND

• How to migrate smoothly from the previous Apache/Tomcat platform???

Children’s interactive

The Team

• Started small - 3 developers

• Split frontend/backend

• PHP focused on front end to get familiar (avoid Scala overload)

• Backend started out Java-like with Scala’s syntactical sugar

• Big recruitment drive

Children’s interactive

The New Architecture

• Version Control - GIT

• Build - Jenkins

• Deployment - AWS

• Continuous Delivery (almost)

• App and Web server - Play 2

[Should be pretty diagram here]

Children’s interactive

… after rethinking

Varnish

Nginx + mod_pageseed

Play

Nginx + mod_pageseed

Play

Started with Ended with

AWS ELB

Play Play

…overthought the problem

Children’s interactive

Risky business

• Heavy use of Java in the BBC. Extensive expertise on the JVM

• Already some use of AWS for internal systems

• Extensive change was unavoidable - regardless of the change was

We’re doing things differently not necessarily new (Going outlaw but in a nice Robin Hood kind of way)

Children’s interactive

The approachNo more tears - set by Editorial children's not developers tears

(or product managers or development managers)

• Iterative • Discrete • Tough editorial demands • Tough editorial timeframes • Tough audience!

Children’s interactive

The approach• Distinct vertical sections

• A section at a time

• Updated content item pages first

• Index pages after content pages

Children’s interactive

The approach

Default Theme Templates

Data Access Libraries/Templates

Game Songs Makes Storie Watch Radio Shows

DAO/ Templates

DAO/ Templates

DAO/ Templates

DAO/Templates

DAO/ Templates

DAO/ Templates

Vertical Plugins

DAO/ Templates

Horizontal Plugins

• Play allows modularisation

• Can develop in isolation

• Can deploy in isolation

• Can test in isolation

Children’s interactive

Keeping it real (simple)

• Local in memory cache • Used Guice rather than Cake • Simpler, less boilerplate • More familiar for Java devs • Runtime configuration changes possible

• Opted out of some “kitchen sink” components in Play • Started at the view/templates to drive design

Children’s interactive

Where we are now

• We have our first live release.

• First public facing AWS + Scala Application

• Management buy in for new model with Continuous Delivery

• Stakeholders very happy with turnaround of features

Children’s interactive

Things we’ve learnt

• Hit a few small bugs in Play

• Open source makes it easier to find root cause

• Vast number of base libraries/products

• Constantly learning

• Scala’s cool factor makes it easier to recruit

• Some things are hard to test in Play out the box

• It’s easy to get carried away with idiomatic Scala

Children’s interactive

• Constant engagement with stake holders managing a risky move

• PHP Developers have found it hard

• Syntax / FP concepts appear scary/overwhelming

• Patterns such as DI are new

• Lots of Scala tries to be academically clever

• Java developers

• Find certain aspects hard being different (testing)

• Can sometimes get carried away with new power sacrificing simplicity

top related