migrating a legacy product to pyramid

44
Migrating a legacy product to Pyramid Tom Blockley

Upload: tom-blockley

Post on 25-Dec-2014

189 views

Category:

Technology


1 download

DESCRIPTION

When you decide to re-write a product from the ground up, there are a lot of decisions to make, and functionality that cannot be changed. We chose to rebuild in Pyramid. This talk will cover our experiences of building a large product in Pyramid. There will be a side by side comparison between the old and the new product, and a bit of background into the reasons for some of the choices we made. It will look into the process of the build, encompassing the following subjects: - Fast prototyping - Theming the app with Diazo - Test Driven Development - Translation - Minimising page reloads using JSON - Supporting per-client customisations both in theme and in functionality - Pitfalls - Problems found and solutions discovered - Does Pyramid support agile development?

TRANSCRIPT

Page 1: Migrating a legacy product to Pyramid

Migrating a legacy product to Pyramid

Tom Blockley

Page 2: Migrating a legacy product to Pyramid

Who am I?

• Tom

• Developer for Delib

• Plone for 5 years

• Pyramid for 2 years

• Scrum Master for 18 months

• Before that? Java.

Page 3: Migrating a legacy product to Pyramid

Who are Delib?

• The other Plone company in Bristol

• Est. 2001: Consultation solutions for government

• Plone for 8 years

• First to use Dexterity in production sites

• 3 main products, 2 based on Plone

• >150 clients around the world

• >150,000 responses in 2013

• Peak of 42,000 responses in a single week in 2013

• Biggest ever : 47k Users and 110k Responses in 3 months

Page 4: Migrating a legacy product to Pyramid

What is this?

• Migration of an old product to the Pyramid framework

• Tech choices

• Problems

• Agile

• Translation

• Testing

• Theming

Page 5: Migrating a legacy product to Pyramid

The old

• Conceived 2005

• ZMI product with Kubes

• Completely customisable per-client

• >60 clients, large and small

• Ugly. Really Ugly...

Page 6: Migrating a legacy product to Pyramid

The old

Page 7: Migrating a legacy product to Pyramid

The new

• Conceived May 2013

• Chose Pyramid

• Must be:

• Pretty• Responsive• Accessible• Translatable• Customisable• Tested• ... and done by October 2013

Page 8: Migrating a legacy product to Pyramid

Decisions we made

• Build it using agile methodology

• Use:

• Pyramid• ZODB• Buildout• Diazo• Colander• Deform• repoze.workflow• Pyramid auth• i18n

Page 9: Migrating a legacy product to Pyramid

How did it go?

• Actually only started in July

• 10 week long sprints

• Fast prototyping to test concepts and UX

• Still a lot to do

• BUT the public side of the app nearly finished

Page 10: Migrating a legacy product to Pyramid

Sprint 1 - Ada Lovelace

• 544 lines of python (95 in tests)

• 48% Test coverage

Page 11: Migrating a legacy product to Pyramid

Sprint 2 - Bertrand Russell

• 1693 lines of python (272 in tests)

• 76% Test coverage

Page 12: Migrating a legacy product to Pyramid

Sprint 3 - Charlie Chaplin

• 2299 lines of python (779 in tests)

• 74% Test coverage

Page 13: Migrating a legacy product to Pyramid

Sprint 4 - Don McCullin

• 2419 lines of python (931 in tests)

• 84% Test coverage

Page 14: Migrating a legacy product to Pyramid

Sprint 5 - Edwin Hubble

• 2683 lines of python (1079 in tests)

• 85% Test coverage

Page 15: Migrating a legacy product to Pyramid

Sprint 6 - Francis Crick

• 2867 lines of python (1266 in tests)

• 86% Test coverage

Page 16: Migrating a legacy product to Pyramid

Sprint 7 - Grace Hopper

• 3020 lines of python (1301 in tests)

• 85% Test coverage

Page 17: Migrating a legacy product to Pyramid

Sprint 8 - Harry Houdini

• 3414 lines of python (1416 in tests)

• 86% Test coverage

Page 18: Migrating a legacy product to Pyramid

Sprint 9 - Indiana Jones

• 3752 lines of python (1494 in tests)

• 86% Test coverage

Page 19: Migrating a legacy product to Pyramid

Sprint 10 - Judi Dench

• 4602 lines of python (2027 in tests)

• 87% Test coverage

Page 20: Migrating a legacy product to Pyramid

Technologies used with and in Pyramid

Page 21: Migrating a legacy product to Pyramid

Combined Traversal and Dispatch

• Gives you all the good stuff from traversal

• Without defining your URL structure for you

Page 22: Migrating a legacy product to Pyramid

Combined Traversal and Dispatch

+

+

Page 23: Migrating a legacy product to Pyramid

Combined Traversal and Dispatch

+

Page 24: Migrating a legacy product to Pyramid

Auth framework

• Easy to configure

• Can set it up incrementally

• Hooking up with object classes & __acl__ is a piece of cake

Page 25: Migrating a legacy product to Pyramid

Predicates

• Request Parameter predicates

• Route prefixing

• Stacking predicates

• Custom predicates

• Exception views

• default_views

Page 26: Migrating a legacy product to Pyramid
Page 27: Migrating a legacy product to Pyramid

Colander & Deform

• Does the forms and schema so you don’t have to

• Colander Schema is canonical source for layout

Page 28: Migrating a legacy product to Pyramid

Diazo

• Build basically an HTML API

• Keep basic, semantically correct templates

• Apply anyone’s theme to the templates

• Good introduction to XSL

• Don’t pollute your app code with crazy skin compromises

• Designer & Front end developer could go and do their thing

Page 29: Migrating a legacy product to Pyramid

Things we really liked about Pyramid

• Auth & group finder

• Super flexible predicates

• Combining traversal and dispatch

• Documentation

• Everything runs in one process

• Fast tests

• Minimal boiler plate

• pshell

Page 30: Migrating a legacy product to Pyramid

How did we do against our original goals?

Page 31: Migrating a legacy product to Pyramid

Pretty

• 3 demos in different colour schemes

• Configured with a few lines of LESS

Page 32: Migrating a legacy product to Pyramid
Page 33: Migrating a legacy product to Pyramid
Page 34: Migrating a legacy product to Pyramid
Page 35: Migrating a legacy product to Pyramid

Responsive

• Javascript

• Mobile and Tablet layouts

Page 36: Migrating a legacy product to Pyramid

Accessible

• Well, we’ve not done it yet

• BUT

• We have a set of accessible colour schemes ready to go

• We can fix the accessibility of the markup in Diazo

Page 37: Migrating a legacy product to Pyramid

Translatable

• Every single piece of text on the site has corresponding i18n tag

• No translations yet

• Some of the current theme is too fixed width

Page 38: Migrating a legacy product to Pyramid

Customisable

• Fork it

• Theming for clients is easy

Page 39: Migrating a legacy product to Pyramid

Tested

• Jenkins integration

• No selenium / robot framework yet

• 87% Coverage

Page 40: Migrating a legacy product to Pyramid

Agile

• Fast prototyping

• Populate script

• Make initial implementations as naïve as possible

• We’ve already decided to change the design again

Page 41: Migrating a legacy product to Pyramid

What went wrong?

Page 42: Migrating a legacy product to Pyramid

Pitfalls

• “Protoduction”

• Short term technical debt

• Leaving interns on their own

• Meeting fatigue

• Arbitrary deadlines

Page 43: Migrating a legacy product to Pyramid

Problems

• Incomplete

• Contracted Front End developers

• One tree, many branches

• Rebase is a b*tch

• repoze.workflow

Page 44: Migrating a legacy product to Pyramid

Thanks.