SlideShare uma empresa Scribd logo
1 de 19
Baixar para ler offline
FLASK!
18 months in @ happify
FLASK NYC 2013
Andy Parsons @andyparsons
This talk
FLASK NYC 2013
E x p e r i e n c e
a n d L e s s o n s
F l a s k
@
H a p p i f y
A n 1 8 - m o n t h - o l d
a c t i v e F l a s k
c o d e b a s e
H o w I g o t t o
F l a s k
Flask has become a
VIBRANT, ACTIVE toolkit
for HTTP servers.
But there aren’t a lot of
large examples from which
to learn. LET’S CHANGE
THAT.
Me.
•startup junkie. masochist.
•co-founder/CTO Happify
•previously CTO Outside.in, bookish, ...
•MENTOR @ seedcamp, techpeaks, 500 Startups
•pragmatist
•love choosing tools, Learning, making them better
not Me.
•Framework zealot
•django expert (no comparisons)
•IDEALIST
what is a “microframework?”
•just the essentials, nothing more
•extensibility through plugins
•readable source
•minimal magic
•easy to build a toy/demo
•lack of patterns for larger projects
FLASK NYC 2013
PROJECT LINES OF CODE COMPLEXITY
Backbone.js < 1000 LOW
Flask (not Werkzeug) ~2000 (?) LOW
Redis 100,000 MEDIUM
Django 170,000 MEDIUM
MongoDB 500,000 HIGH
PostgreSQL > 1,000,000 HIGH!
complexity spectrum
* STATS FROM OHLOH (http://www.ohloh.net/) and http://www.andreas-dewes.de/code_is_beautiful/
‣ java/spring/.NET
‣ a FEW rails-based startups (sinatra mixed in)
‣ scala services (scalatra, play)
‣ Python a natural fit for happify (data analysis, machine learning, nlp)
‣ flask selected as toolkit
my journey to flask
A Sampling of NYC Python
A Startup Junkie's Journey to Python via Java, Ruby and Scala
Andy Parsons
@andyparsons
My Startups and Their Stacks What Are We Building? And in general...
Happiness Speed Magic Readability
BUSINESS WEB API SERVICES DATABASES TEAM SIZE
Pro Photo ASP.NET C#, Perl SQL Server 12
Hyperlocal
Content
(Geolocation
)
RoR Sinatra Scala
PostgreSQL,
MongoDB
10
Ereading and
Book
Recommende
r
RoR Scalatra Scala/Java MongoDB 8
Life Gaming Flask
Python/
Gevent
Python
PostgreSQL,
MongoDB
3
Building Happify: Comparing Language Options
SPEED CONCURRENCY TOOLING
PACKAGING /
DEPENDENCIES
DEPLOYMENT TESTING
FRAMEWORKS
/ LIBS
RUBY
SCALA
PYTHON
Fast enough Achieved through Process.fork
Healthy, lots of
choice
Gems Capistrano Mature
Growing collection
of libs, but weak in
NLP
Fast! Real concurrency,Akka
Still early. IDE’s
weak.
Complex. JARs, SBT, Ivy,
Maven.
? Maturing
Early for native
scala libraries, rely
on Java interop
Fast enough
Achieved through
multiprocessing
Healthy, lots of
choice
Eggs Fabric Mature
Massive collection
of libraries
READABILITY
HAPPINESS /
PRODUCTIVITY
COMMUNITY /
ACTIVITY
PROPENSITY FOR
MAGIC
MATURITY /
STABILITY
HIRING
RUBY
SCALA
PYTHON
OK. Emphasis
metaprogramming can
present challenges.
High Huge and active
Metaprogramming is sometimes
abused. RoR is too magical and
many imitated its philosophy
Stable, but much
catchup remaining for
gems to support 1.9
Tough. Medium
learning curve,
hard to find
seasoned devs
Concise, expressive but
NOT simple.
Highly variable! Small and active
Too many ways to accomplish
things. Scala “implicits”
encourage magic
Language spec
changing, breakages
still occurring in dot
releases
Very difficult.
Steep learning
curve
Highly readable High Big and active Explicit better than implicit
Most mature here.
But the 2.x/3.x break
is bad.
OK. Shallow
learning curve.
FLAME BAIT
BASICS
Scala Ruby Python
23
18
8
How do they “Stack” Up?
Happify is an angel-funded consumer
destination “life game.”
HTML5, Mobile, and Facebook front ends.
Currently in stealth mode.
Score is based on:
Green = 2
Yellow = 1
Red = 0
Python
36%
Ruby
60%
Scala
4%
Github Project Relative %
Gratuitous Perf Charts!
* from: http://shootout.alioth.debian.org
pycon 2012
poster
what is happify?
‣ science of happiness
‣ positive psych trainer
‣ consumer subscription business
‣ launched in beta after 9 months
‣ ~100K users
‣ imminent public launch
FLASK NYC 2013
happify stack abbreviated biography
•FEbruary 2012: james dennis @j2labs for coffee
•march 2012: started coding poc (jinja templates only)
•june 2012: alpha poc launched
•september 2012: first real design/ux work
•october 2012: backbone/coffeescript introduced
•december 2013: redis added, closed beta launched
•march 2013: ES added, open beta launch
•june 2013: commerce, new feature set, scale up to 100K users
•august 2013: ”final” design, refactoring for public launch
•now: frontend and backend performance, press
what is large?
what is large?
•80 views
•200 templates
•60 backbone views
•50 models
•200 tests (need more!)
‣ backbone.js
‣ coffeescript
‣ haml
‣ less css
‣ flask
‣ flask-admin
‣ sqlalchemy
‣ postgres
The happify stack
‣ redis
‣ Elastic search
‣ NGINX
‣ celery
‣ gunicorn
‣ aws ec2/s3
‣ nose
‣ fabric
‣ api for mobile
‣ api for backbone
‣ backbone app bootstrapping
‣ template rendering
‣ administration ui
‣ aggregates data from postgres, redis, elasticsearch
‣ serializes context-specific object graphs
the role of flask - data switch
‣ project layout
‣ config
‣ routing setup
‣ db connection management
‣ serialization: shallow and deep
‣ FAB automation
code
‣ better config (multiple environments, config heirarchy)
‣ authentication
‣ assets pipeline
‣ model validation and serialization layer (waffling)
batteries i wish were included
batteries i could do without
‣ trailing slash redirects (but easy to control)
python 3! well, almost kinda
•flask/werkzeug support completed
•many extensions not yet
•fabric, boto, sentry ...
•too bad- unicode is a mess without it
•Handy: http://python3wos.appspot.com/
‣ flask is an excellent choice for apps like ours
‣ know what you are getting and what you aren’t, make no assumptions
‣ prepare to refactor relentlessly
‣ don’t worry that there’s no single way to do it!
conclusions
contact me:
andy parsons
andy@happify.com
@andyparsons
thank
you!

Mais conteúdo relacionado

Destaque

Python - Telegram
Python - TelegramPython - Telegram
Python - TelegramWidoyo PH
 
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...Amazon Web Services
 
Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Samuel Adams, MBA
 
Chatbot in Sale Management
Chatbot in Sale ManagementChatbot in Sale Management
Chatbot in Sale ManagementVõ Duy Tuấn
 
SF Python Meetup: TextRank in Python
SF Python Meetup: TextRank in PythonSF Python Meetup: TextRank in Python
SF Python Meetup: TextRank in PythonPaco Nathan
 
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...Amazon Web Services
 
Why Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - DeckWhy Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - DeckJan Rezab
 
Search Content vs. Social Content
Search Content vs. Social ContentSearch Content vs. Social Content
Search Content vs. Social ContentSemrush
 

Destaque (9)

Python - Telegram
Python - TelegramPython - Telegram
Python - Telegram
 
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
 
Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16
 
Chatbot in Sale Management
Chatbot in Sale ManagementChatbot in Sale Management
Chatbot in Sale Management
 
Bot Trends 2016
Bot Trends 2016Bot Trends 2016
Bot Trends 2016
 
SF Python Meetup: TextRank in Python
SF Python Meetup: TextRank in PythonSF Python Meetup: TextRank in Python
SF Python Meetup: TextRank in Python
 
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
 
Why Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - DeckWhy Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - Deck
 
Search Content vs. Social Content
Search Content vs. Social ContentSearch Content vs. Social Content
Search Content vs. Social Content
 

Mais de Andy Parsons

Open edX Conference 2014, McKinsey Academy
Open edX Conference 2014, McKinsey AcademyOpen edX Conference 2014, McKinsey Academy
Open edX Conference 2014, McKinsey AcademyAndy Parsons
 
Emotions of Startups 2014
Emotions of Startups 2014Emotions of Startups 2014
Emotions of Startups 2014Andy Parsons
 
Open Tech NYC 2013
Open Tech NYC 2013Open Tech NYC 2013
Open Tech NYC 2013Andy Parsons
 
Prince Building Tech Talk 12102012
Prince Building Tech Talk 12102012Prince Building Tech Talk 12102012
Prince Building Tech Talk 12102012Andy Parsons
 
Ga cloud scaling 3 30-2012
Ga cloud scaling 3 30-2012Ga cloud scaling 3 30-2012
Ga cloud scaling 3 30-2012Andy Parsons
 
Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons
 

Mais de Andy Parsons (6)

Open edX Conference 2014, McKinsey Academy
Open edX Conference 2014, McKinsey AcademyOpen edX Conference 2014, McKinsey Academy
Open edX Conference 2014, McKinsey Academy
 
Emotions of Startups 2014
Emotions of Startups 2014Emotions of Startups 2014
Emotions of Startups 2014
 
Open Tech NYC 2013
Open Tech NYC 2013Open Tech NYC 2013
Open Tech NYC 2013
 
Prince Building Tech Talk 12102012
Prince Building Tech Talk 12102012Prince Building Tech Talk 12102012
Prince Building Tech Talk 12102012
 
Ga cloud scaling 3 30-2012
Ga cloud scaling 3 30-2012Ga cloud scaling 3 30-2012
Ga cloud scaling 3 30-2012
 
Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011
 

Último

Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 

Último (20)

Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 

Flask NYC 09262013

  • 1. FLASK! 18 months in @ happify FLASK NYC 2013 Andy Parsons @andyparsons
  • 2. This talk FLASK NYC 2013 E x p e r i e n c e a n d L e s s o n s F l a s k @ H a p p i f y A n 1 8 - m o n t h - o l d a c t i v e F l a s k c o d e b a s e H o w I g o t t o F l a s k Flask has become a VIBRANT, ACTIVE toolkit for HTTP servers. But there aren’t a lot of large examples from which to learn. LET’S CHANGE THAT.
  • 3. Me. •startup junkie. masochist. •co-founder/CTO Happify •previously CTO Outside.in, bookish, ... •MENTOR @ seedcamp, techpeaks, 500 Startups •pragmatist •love choosing tools, Learning, making them better
  • 4. not Me. •Framework zealot •django expert (no comparisons) •IDEALIST
  • 5. what is a “microframework?” •just the essentials, nothing more •extensibility through plugins •readable source •minimal magic •easy to build a toy/demo •lack of patterns for larger projects
  • 6. FLASK NYC 2013 PROJECT LINES OF CODE COMPLEXITY Backbone.js < 1000 LOW Flask (not Werkzeug) ~2000 (?) LOW Redis 100,000 MEDIUM Django 170,000 MEDIUM MongoDB 500,000 HIGH PostgreSQL > 1,000,000 HIGH! complexity spectrum * STATS FROM OHLOH (http://www.ohloh.net/) and http://www.andreas-dewes.de/code_is_beautiful/
  • 7. ‣ java/spring/.NET ‣ a FEW rails-based startups (sinatra mixed in) ‣ scala services (scalatra, play) ‣ Python a natural fit for happify (data analysis, machine learning, nlp) ‣ flask selected as toolkit my journey to flask
  • 8. A Sampling of NYC Python A Startup Junkie's Journey to Python via Java, Ruby and Scala Andy Parsons @andyparsons My Startups and Their Stacks What Are We Building? And in general... Happiness Speed Magic Readability BUSINESS WEB API SERVICES DATABASES TEAM SIZE Pro Photo ASP.NET C#, Perl SQL Server 12 Hyperlocal Content (Geolocation ) RoR Sinatra Scala PostgreSQL, MongoDB 10 Ereading and Book Recommende r RoR Scalatra Scala/Java MongoDB 8 Life Gaming Flask Python/ Gevent Python PostgreSQL, MongoDB 3 Building Happify: Comparing Language Options SPEED CONCURRENCY TOOLING PACKAGING / DEPENDENCIES DEPLOYMENT TESTING FRAMEWORKS / LIBS RUBY SCALA PYTHON Fast enough Achieved through Process.fork Healthy, lots of choice Gems Capistrano Mature Growing collection of libs, but weak in NLP Fast! Real concurrency,Akka Still early. IDE’s weak. Complex. JARs, SBT, Ivy, Maven. ? Maturing Early for native scala libraries, rely on Java interop Fast enough Achieved through multiprocessing Healthy, lots of choice Eggs Fabric Mature Massive collection of libraries READABILITY HAPPINESS / PRODUCTIVITY COMMUNITY / ACTIVITY PROPENSITY FOR MAGIC MATURITY / STABILITY HIRING RUBY SCALA PYTHON OK. Emphasis metaprogramming can present challenges. High Huge and active Metaprogramming is sometimes abused. RoR is too magical and many imitated its philosophy Stable, but much catchup remaining for gems to support 1.9 Tough. Medium learning curve, hard to find seasoned devs Concise, expressive but NOT simple. Highly variable! Small and active Too many ways to accomplish things. Scala “implicits” encourage magic Language spec changing, breakages still occurring in dot releases Very difficult. Steep learning curve Highly readable High Big and active Explicit better than implicit Most mature here. But the 2.x/3.x break is bad. OK. Shallow learning curve. FLAME BAIT BASICS Scala Ruby Python 23 18 8 How do they “Stack” Up? Happify is an angel-funded consumer destination “life game.” HTML5, Mobile, and Facebook front ends. Currently in stealth mode. Score is based on: Green = 2 Yellow = 1 Red = 0 Python 36% Ruby 60% Scala 4% Github Project Relative % Gratuitous Perf Charts! * from: http://shootout.alioth.debian.org pycon 2012 poster
  • 9. what is happify? ‣ science of happiness ‣ positive psych trainer ‣ consumer subscription business ‣ launched in beta after 9 months ‣ ~100K users ‣ imminent public launch FLASK NYC 2013
  • 10. happify stack abbreviated biography •FEbruary 2012: james dennis @j2labs for coffee •march 2012: started coding poc (jinja templates only) •june 2012: alpha poc launched •september 2012: first real design/ux work •october 2012: backbone/coffeescript introduced •december 2013: redis added, closed beta launched •march 2013: ES added, open beta launch •june 2013: commerce, new feature set, scale up to 100K users •august 2013: ”final” design, refactoring for public launch •now: frontend and backend performance, press
  • 12. what is large? •80 views •200 templates •60 backbone views •50 models •200 tests (need more!)
  • 13. ‣ backbone.js ‣ coffeescript ‣ haml ‣ less css ‣ flask ‣ flask-admin ‣ sqlalchemy ‣ postgres The happify stack ‣ redis ‣ Elastic search ‣ NGINX ‣ celery ‣ gunicorn ‣ aws ec2/s3 ‣ nose ‣ fabric
  • 14. ‣ api for mobile ‣ api for backbone ‣ backbone app bootstrapping ‣ template rendering ‣ administration ui ‣ aggregates data from postgres, redis, elasticsearch ‣ serializes context-specific object graphs the role of flask - data switch
  • 15. ‣ project layout ‣ config ‣ routing setup ‣ db connection management ‣ serialization: shallow and deep ‣ FAB automation code
  • 16. ‣ better config (multiple environments, config heirarchy) ‣ authentication ‣ assets pipeline ‣ model validation and serialization layer (waffling) batteries i wish were included batteries i could do without ‣ trailing slash redirects (but easy to control)
  • 17. python 3! well, almost kinda •flask/werkzeug support completed •many extensions not yet •fabric, boto, sentry ... •too bad- unicode is a mess without it •Handy: http://python3wos.appspot.com/
  • 18. ‣ flask is an excellent choice for apps like ours ‣ know what you are getting and what you aren’t, make no assumptions ‣ prepare to refactor relentlessly ‣ don’t worry that there’s no single way to do it! conclusions