$30 off During Our Annual Pro Sale. View details »

The Scientist & The Engineer

The Scientist & The Engineer

My keynote from PyCon Colombia 2020.

Andrew Godwin

February 07, 2020

More Decks by Andrew Godwin

Other Decks in Programming



  2. Hi, I’m Andrew Godwin

  3. I call myself an "engineer"

  4. But I studied Computer Science

  5. I knew programming going in. But this was different.

  6. “ Edsger Dijkstra Computer science is no more about computers

    than astronomy is about telescopes.
  7. Computer Science is idealistic

  8. "Turing-complete"

  9. We first want to prove it is possible

  10. async def sleep_sort(numbers): async def sleep_add(number): await asyncio.sleep(number) result.append(number) result

    = [] await asyncio.wait([ sleep_add(number) for number in numbers ]) return result
  11. We can prove that programs are correct

  12. def is_two(number): return number == 2

  13. >>> import __builtin__ >>> __builtin__.True = False >>> True False

    >>> True == False True (Thankfully, only works in Python 2!)
  14. "Communicating Sequential Processes", C. A. R Hoare

  15. contains :: (Ord a) => (Tree a) -> a ->

    Bool contains Nil _ = False contains (Node t1 v t2) x | x == v = True | x < v = contains t1 x | x > v = contains t2 x
  16. A perfect world, of perfect programs

  17. “ Benjamin Brewster In theory there is no difference between

    theory and practice. In practice there is.
  18. Software Engineering takes shortcuts

  19. When is it safe to take a risk?

  20. None
  21. Software is faster and cheaper to change

  22. The real world is a nasty place

  23. How often does a cosmic ray affect RAM? 36 hours

    (for 16GB; "SEU at Ground Level", Eugene Normand) How long can an unpowered SSD keep data? 3 weeks - 1 year (Enterprise at 40ºC, Client at 30ºC; Intel/JEDEC) Does quantum tunneling affect CPUs? Continuously!
  24. Always design for failure

  25. How do we reason about software?

  26. Input Process Output

  27. async def disable_alarm(): ... async def open_door(): ... await asyncio.wait(

    [disable_alarm(), open_door()] )
  28. Input Rendering Output Validation Reporting Storage Processing Logging Cache

  29. Django has 250,000 lines of code

  30. An Airbus A380 has 4,000,000 parts

  31. A new car has 100,000,000 lines of code

  32. How are we supposed to handle this?

  33. Abstract, verify and forget

  34. Abstract Define a contract - types, behaviour, exceptions Verify Write

    tests to keep the contract valid Forget Work with the contract, not the fine details
  35. You have to learn to forget

  36. Engineering is communication

  37. “ Grace Hopper A ship in port is safe, but

    that's not what ships are built for.
  38. Build to expect growth

  39. Build to expect failure

  40. Everyone can build near-perfect software

  41. Know when not to!

  42. Python lets you do both.

  43. Types Start without types, progressively add with mypy Async Make

    it work synchronously first. Add async later. Speed Write slow, understandable code. Test it. Then improve it.
  44. Scientists observe and question

  45. Engineers build and invent

  46. All software has consequences

  47. Be the scientist and the engineer

  48. Gracias. Andrew Godwin @andrewgodwin // aeracode.org