John Ousterhout - Philosophy of Design - talk at google - notes
https://www.youtube.com/watch?v=bmSAYlu0NcY
Design is the most important. Yet it is not taught . Can it be taught ?
Most important aspect of design = problem decomposition
CS190 at Stanford - iterative - write, get feedback, write
1. Students build largest system they can think of in 3 weeks ~ 3k lines
2. Code reviews
3. Write some more code , repeat
|_ one of 2 most important papers
Classes should be deep
"classes and methods should be small " leads to 'classitis'. abstraction is important not length
unix file IO . the complete interface = 5 functions.
Define errors out of existence
Define semantics so that there are no errors there, limit places where exceptions are handled
three examples -
a) Tk - unset a non existing variable - fail silently
b) Not allowing delete when writing going on - correct answer - unix - delete from directory entry, but keep contents so that working process finish, then when last fd is closed throw away file
Worst solution - remove the file when deleted, so now all other processes will have to handle an exception of what to in the middle of their write (what DO you do? how DO you code for such a possibility other than throw an error saying "i have no idea what to do, it's so wtf ,so exiting")
*) is it okay to crash - ans OOM errors - sure
Tactical vs Strategic programming
make classes more generic, wham! you get deep classes
Q&A
** secrets, principles no recipes FULL LIST **
- working code isn't enough, must minimise complexity
- complexity comes from dependencies and obscurity
- strategic vs tactical programming
- classes should be deep
- general purpose classes are deeper
- new layer, new abstraction
- comments for things not obvious
- define errors out of existence
- pull complexity downwards