Also, a wizard
Simon “Stinky” Willison
DjangoCon 2008 40
Python
DjangoCon 2008 41
Trendy
Google!
DjangoCon 2008 42
But not that trendy
DjangoCon 2008 43
But not that trendy
It’s no ruby
DjangoCon 2008 44
But not that trendy
It’s no ruby
Or Haskell
DjangoCon 2008 45
But not that trendy
It’s no ruby
Or Haskell
Or Erlang
DjangoCon 2008 46
But not that trendy
It’s no ruby
Or Haskell
Or Erlang
Or Scala
DjangoCon 2008 47
Significant Whitespace
DjangoCon 2008 48
DjangoCon 2008 49
Salmon
DjangoCon 2008 50
Universe of marshy force. Field sense
shallows the hatchery saying Hello,. World!.
Hydro. Power spring sometimes; snowmelt
powers snowmelt always.
DjangoCon 2008 51
DjangoCon 2008 52
No quantum
superpositions
DjangoCon 2008 53
DjangoCon 2008 54
“-”.join(array)
DjangoCon 2008 55
Restarting the server?
WTF!?
DjangoCon 2008 56
WSGIReloadMechanism
DjangoCon 2008 57
“I buy my eggs at the cheese shop”
- Aaron Straup Cope
DjangoCon 2008 58
“I buy my eggs at the cheese shop”
]
- Aaron Straup Cope
E
G
A
U
G
N
A
L
N
O
O
[M
DjangoCon 2008 59
DjangoCon 2008 60
__import__()
from future import awesome
DjangoCon 2008 61
Basically, for hippies
Scared of real
OO languages
DjangoCon 2008 62
Frameworks
DjangoCon 2008 63
Flamework is a framework
But what does that mean?
DjangoCon 2008 64
Make common tasks:
easier
faster
error-free
DjangoCon 2008 65
Show a list of photos
Write an API method
Kill all humans
DjangoCon 2008 66
Front-tier frameworks
Act as glue
DjangoCon 2008 67
Other
Data store
Services
Data Model
Business
Logic
Request Interaction
Templates
Dispatcher Logic
Framework
Users
DjangoCon 2008 68
Great for getting started
Slows you down later?
What is it doing in there?
DjangoCon 2008 69
DjangoCon 2008 70
DjangoCon 2008 71
DjangoCon 2008 72
Fast
Easy
Scalable
Flexible
DjangoCon 2008 73
Large scale
is often not a good goal
DjangoCon 2008 74
Skyscrapers are special
DjangoCon 2008 75
Regular houses
Don’t need 10 story foundations
DjangoCon 2008 76
Just build!
DjangoCon 2008 77
DjangoCon 2008 78
DjangoCon 2008 79
DjangoCon 2008 80
Everything here is possible!
We care about easy
DjangoCon 2008 81
Large Scale
DjangoCon 2008 82
No multiple DB clusters
DjangoCon 2008 83
Manual partitioning
DjangoCon 2008 84
No multiple hosts per DB
DjangoCon 2008 85
Where do we read from?
DjangoCon 2008 86
How about now?
DjangoCon 2008 87
How about now ?
DjangoCon 2008 88
Read/write consistency
DjangoCon 2008 89
Read/write consistency
LAG!!1
DjangoCon 2008 90
Good for non-writing users
(logged out)
DjangoCon 2008 91
Non time-sensitive data
Feeds
Read-only APIs
DjangoCon 2008 92
DjangoCon 2008 93
Cool kids use
master/master pairs
DjangoCon 2008 94
Consistent read/write
1. Write to side A
2. Read from side B
3. Replication occurs
4. FAIL
DjangoCon 2008 95
Consistent read/write
1. Write to side A
2. Read from side A
3. ???
4. PROFIT!!
DjangoCon 2008 96
Unreadable SQL
SELECT * FROM `app_userprofile` WHERE
`user_id` = 1
DjangoCon 2008 152
SELECT * is fast!
Faster over the wire
Faster to parse
Easier to debug
DjangoCon 2008 153
Unreadable SQL
SELECT
`app_note`.`id`,`app_note`.`type`,`app_note`.`body`,`app_note
`.`sender_id`,`app_note`.`date_sent`,`app_note`.`num_recipie
nts`,`app_note`.`recipient_type`,`app_note`.`set_id`,`app_not
e`.`direct_to_id`,`app_note`.`media_file_id`,`app_note`.`url`,`a
pp_note`.`url_inline`,`app_note`.`url_clicks`,`app_note`.`embe
d_id`,`app_note`.`event_id`,`app_note`.`is_direct`,`app_note`.`
is_public`,`app_note`.`is_deleted`,`app_note`.`is_ad`,`app_no
te`.`reply_to_id`,`app_note`.`forwarded_from_id`,`app_note`.`
original_note_id`,`app_note`.`stars`,`app_note`.`rsvp` FROM
`app_note` LEFT OUTER JOIN `app_userprofile_notes` AS
`m2m_app_note__recipients` ON `app_note`.`id` =
`m2m_app_note__recipients`.`note_id` WHERE ((NOT
(`app_note`.`is_deleted` = True)) AND
`m2m_app_note__recipients`.`userprofile_id` = 17573)
ORDER BY `app_note`.`date_sent` DESC LIMIT 16
DjangoCon 2008 154
Unreadable SQL
SELECT
n.*
FROM
app_note AS n
LEFT OUTER JOIN app_userprofile_notes AS l
ON
n.id=l.note_id
WHERE
n.is_deleted = False AND l.userprofile_id=17573
ORDER BY
n.date_sent DESC
LIMIT 16
DjangoCon 2008 155
Django makes me
scared of joins
DjangoCon 2008 156
0 comments
Post a comment