FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... ·...

116
FROM NASA TO STARTUPS TO BIG COMMERCE Building Maintainable, Scalable Projects DANIEL GREENFELD

Transcript of FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... ·...

Page 1: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

FROM NASA TO STARTUPS TO BIG COMMERCEBuilding Maintainable, Scalable Projects

DANIEL GREENFELD

Page 2: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

FROM NASA TO STARTUPS TO BIG COMMERCEBuilding Maintainable, Scalable Projects

DANIEL GREENFELD

Page 3: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Let’s get

started

Page 4: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

BIGPLANS

Page 5: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

https://www.flickr.com/photos/archer10/2215343914/

Page 6: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

https://www.flickr.com/photos/ramcguire/19953122

Page 7: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Early Design Mistakes

and Technical

Debt

Page 8: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Early Design Mistakes

Page 9: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Early Design Mistakes• Not understanding or knowing the requirements

• Over or under architecting

• Choosing the wrong tools

• Premature Optimization

• Management fiat made with ignorance or bad data

• “Brilliant code”

Page 10: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements
Page 11: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements
Page 12: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

2006

Page 13: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Electronic Giftcards

Page 14: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Epic Volume

Page 15: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Our Challenge: ”Brilliant Code”

Page 16: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Refactor

Page 17: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Technical Debt

Page 18: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Loan Against

the Future

Page 19: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Borrowing now…

Page 20: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

…hoping you can

pay it off later

Page 21: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Loan Against the Future

• Get it done fast!

• Grouping data poorly

• Hardcoding

• Upcoming technology will fix it

• Leave testing and documentation for later

Technical Debt

Page 22: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Challenges

Page 23: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Taking out the Loan

Page 24: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Great Engineering Team

Page 25: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Early Design Mistakes

and Technical

Debt

Page 26: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Hard to Maintain Enhance Scale Projects

Page 27: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Example

Page 28: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements
Page 29: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

http://science.nasa.gov

My public NASA work

Page 30: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

http://science.nasa.gov

My public NASA work

Page 31: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

So Many Things to Get Wrong

Page 32: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

is a constant

Failure

Page 33: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

But that’s okay

Page 34: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

How Do We Build for the

Future?

Page 35: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

The Basics

Page 36: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

SR-71

http://commons.wikimedia.org/wiki/File:Lockheed_SR-71_Blackbird.jpg

Page 37: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Kelly JohnsonRenowned and prolific aircraft design engineer

Invented Seriously Awesome Planes!!!

http://en.wikipedia.org/wiki/Lockheed_P-38_Lightning#

mediaviewer/File:Lockheed_P-38J_Lightni

ng_-_1.jpg

http://commons.wikimedia.org/wiki/File:Usaf.u2.750pix.jpg

http://commons.wikimedia.org/wiki/File:Lockheed_SR-71_Blackbird.jpg

http://en.wikipedia.org/wiki/Kelly_Johnson_(engineer)

Page 38: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Kelly Johnson

AREA 51

Really Good Manager

Renowned and prolific aircraft design engineer

http://en.wikipedia.org/wiki/Kelly_Johnson_(engineer)

Page 39: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

KISS

Kelly Johnson Said:

Keep It Simple, Stupid

Page 40: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Keep it Simple Stupid

If Kelly Johnson kept it simple,

why can’t we?

Page 41: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

http://en.wikipedia.org/wiki/Falcon_9 Projects are like rockets

Balancing 10 story building on top of an engine

Sophisticated project • Millions of users • Millions of rows of data • Involving finances

balancing

Page 42: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

KISS

Kelly Johnson Said:

Keep It Simple, Stupid

Page 43: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Simple != Simplistic

Page 44: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Needless Complexity

is Bad

Page 45: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Bad ComplexityOn a recent pre-Eventbrite API project…

I was accused of making an

API too complex

to use!

Page 46: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

@pydanny

46

Decorators are great for API design!

Page 47: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

@pydanny

47

Partials of Decorators

http://pydanny.com/python1partials1are1fun.html

Page 48: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

@pydanny

48

Callables in Partials

Page 49: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

@pydanny

49

Callables in Decorators

My design was brilliant!

Page 50: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

@pydanny

50

My API design is…

brilliant! brilliant! brilliant!

Page 51: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Bad Complexity

• It’s so easy to understand!

• I don’t find it abstract at all

• Really

• What’s wrong with decorators + partials + callables?

On my recent pre-Eventbrite API project…

Page 52: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

@pydanny

52

My API design is…

Something no one

wants to use.

Or Maintain.

Page 53: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Lesson Relearned

• Since business logic is already complex…

• Write tools that are simple to understand.

• Easy to maintain

• Because…

Don’t use that design again

Page 54: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Maintenance Over Time

is Hard

Page 55: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Case Study: Every Project

• Your project has been around for a while

• Problems

• Fixing bugs is hard

• Adding features is hard

Page 56: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Why is it harder?• Project is no longer the bright and shiny

• Adding features adds to complexity

• Bugs caused by unforeseen edge cases

• Not enough tests make catching developer introduced bugs harder

• Mistakes at the beginning are really starting to show

Original Engineer(s) was an Idiot

Page 57: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Original Engineer(s) are always idiots

Page 58: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

I’ve yet to join a project where I didn’t feel like

ranting all the time

Page 59: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Rant Time!• Why use a relational database?

• Why not use a non-relational database?

• Why this programming language?

• Why not use OO or functional programming techniques?

• Why use OO or functional programming techniques?

• What the heck is this programming pattern anyway?

Page 60: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Caveat: The Constant of the Worst Code

Ever

Page 61: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Hindsight is 20/20

• No one predicts with 100% accuracy

• Not on software projects

• It’s easy with hindsight for us to complain about the decisions made.

Page 62: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Reality Check

• Making accurate predictions is hard

• Projects grow organically

• At least you are getting paid to work on this, right?

Page 63: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Be Understanding

• Don’t be a jerk.!

• Try to understand why things evolved the way they did.

• Forgive your predecessor

• They can provide useful information!

• Circumstances can and will be reversed

Page 64: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Complex Foundations: Harder to maintain

Page 65: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Complexity2=

Complex Foundations

Complex Business+

Page 66: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Complexity2=

Hard to Debug

Hard to Enhance+

Page 67: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Simplicity is a

virtue

Page 68: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Simplicity is a VirtueFoundations: Simple

But not Simplistic

Feature Construction: Simple

Bug Fixes: Simple

Page 69: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Be careful with databases that make simplistic approaches easy.

JSON => SQL

Page 70: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Pro-TipWould it work in a spreadsheet?

relational databaseYES!

No! non-relational database

Page 71: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Simplicity isn’t always the answer

Page 72: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Sometimes you do need complexity

Page 73: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Right at the Beginning

Page 74: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Valid Reason for Complexity:

Database Transactions

Transactions aren’t complex, but engineers often think they are.Note:

Page 75: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

http://commons.wikimedia.org/wiki/File:WinonaSavingsBankVault.JPG

Page 76: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

http://commons.wikimedia.org/wiki/File:Okayama_Red_Cross_Hospital.jpg

Page 77: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Database transactions protect

finances and

lives

Valid Cause of Complexity

Page 78: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

transactionsIf one operation fails,

revertrevertrevert

Page 79: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Don’t code solutions to handle

transactions

Page 80: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Use databases with transactions

PostgreSQL MySQL

Page 81: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Avoiding Database Transactions is Simplistic

You have to build special workarounds to make things reliable

(Some very successful non-bitcoin payment systems have done this)

Page 82: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Is a simplistic approach to avoid complexity…

A) Bad Design Decision? !

B) Technical Debt?

Page 83: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Answer

• Plan to fix later?

• Otherwise:

Technical DebtBad Design Decision

Page 84: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

How do we remember all

this stuff?

Page 85: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Best Practices

Page 86: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Insist on Best Practices

Page 87: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Cleaner Consistent Stronger Elegant CODE

Page 88: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Easier to Debug

Page 89: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Easier to Test

Page 90: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Easier to Add Features

Page 91: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

New Staff Ramp Up

FasterFasterFaster

Page 92: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

How to Best PracticeResearch and find the common consensus

PEP-8

PEP-20

Example: Python

Page 93: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Find ReferencesResearch and find the common consensus

Page 94: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Research and find the common consensus

Find References

Page 95: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Research and find the common consensus

• MySQL

• PostgreSQL

• MongoDB

• Redis

• Django

• Python

• CouchDB

• Cassandra

• BigTable

• Flask

Find References

Page 96: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Make project, package, and module boilerplate the same.

Boilerplate Consistency

What’s the right, current way to start a project?

Django, Flask, SOA, DevOps, etc

(Lightning talk on this later)

Best-practice focused project templates!

Page 97: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Don’t Reinvent the Wheel

http://commons.wikimedia.org/wiki/File:Triple_Rotacaster_commercial_industrial_omni_wheel.jpg

Page 98: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Example: CMSDon’t build your own!

Page 99: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Unless your project is about reinventing wheels

• Email Service

• Operating System

• Comments

• Etchttp://en.wikipedia.org/wiki/Omniwheel

Omniwheels are often employed on small, autonomous robots used in academia!

Page 100: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Management Pro-Tip Part 1

If engineers consistently refuse to follow defined best practices…

Page 101: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

They purposefully lower the Bus Factor

http://commons.wikimedia.org/wiki/File:B43OleBillatIWMLondon.jpg

Page 102: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Management Pro-Tip Part 2

Get new ones

Page 103: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Best Practices for

Scaling

Page 104: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Scaling usually isn’t a problem

Page 105: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

97% ChanceYou Ain’t Gonna Need it

Page 106: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

A 3% Case

“Register here”

http://commons.wikimedia.org/wiki/File:President_Barack_Obama.jpg

Page 107: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements
Page 108: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements
Page 109: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Two Quick Scaling Fixes

Based on the fact that the early scaling problems are almost always database-related.

Page 110: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

It’s almost always about the data

Page 111: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

First Fix: Caching

The first healthcare.gov patch implemented by their tiger team

added caching.

Page 112: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Second Fix: Indexing

Almost every datastore supports indexes.

Apply them to places with the most data reads.

Page 113: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Explore other scaling

options

Once caching and indexes are in place…

Page 114: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

Not before

Caching and Indexing!

That’s called “premature optimization”

Page 115: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

http://en.wikipedia.org/wiki/Falcon_9

Summary

Page 116: FROM NASA TO STARTUPS TO BIG COMMERCEfiles.meetup.com/15031342/slides-fromnasatostartupstobig... · 2014-09-03 · Early Design Mistakes • Not understanding or knowing the requirements

pydanny.com

Engineer at

Co-Author of

Architecture Team