33
Tradeos of Replacing Core Components Andy Dai [email protected] Django Workshop 2014/1/21

Tradeoffs of replacing core components

Embed Size (px)

Citation preview

Page 1: Tradeoffs of replacing core components

Tradeoffs of Replacing Core Components

Andy Dai [email protected]

Django Workshop 2014/1/21

Page 2: Tradeoffs of replacing core components

SHOULD I SWAP OUT DJANGO TEMPLATE/ORM?

Page 3: Tradeoffs of replacing core components

DON’T DO IT!

Page 4: Tradeoffs of replacing core components

WAIT! NOT REALLY! IT’S WORTH IF…

Page 5: Tradeoffs of replacing core components

YOU ARE OKAY WITH SACRIFICING ABILITY TO USE THIRD-PARTY DJANGO PACKAGES

Page 6: Tradeoffs of replacing core components

YOU HAVE NO PROBLEM GIVING UP THE POWERFUL DJANGO ADMIN

Page 7: Tradeoffs of replacing core components

YOU HAVE ALREADY ANALYZED YOUR OWN CODE TO FIND AND FIX THE ROOT CAUSES OF YOUR PROBLEMS

Page 8: Tradeoffs of replacing core components

YOU’VE EXPLORED ALL OTHER OPTIONS INCLUDING CACHING AND DENORMALIZATION

Page 9: Tradeoffs of replacing core components

YOU’RE VERY SURE THAT YOU’RE NOT OPTIMIZING PREMATURELY

Page 10: Tradeoffs of replacing core components

YOU’RE WILLING TO ACCEPT THE FACT THAT UPGRADING DJANGO WILL BE EXTREMELY PAINFUL

Page 11: Tradeoffs of replacing core components

THINK AGAIN!

Page 12: Tradeoffs of replacing core components

OK. SO YOU WANT TO USE DJANGO WITHOUT…

Page 13: Tradeoffs of replacing core components

“Django Admin”

“Django Template”

“Django ORM”

“Django Third-Party Packages”

Page 14: Tradeoffs of replacing core components

AND YOU ADD SOME PACKAGES…

Page 15: Tradeoffs of replacing core components

“MongoEngine”

“SQLAlchemy”

“WTForms”

“Jinja2”

Page 16: Tradeoffs of replacing core components

CONGRATULATION! YOU GOT FLASK!

Page 17: Tradeoffs of replacing core components

BUT ORM/TEMPLATE SUCKS…

Page 18: Tradeoffs of replacing core components

REPLACE ORM WITH NOSQL

Page 19: Tradeoffs of replacing core components

DO NOT DO THISGUESSWEBSITE WILL GROW RAPIDLY

Page 20: Tradeoffs of replacing core components

IT’S OK IF…

Page 21: Tradeoffs of replacing core components

YOU HAVE TRIED CACHING, INDEX, QUERY OPTIMIZATION..

Page 22: Tradeoffs of replacing core components

YOU KNOW WHAT YOU ARE DOING

Page 23: Tradeoffs of replacing core components

REPLACE DJANGO TEMPLATE WITH JINJA2/MAKO

Page 24: Tradeoffs of replacing core components

DO NOT DO THISLOGIC IN YOUR TEMPLATE

Page 25: Tradeoffs of replacing core components

IT’S OK IF THERE ARE SOME PAGES

THAT

Page 26: Tradeoffs of replacing core components

ASK YOURSELF BEFORE REPLACING DJANGO TEMPLATE

Page 27: Tradeoffs of replacing core components

“Why you want to do this?”

“Where’s the bottleneck?”

“Cache?”

Page 28: Tradeoffs of replacing core components

DO IT ONLY WHEN YOU KNOW WHAT YOU ARE DOING

Page 29: Tradeoffs of replacing core components

ALWAYS USE THE RIGHT TOOL FOR THE RIGHT JOB

Page 30: Tradeoffs of replacing core components

– Donald Knuth

“Premature optimization is the root of all evil”

Page 31: Tradeoffs of replacing core components

Django/Jinja2 Integration

• Jingo - https://github.com/jbalogh/jingo

• coffin - https://github.com/coffin/coffin/

• django-jinja - https://github.com/niwibe/django-jinja

Page 32: Tradeoffs of replacing core components

Replace Django ORM

• SQLAlchemy - http://www.sqlalchemy.org/

• MongoEngine - http://mongoengine.org/

Page 33: Tradeoffs of replacing core components

THANKS!