legacy: a retrospective - open west 2016

33
@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9 Legacy A Retrospective @jessicamauerhan | #OpenWest| https://joind.in/talk/091b9

Upload: jessica-mauerhan

Post on 19-Jan-2017

138 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

LegacyA Retrospective

@jessicamauerhan | #OpenWest| https://joind.in/talk/091b9

Page 2: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

@jessicamauerhan

2

Senior Test Engineer

Grovo Learning, Inc

[email protected]

jmauerhan.wordpress.com

Page 3: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

What is a Retrospectiv

e?

★ What worked well?★ What didn't work

well?★ What would we do

differently next time?

3

Page 4: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

★ Content Production★ Learning

Management System

★ E-Commerce★ Business to Business

(B2B)

Project Summary

4

LMS + E-Commerce

Page 5: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Problematic History😠 Broken Admin Panel😠 No Documentation of Basic Processes😠 Frontend Site Worked, Progress Stalled😠 Complex Logic not Documented

5

Page 6: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Business Goals★ Add Missing Admin Panel Functionality★ Add New Features Without Breaking Existing

Features★ Avoid Downtime

6

Page 7: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Technical Goals★ Maintainable Code★ Quality Code★ Documentation★ Rapid Development★ Easy Deployment★ Zero Regressions Per Release

7

Page 8: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Disclaimer!

8

Maintaining and Iterating on Legacy Code is usually

faster, easier and cheaper than a full rewrite

Page 9: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

How Did We Do It?

9

Page 10: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Version Control

★Easily compare changes★Revert breaking changes to

stable point★Allows developers to work

on multiple tasks concurrently without confusion

★Works best with short-lived branches, and small changesets

10

Page 11: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Continuous Integration

& Deployment

★CI: Quickly merge changes into master upon passing tests

★CD: Automatically deploy changes to master upon merge

★Encourages small changesets and rapid development

★Tests are your gatekeeper

11

Page 12: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Automated Testing

★Unit Tests: Foundation of Test Suite

★Legacy Code = Not Unit Testable

★Solution: Behavior Tests

12

Page 13: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Testing Pyramid

13

MaintenanceCoverageFragility DurationCost Number of Tests

Unit Tests

Behavior Tests

System Tests(performance)

GUITests

Unit

Behavior

System

GUI

Manual QA

Testing Ice Cream Cone

Page 14: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

The Vicious Cycle of the Testing Ice Cream Cone

14

Unit

Behavior

System

GUI

Manual QA

Non Testable

Code

More Expensive

Tests

Developers Don't

Run Tests

More Bugs

Developers Don't

Write Unit Tests

Page 15: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Automated Testing

★Unit Tests: Foundation of Test Suite

★Legacy Code = Not Unit Testable

★Short-Term Solution: Behavior Tests

★Long-Term Solution: Write Unit Testable Code & Unit Tests

15

Page 16: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Writing Features for Existing CodeWrite FeatureRun Test

Test Passes - Double CheckTest Fails

Described Feature WrongMistake in Test CodeFeature is Broken

16

Page 17: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Style Guide★Reduces clutter in diffs★Reduces head-butting &

petty arguments★Just pick one!

17

Page 18: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Quality Rules

★Keep New Code from becoming Legacy Code

★Be Specific★Feedback needs to be

immediate - How?

18

Page 19: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Quality Enforcement

★Automate All The Things! (Add it to your CI)

★Quality Checks Run Locally★Bypass in emergency

19

Page 20: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Code Review

★Always Be Code-Reviewing!★Small PRs★Look for:

○ Readability○ Business Logic○ Security & Performance

Problems

20

Page 21: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Continuing Education

★ Conferences, User Groups, Community

★Weekly Training & Teaching Sessions In-Office

21

Page 22: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Third Party Tools &

Libraries

★Don't Write Code That Doesn't Contain Business Logic

★Cheaper to Research Third-Party Tools vs. Write It Yourself

○ Does it suit our needs?○ Is it maintained?○ Is it tested?○ Can we contribute?

★Contribute Back!22

Page 23: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9 23

Page 24: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Restful API

24

★Client-Facing and Internal Use

★Iterate Front-End Changes to Introduce Unit-Testable Code

★Behavior Tests Covered Front-End Changes

Page 25: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Restful API25

Page 26: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

50%Salesforce reportedly generates 50 percent of its revenues through APIs

26

https://techcrunch.com/2016/05/21/the-rise-of-apis/

Page 27: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

60%eBay nearly 60 percent

27

https://techcrunch.com/2016/05/21/the-rise-of-apis/

Page 28: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

90%Expedia a whopping 90 percent

28

https://techcrunch.com/2016/05/21/the-rise-of-apis/

Page 29: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Make Your API a First

Class Citizen 29

Page 30: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

What Worked?

❖ Version Control

❖ Automated Testing

❖ Style Guide

❖ Code Quality & Enforcement

❖ Code Review

❖ Education

❖ Use of Third Party Tools & Libraries

30

What Didn't Work?

❖ Continuous Integration & Deployment

❖ Automated Testing

❖ Neglected Our API

❖ Third Party Tools

➢ Didn't Research Enough

➢ Didn't Contribute Back

➢ Didn't Update

What We Would Do...

❖ Focus on the API First

❖ Microservices

❖ Focus on Unit Testing

Page 31: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Current Project Status

It's stable!

★New Admin was launched after about 9 months

★Had a few bugs, took about 3 more months to be stable

★Next 2 years: ~0 regressions

★Very limited downtime

31

Page 32: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

Technical Goals

Happy Developers!

★Maintainable Code: Check

★Quality Code: Check

★Documentation: Check

★Rapid Development: Oh Yeah

★Easy Deployment: So Easy!

★Zero Regressions: Close Enough!

32

Page 33: Legacy: A Retrospective - Open West 2016

@jessicamauerhan | #OpenWest | https://joind.in/talk/091b9

LegacyA Retrospective

@jessicamauerhan | #OpenWest| https://joind.in/talk/091b9