What if Jane Austen had been an engineer?

What if Jane Austen had been an engineer?

As a developer with two English degrees, over the years I’ve identified some concrete ways this education makes me a better developer. This talk will discuss how we can take lessons from literature to write more readable code, make better tests, and create more usable websites. At the end of the day, after all, our job is to write. Surely the techniques of great writers have something to teach us.

In this humanities-based talk, you’ll learn about Freytag’s pyramid and what it has to do with writing clean code, why writing those dastardly outlines before your term papers helped prepare you for your job as an engineer, and see for yourself how The Zen of Python is basically a modern retelling of Strunk and White’s classic Elements of Style. You will leave inspired to go read your favorite book to get some tips for your next project.

2c7f0a1020fbd01942166122190180f8?s=128

Lacey Williams Henschel

October 06, 2018
Tweet

Transcript

  1. What if Jane Austen had been an engineer? Lacey Williams

    Henschel PyGotham 2018 ! @laceynwilliams | @revsys
  2. @laceynwilliams | @revsys

  3. @laceynwilliams | @revsys

  4. I read it immediately and with great pleasure. — Jane

    Austen @laceynwilliams | @revsys
  5. @laceynwilliams | Source: Django

  6. @laceynwilliams | Source: Django docs

  7. @laceynwilliams | Source: Django Girls

  8. @laceynwilliams | Source: REVSYS

  9. @laceynwilliams | Source: StackOverflow

  10. @laceynwilliams | Source: GitHub

  11. preface "They all paint tables, cover screens, and net purses."

    -- Charles Bingley @laceynwilliams | @revsys
  12. "... thorough knowledge of music, singing, drawing, dancing, and the

    modern languages, to deserve the word; and besides all this, she must possess a certain something in her air and manner of walking, the tone of her voice, her address and expressions, or the word will be but half-deserved." -- Caroline Bingley @laceynwilliams | @revsys
  13. "All this she must possess, and to all this she

    must yet add something more substan6al, in the improvement of her mind by extensive reading." -- Fitzwilliam Darcy @laceynwilliams | @revsys
  14. If someone has skills in ✦ music ✦ languages ✦

    miscellaneous other skills ✦ nonspecific "person" skills then they are accomplished. @laceynwilliams | @revsys
  15. Chapter One Planning @laceynwilliams | @revsys

  16. @laceynwilliams | Source: J.K. Rowling via Endpaper & Andrew Godwin

  17. @laceynwilliams | Source: PyCon 2015 & Django

  18. Namespaces are one honking great idea. — Tim Peters @laceynwilliams

    | @revsys
  19. todo: 1.Have a Person 2.Let that person have skills 3.Decide

    if they are skilled in specific areas 4.Decide, based on their skills, on their overall "accomplished" status @laceynwilliams | @revsys
  20. Chapter Two Wri$ng chapters, not epics @laceynwilliams | @revsys

  21. write one scene at a time @laceynwilliams | @revsys

  22. from django.db import models class Person(models.Model): music = models.BooleanField(default=False) singing

    = models.BooleanField(default=False) drawing = models.BooleanField(default=False) dancing = models.BooleanField(default=False) modern_languages = models.BooleanField(default=False) nonspecific_air = models.BooleanField(default=False) good_walker = models.BooleanField(default=False) good_tone = models.BooleanField(default=False) address_expression = models.BooleanField(default=False) reader = models.BooleanField(default=False) # add more as we need them @laceynwilliams | @revsys
  23. from django.db import models class Person(models.Model): ... def is_accomplished(self): return

    ( self.music and self.singing and self.drawing and self.dancing and self.modern_languages and self.nonspecific_air and self.good_walker and self.good_tone and self.address_expression and self.reader # etc. ) @laceynwilliams | @revsys
  24. When a sentence is made stronger, it usually becomes shorter.

    — Strunk & White, The Elements of Style @laceynwilliams | @revsys
  25. from django.db import models class Accomplishment(models.Model): MUSICAL = 0 LINGUISTIC

    = 1 OTHER = 2 ACCOMPLISHMENT_TYPES = ( (MUSICAL, 'Musical'), (LINGUISTIC, 'Linguistic'), (OTHER, 'Other') ) name = models.CharField(max_length=100) accomplishment_type = models.IntegerField( choices=ACCOMPLISHMENT_TYPES ) @laceynwilliams | @revsys
  26. from django.contrib.auth import get_user_model from django.db import models from accomplishments.models

    import Accomplishment User = get_user_model() class Person(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) accomplishments = models.ManyToManyField( Accomplishment, related_name='people' ) @laceynwilliams | @revsys
  27. class Person(models.Model): @property def is_accomplished(self): return ( self.is_musically_skilled() and self.is_linguistically_skilled()

    and self.is_otherwise_accomplished() and self.is_something_in_air() #returns True ) @laceynwilliams | @revsys
  28. Chapter Three Wri$ng well @laceynwilliams | @revsys

  29. Your code communicates; you control how well it does that.

    @laceynwilliams | @revsys
  30. Simple is be*er than complex. Sparse is be*er than dense.

    Readability counts. -- Tim Peters, The Zen of Python @laceynwilliams | @revsys
  31. ... your descriptions are often more minute than will be

    liked... — Jane Austen @laceynwilliams | @revsys
  32. class Person(models.Model): @property def is_accomplished(self): return ( self.is_musically_skilled() and self.is_linguistically_skilled()

    and self.is_otherwise_accomplished() and self.is_something_in_air() ) @laceynwilliams | @revsys
  33. class Person(models.Model): def is_musically_accomplished(self): return self.get_musical_accomplishment_count() >= 3 @laceynwilliams |

    @revsys
  34. class Person(models.Model): def get_musical_accomplishments_count(self): return self.accomplishments.filter( accomplishment_type=Accomplishment.MUSICAL ).count() @laceynwilliams |

    @revsys
  35. Chapter Four Understanding plot @laceynwilliams | @revsys

  36. @laceynwilliams | Source: Wikipedia

  37. 1. !"#$%&' () * 2. +, , #➕( = .

    , $➕) = , 3. )2$ = ⛔ , %4* 4. )* , #4( 5. )4$ @laceynwilliams | @revsys
  38. exposition class Person(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) accomplishments = models.ManyToManyField(

    Accomplishment, related_name='people' ) def is_musically_accomplished(self): return self.get_musical_accomplishments() >= 3 @laceynwilliams | @revsys
  39. rising action class Person(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) accomplishments =

    models.ManyToManyField( Accomplishment, related_name='people' ) def is_musically_accomplished(self): return self.get_musical_accomplishments() >= 3 @laceynwilliams | @revsys
  40. climax class Person(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) accomplishments = models.ManyToManyField(

    Accomplishment, related_name='people' ) def is_musically_accomplished(self): return self.get_musical_accomplishments() >= 3 @laceynwilliams | @revsys
  41. falling action class Person(models.Model): @property def is_accomplished(self): return ( self.is_musically_skilled()

    and self.is_linguistically_skilled() and self.is_otherwise_accomplished() and self.is_something_in_air() ) @laceynwilliams | @revsys
  42. denouement >>> mr_wickham.is_accomplished() False >>> elizabeth_bennett.is_accomplished() True @laceynwilliams | @revsys

  43. Chapter Five Character development @laceynwilliams | @revsys

  44. Everything we do involves reading and wri2ng. Everything we read

    and write involves other people. @laceynwilliams | @revsys
  45. It is only a program... or, in short, only some

    work in which the greatest powers of the mind are displayed... in the best-chosen language, Python. — Jane Austen, probably @laceynwilliams | Source: Susan Yin
  46. ! github.com/williln/djane-austen ! @laceynwilliams ! lacey@revsys.com ! revsys.com ! laceyhenschel.com

    @laceynwilliams | @revsys