The best way to kill and bury your crusty old PHP system · The best way to kill and bury your...

36
The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre [email protected] @gregdetre gregdetre.co.uk

Transcript of The best way to kill and bury your crusty old PHP system · The best way to kill and bury your...

Page 1: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

The best way to kill and bury your crusty old PHP system

BarCamp Tampa 2015 17th October, 2015

Greg [email protected] @gregdetre

gregdetre.co.uk

Page 2: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

ME

Page 3: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk
Page 4: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk
Page 5: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk
Page 6: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

sleepio.com/tour/

Page 7: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

THE BACKSTORY

Page 8: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

When I joined200k lines of PHP

complex web app rich interactive video & audio

questionnaires

payment & voucher codes

community

emailed reminders

multiple branded sub-sites

analytics & reporting

wearables integration

no API

Page 9: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Not about problems with PHP

Page 10: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

web only

PHP

Flash

MySQL

web + mobile (API!)

Python

HTML5

Postgres?

ideas?

mobile app

Eng team doubling every year

HIPAA compliance, data security

flexibility for new product/content development

adaptive machine learning framework

Future requirements

Page 11: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Why change?

API for multiple clients (web/React, iOS, eventually Android)

easier to hire

better tooling/libraries

economies of scale to being monoglot

security

Page 12: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Why Python?

best or 2nd-best way to do everything

web & API framework (Flask)

database ORM (Sqlalchemy)

analysis & reporting (Pandas)

machine learning (Spark, scikit-learn etc)

devops (Ansible, Boto)

readable

mature

Page 13: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

BIG BANG LAUNCH

Page 14: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Do you know what a ‘big bang’

launch is?

Page 15: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk
Page 16: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Do you know why they call it a ‘big

bang launch’?

Page 17: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk
Page 18: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Things you should never do

They [made] the single worst strategic mistake that any software company can make: they decided to rewrite the code from scratch.

http://www.joelonsoftware.com/articles/fog0000000069.html

We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by incremental renovation: tinkering, improving, planting flower beds.

Page 19: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

HOW DO YOU EAT AN ELEPHANT?

Page 20: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

How to replatform gradually

Dual-running

Piecewise

Reversible

http://niksilver.com/2014/07/01/tips-on-replatforming/

Page 21: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Dual-running

shared database

redirect to PHP or Python based on url

same authentication scheme

Page 22: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Piecewise

build all new functionality in Python

new RESTful API for the mobile client

analytics framework

a few new static pages here and there

minimize rewriting for its own sake

Page 23: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Reversible

walkawayability

comparable

AB testing

QA testing

Page 24: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Value first, risk first

prioritise the deliverables by value

flush out the uncertainties early on

http://niksilver.com/2014/07/01/tips-on-replatforming/

Page 25: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

What’s been hard?

mapping the data

same authentication, same backend

new app and old app collected different data at signup

wrote to different fields/tables

so had to double-write

Page 26: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

What’s been hard? cont.

moving from MySQL to Postgres

backup database for analytics that loads in a copy every day

start by converting MySQL dump and loading into Postgres version of backup database?

iron out the kinks, then roll out into production?

Page 27: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

NOW

Page 28: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Slower

… but surer

Page 29: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

mobile app

Eng team doubling every year

HIPAA compliance, data security

flexibility for new product/content development

adaptive machine learning framework

Future requirements

Page 30: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

THE END

Page 31: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

APPENDIX

Page 32: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Resources

Nik Silver on replatforming - http://niksilver.com/2014/07/01/tips-on-replatforming/

Joel Spolsky on major rewrites - http://www.joelonsoftware.com/articles/fog0000000069.html

Page 33: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

value first, risk first

http://niksilver.com/2014/07/01/tips-on-replatforming/

Page 34: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Flask

session framework

fewer vulnerabilities

lots of plugins

Jinja templates

SQLAlchemy ORM

AWS

physically safe data centres

dedicated tenancy machines

Information security

Page 35: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

DISCARDED

Page 36: The best way to kill and bury your crusty old PHP system · The best way to kill and bury your crusty old PHP system BarCamp Tampa 2015 17th October, 2015 Greg Detre greg@gregdetre.co.uk

Goals

Gradual

Reversable

!Walkawayability

Value first, risk first