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.

Tradeoffs of replacing core components

948 views

Published on

  • Be the first to comment

  • Be the first to like this

Tradeoffs of replacing core components

  1. 1. Tradeoffs of Replacing Core Components Andy Dai andy@dorm7.com Django Workshop 2014/1/21
  2. 2. SHOULD I SWAP OUT DJANGO TEMPLATE/ORM?
  3. 3. DON’T DO IT!
  4. 4. WAIT! NOT REALLY! IT’S WORTH IF…
  5. 5. YOU ARE OKAY WITH SACRIFICING ABILITY TO USE THIRD-PARTY DJANGO PACKAGES
  6. 6. YOU HAVE NO PROBLEM GIVING UP THE POWERFUL DJANGO ADMIN
  7. 7. YOU HAVE ALREADY ANALYZED YOUR OWN CODE TO FIND AND FIX THE ROOT CAUSES OF YOUR PROBLEMS
  8. 8. YOU’VE EXPLORED ALL OTHER OPTIONS INCLUDING CACHING AND DENORMALIZATION
  9. 9. YOU’RE VERY SURE THAT YOU’RE NOT OPTIMIZING PREMATURELY
  10. 10. YOU’RE WILLING TO ACCEPT THE FACT THAT UPGRADING DJANGO WILL BE EXTREMELY PAINFUL
  11. 11. THINK AGAIN!
  12. 12. OK. SO YOU WANT TO USE DJANGO WITHOUT…
  13. 13. “Django Admin” “Django Template” “Django ORM” “Django Third-Party Packages”
  14. 14. AND YOU ADD SOME PACKAGES…
  15. 15. “MongoEngine” “SQLAlchemy” “WTForms” “Jinja2”
  16. 16. CONGRATULATION! YOU GOT FLASK!
  17. 17. BUT ORM/TEMPLATE SUCKS…
  18. 18. REPLACE ORM WITH NOSQL
  19. 19. DO NOT DO THIS GUESS WEBSITE WILL GROW RAPIDLY
  20. 20. IT’S OK IF…
  21. 21. YOU HAVE TRIED CACHING, INDEX, QUERY OPTIMIZATION..
  22. 22. YOU KNOW WHAT YOU ARE DOING
  23. 23. REPLACE DJANGO TEMPLATE WITH JINJA2/MAKO
  24. 24. DO NOT DO THIS LOGIC IN YOUR TEMPLATE
  25. 25. IT’S OK IF THERE ARE SOME PAGES THAT
  26. 26. ASK YOURSELF BEFORE REPLACING DJANGO TEMPLATE
  27. 27. “Why you want to do this?” “Where’s the bottleneck?” “Cache?”
  28. 28. DO IT ONLY WHEN YOU KNOW WHAT YOU ARE DOING
  29. 29. ALWAYS USE THE RIGHT TOOL FOR THE RIGHT JOB
  30. 30. “Premature optimization is the root of all evil” – Donald Knuth
  31. 31. Django/Jinja2 Integration • Jingo - https://github.com/jbalogh/jingo • coffin - https://github.com/coffin/coffin/ • django-jinja - https://github.com/niwibe/django-jinja
  32. 32. Replace Django ORM • SQLAlchemy - http://www.sqlalchemy.org/ • MongoEngine - http://mongoengine.org/
  33. 33. THANKS!

×