complexity
↑
• → time
↗
↗
↗
↗
↗
↗
start
working
code
↗
↗
↗
↗
start
working
code
↗ ↘
↗ ↘
↗ good
↗ code
start
↗
↗
↗
↗
↗
↗
start
Zope
↗
↗
↗
↗
↗
start
Zope
↗ ↘
↗ CherryPy
↗ Django
↗
↗
start
Zope
↗ ↘
↗ CherryPy
↗ Django
↗ ↘
↗ µ frameworks
start
Zope
↗ ↘
↗ CherryPy
↗ Django µ + ORM
↗ ↘ ⋰
↗ µ frameworks
start
Zope
↗ ↘ ↘
↗ CherryPy Pyramid
↗ Django
↗ ↘
↗ µ frameworks
start
A denormalization engine
imagine
A story
Problem:
dichotomous keys
/q ? flower=red & leaf=smooth & state=vt
? flower=red & leaf=smooth & state=vt
? flower=red & state=vt & leaf=smooth
? leaf=smooth & flower=red & state=vt
? leaf=smooth & state=vt & flower=red
? state=vt & flower=red & leaf=smooth
? state=vt & leaf=smooth & flower=red
‘f’ ≤ ‘l’ ≤ ‘s’
? flower=red & leaf=smooth & state=vt
GET /q?state=vt&flower=red HTTP/1.1
Host: gobotany.newfs.org
↓
HTTP/1.1 301 Moved Permanently
Location: /q?flower=red&state=vt
HTTP/1.1 404 Not Found
Cache-control: max-age=3600
HTTP/1.1 301 Moved Permanently
Location: /q?flower=red&state=vt
Cache-control: max-age=3600
? flower=red & leaf=smooth & state=vt
step back
? flower=red & leaf=smooth & state=vt
3 phases
SELECT *
FROM plant_feature f1
JOIN plant_feature f2 ON plant_id
JOIN plant_feature f3 ON plant_id
WHERE f1 = 'form=tree'
AND f2 = 'leaf=smooth'
AND f3 = 'state=vt'
plant_feature
-----------------------------
Acer rubrum form=tree
Acer rubrum leaves=fall
Acer rubrum twig=gray
Acer rubrum twig=red
Acer saccharinum form=tree
Acer saccharinum leaves=fall
⋮
plant list
FROM plant_feature f1
... WHERE f1 = 'form=tree'
Acer rubrum form=tree
Acer saccharinum form=tree
⋮
intersection
pivot
/api/feature/leaf_edge
{'smooth': {'text': 'Smooth leaves',
'plants': [13, 15, 16, …]},
'serrated': {'text': 'Jagged leaves',
'plants': [3, 14, 17, …]},
'lobed': {'text': 'Lobed leaves',
'plants': [6, 7, 8, 10, …]}}
_.intersection(a1, a2, a3)
? flower=red & leaf=smooth & state=vt
/api/feature/flower
/api/feature/leaf
/api/feature/state
person[person.age >= 21]
person[person.age >= 21]
↓
SELECT * FROM person p
WHERE p.age >= 21;
person[person.age >= 21]
↓
db.people.find({age: {$gte: 21}})
code ↔ data