Monday, September 27, 2021

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

Talent is overrated, practice is what matters

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

Parnas - paper - on criteria to be used in decomposing systems into modules
|_ one of 2 most important papers

Classes should be deep 
- class is a rectangle, top edge is the interface, interface is the complexity cost. so needs to be simple
"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")
c) Substring index errors- 
 no out of index errors - just substring between my indices and string size. 
*) is it okay to crash - ans OOM errors - sure

Tactical vs Strategic programming
tactical programming is kludges to get system working - it turns to spaghetti very fast.
{tactical = driving to the gate / strategic = driving to little tibet
getting to the gate is important but no point crashing your car to get there}
tactical tornado = usually heroes in companies. but no
working code is table stakes. but it is not enough
go slower initially, invest in zero-tolerance, and strategic programming will beat tactical programming soon
startups are tactical. is a problem
you can still have a great business with crappy code. eg, Facebook

make classes more generic, wham! you get deep classes

Q&A
Hire for slope, not intercept
 |_ people who you enjoyed best in interview
Some languages lend themselves to better design

** 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

Links : 
https://sive.rs/book/TalentIsOverrated
https://web.stanford.edu/~ouster/cgi-bin/book.php
https://www.amazon.com/Software-Fundamentals-Collected-Papers-Parnas/dp/0201703696

0 Comments:

Post a Comment

<< Home