Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Evergreen Legacy Application

Slide 9

Slide 9 text

hswolff.com @hswolff

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

youtube.com/hswolff

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

#thoughtleadership

Slide 22

Slide 22 text

Rule 1 Have a good reason to do it

Slide 23

Slide 23 text

Rule 1: Have a good reason to do it • Why are you even bothering? What are you trying to solve? • Does the state of your current application make it difficult to add more features? • Is it hard for you to recruit because the job market for the tech you use is shrinking? • Make sure you have a good reason for tackling this large tech debt problem before you begin.

Slide 24

Slide 24 text

Slide 25

Slide 25 text

Rule 2 Don't stop and rewrite everything

Slide 26

Slide 26 text

Rule 2: Don't stop and rewrite everything • This is a stop the world solution and one that is rarely a good idea. • It takes a lot of time to get to parity with your existing application. • Hard to rediscover all the edge case bugs that were fixed over years. • Stops work on new functionality. Which can be hugely damaging to a young company. • There are times when it's the right call… • …but those are the exceptions, not the rule.

Slide 27

Slide 27 text

Rule 3 Prepare to be in a state of constant migration

Slide 28

Slide 28 text

Rule 3: Prepare to be in a state of constant migration • Having an Evergreen Legacy Application means your old code and new code will exist alongside each. Possibly forever. • You have to be ok with living in this hybrid world. • Prepared to take a small cost when switching context between the old and the new. • It's ok to not have an end path to removing legacy code, but you have to be ok with living in a world of flux

Slide 29

Slide 29 text

Rule 4 What is new today is legacy tomorrow

Slide 30

Slide 30 text

Rule 4: What is new today is legacy tomorrow • Be careful with how many new things you adopt. • Each new thing increases your overall maintenance burden. • Eventually everything becomes legacy.

Slide 31

Slide 31 text

Harry’s 4 Rules • Rule 1: Have a good reason to do it • Rule 2: Don't stop and rewrite everything • Rule 3: Prepare to be in a state of constant migration • Rule 4: What is new today is legacy tomorrow

Slide 32

Slide 32 text

Harry’s 4 Rules • Rule 1: Have a good reason to do it • Rule 2: Don't stop and rewrite everything • Rule 3: Prepare to be in a state of constant migration • Rule 4: What is new today is legacy tomorrow

Slide 33

Slide 33 text

2009

Slide 34

Slide 34 text

2009

Slide 35

Slide 35 text

V1: 2009 Server with jQuery

Slide 36

Slide 36 text

2014

Slide 37

Slide 37 text

V1: 2009 Server with jQuery V2: 2014 SPA w/ Backbone.js

Slide 38

Slide 38 text

React

Slide 39

Slide 39 text

V1: 2009 Server with jQuery V2: 2014 SPA w/ Backbone.js V3: 2017 SPA w/ React

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Rule 2 Don't stop and rewrite everything Don't stop and rewrite everything

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

React + = ♥

Slide 45

Slide 45 text

UI Data Styles

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Rule 3 Prepare to be in a state of constant migration

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

const FooterView = mixInto(Marionette.View)( onInitialRenderPromise, removeViewOnDestroyMixin ).extend({ className: 'app-footer', template, initialize() { this.onInitialRender.then(() => this.render()); }, });

Slide 50

Slide 50 text

const FooterView = mixInto(Marionette.View)( onInitialRenderPromise, removeViewOnDestroyMixin, viewWithReact ).extend({ className: 'app-footer', template, initialize() { this.onInitialRender.then(() => this.render()); this.registerReactComponent( , '.js-react-site-footer' ); },

Slide 51

Slide 51 text

registerReactComponent(reactElement, selector) { this._registeredReactMetadata[selector] = { mounted: false, reactElement, selector, }; }, onRender() { Object.keys(this._registeredReactMetadata).forEach(selector => { const reactComponent = this._registeredReactMetadata[selector]; const domElement = this._getElForSelector(reactComponent.selector); ReactDOM.render(reactComponent.reactElement, domElement); }); },

Slide 52

Slide 52 text

UI Migration 1.Add viewWithReact mixin 2.Register React Component 3.Profit!

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

const person = { name: 'harry', location: 'spain', }; const model = new Backbone.Model(person); model.get('name'); // 'harry' model.set('name');

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

class BackboneWrapper extends React.Component { componentDidMount() { this.props.model.on('change', this.handleChange); } componentWillUnmount() { this.props.model.off('change', this.handleChange); } render() { return
  • {this.props.model.get('text')}
  • ; } }

    Slide 57

    Slide 57 text

    No content

    Slide 58

    Slide 58 text

    import { connectBackboneToReact } from 'connect-backbone-to-react';

    Slide 59

    Slide 59 text

    const userBackboneModel = new Backbone.Model({ name: 'harry', location: 'spain', }); const mapModelsToProps = (models) => { const { user } = models; return { name: user.get('name'), location: user.get('location), }; }; const MyComponentConnected = connectBackboneToReact(mapModelsToProps)(MyComponent); function MyComponent({ name, location }) { // All it has to worry about is plain javascript values. }

    Slide 60

    Slide 60 text

    No content

    Slide 61

    Slide 61 text

    Rule 4 What is new today is legacy tomorrow

    Slide 62

    Slide 62 text

    No content

    Slide 63

    Slide 63 text

    No content

    Slide 64

    Slide 64 text

    this.registerReactComponent( , '.js-react-site-header' );

    Slide 65

    Slide 65 text

    No content

    Slide 66

    Slide 66 text

    No content

    Slide 67

    Slide 67 text

    No content

    Slide 68

    Slide 68 text

    No content

    Slide 69

    Slide 69 text

    No content

    Slide 70

    Slide 70 text

    Evergreen Legacy Application @hswolff youtube.com/hswolff