Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PHP to Python with No Regrets


Published on

Published in: Technology
  • Be the first to comment

PHP to Python with No Regrets

  1. 1. PHP to Python:No RegretsThe Grass Is Always Greener Alex Ezell Emma July 31, 2011
  2. 2. the on e on th e left.Hi, I’m
  3. 3. The bloodiest wars in history have been religious wars. -Richard M. Nixon
  4. 4. Why did we change? How did we change? Would I do it all again? What did we learn?
  5. 5. Why did we change?
  6. 6. Change Is What We Do
  7. 7. Big, Hairy Ass Goals Rewrite the platform incrementally Provide a world-class customer API Reexamine every tool Quadruple the tech team Lead instead of follow
  8. 8. OpportunityMajor push from the business for new features moreoften and the freedom to make that happenTeam growthStability and agreement in other areas: infrastructure,strategic planning, etc.Developer desire - we simply wanted more.Necessity with regards to current codebase
  9. 9. Code Unity / ManagementLots of background, server processes managing partsof our application. Desire for code in backgroundprocesses to more closely resemble application codeThreading, decoupling, and queueing.Third-party mailer integration.Several small teams working on a single project.
  10. 10. Modernizing Our ToolsetHomegrown PHP Web Framework -> DjangoPEAR_DB -> SQLAlchemyApache -> WSGINo Testing/Docs -> nose and SphinxCVS Update -> Fabric Deploys of Git Repo
  11. 11. Why Python?Maturity and capabilityEase of use / Powerful / Low learning curveRapid developmentFuture of the technologyEcosystem of tools
  12. 12. How did we change?
  13. 13. Revolution or Evolution? Stop for a full rewrite and not have something compelling when you reboot No new features while the rewrite occurs Inability to really beta test new stuff Fairly entrenched customer base Competition is innovating quickly
  14. 14. Service APIScalability, Speed, Fault-tolerant, Easy DeploymentCollection of Python WSGI AppsDelayed processes, log readers, and queue consumersNew structure for all business logicSmaller, tighter codebase - Easier to build onPublic API is just a wrapperHeavy use of Redis
  15. 15. Module Fiesta accounts tantuclient tantu audiencequeueworkers jumper dbsession logparser graffiti
  16. 16. Learn the Python Ecosystem Fabric==1.1.2 meld3==0.6.7 Jinja2==2.5.5 nose==1.0.0 Pygments==1.4 paramiko== SQLAlchemy==0.7.0 psycopg2==2.4.1 Sphinx==1.0.7 pycrypto==2.3 Tempita==0.5.1 redis==2.0.0 WebOb==1.0 requests==0.5.0 WebTest==1.2.2 setproctitle==1.1 coverage==3.4 supervisor==3.0a10 decorator==3.3.1 wsgiref==0.1.2 distribute==0.6.16 yoyo-migrations==4.1.0 docutils==0.7
  17. 17. Testing! Testing! Testing! nose, WebOb, WebTest Rapid iteration Distributed team No testing of the Django app piece
  18. 18. Session HandlingLet PHP continue to handle session authenticationTeach Python how to read/write PHP serialization usingScott Hurring’s code: has built-in memcache support, so we makePHP save sessions in memcache
  19. 19. Gotta Get That DataPEAR_DB handled all queries and the databaseconnection with hand-written SQLMoving to multi-database, sharded model - handleconnections seamlesslyHandle different types of encoding seamlesslyRewrite all queries in SQLAlchemy from straight SQL
  20. 20. The Campaign Edit Example2600 lines of code to 700Exact same functionality including some additional stuffNumber of database queries stayed close to the sameVery Javascript heavy, so changes might not be asextensive as other sections
  21. 21. What did we learn?
  22. 22. What We LearnedWe don’t really need a web frameworkDjango is awesome, so is Flask, so is WSGIgit is invaluable for distributed teams on big projectsEasy deployment is vitalData encoding sucks and is hardTimezone handling sucks and is hard
  23. 23. What We LearnedPHP frameworks (CakePHP and Symfony) have comea long way and are on par with DjangoThe shift to sqlalchemy has provided lots of challengesDjango template parsing can be slow in certainsituationsHiring Python developers can be tough, especially inNashvilleJuggling multiple systems is fraught with danger
  24. 24. What We LearnedIncremental rewrites are technically more difficultStarting from scratch would have left us lost in themarketplaceMany of our problems had nothing to do with languagechoice or tools or frameworks
  25. 25. Learning a New LanguagePorting is badBad habits are easy to break in Python, though notunavoidablePython’s interactive interpreter makes tinkering easyEvery developer learns in unique ways and at differentratesReading great code
  26. 26. Would I do it all again?
  27. 27.
  28. 28. Positives Codebase is becoming more standardized Developer energy is high Features we have implemented have turned out well and been easy to add functionality to Python’s standard library offers powerful, quality add- on modules for free Developers we have hired have been able to contribute quickly and be impactful
  29. 29. Many of us crucify ourselvesbetween two thieves - regret forthe past and fear of the future. - Fulton Oursler
  30. 30. We’re Launching It Sept.1
  31. 31. Contact Me Email: Twitter: @aezellisdead or @emmaemailtech
  32. 32. We Are Hiring at EmmaHappy Hour Tonight at EddieGeorge’s Grill from 6-8pm alex@myemma.comTwitter: @aezellisdead or@emmaemailtech
  33. 33. Photo CreditsNixon - BusinessWeek: - Annan - - boy -