Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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.

Lacey Williams Henschel

October 06, 2018
Tweet

More Decks by Lacey Williams Henschel

Other Decks in Technology

Transcript

  1. What if Jane Austen
    had been an engineer?
    Lacey Williams Henschel
    PyGotham 2018
    !
    @laceynwilliams | @revsys

    View Slide

  2. @laceynwilliams | @revsys

    View Slide

  3. @laceynwilliams | @revsys

    View Slide

  4. I read it immediately and with
    great pleasure.
    — Jane Austen
    @laceynwilliams | @revsys

    View Slide

  5. @laceynwilliams | Source: Django

    View Slide

  6. @laceynwilliams | Source: Django docs

    View Slide

  7. @laceynwilliams | Source: Django Girls

    View Slide

  8. @laceynwilliams | Source: REVSYS

    View Slide

  9. @laceynwilliams | Source: StackOverflow

    View Slide

  10. @laceynwilliams | Source: GitHub

    View Slide

  11. preface
    "They all paint tables, cover screens, and net
    purses."
    -- Charles Bingley
    @laceynwilliams | @revsys

    View Slide

  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

    View Slide

  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

    View Slide

  14. If someone has skills in
    ✦ music
    ✦ languages
    ✦ miscellaneous other skills
    ✦ nonspecific "person" skills
    then they are accomplished.
    @laceynwilliams | @revsys

    View Slide

  15. Chapter One
    Planning
    @laceynwilliams | @revsys

    View Slide

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

    View Slide

  17. @laceynwilliams | Source: PyCon 2015 & Django

    View Slide

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

    View Slide

  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

    View Slide

  20. Chapter Two
    Wri$ng chapters, not epics
    @laceynwilliams | @revsys

    View Slide

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

    View Slide

  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

    View Slide

  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

    View Slide

  24. When a sentence is made stronger,
    it usually becomes shorter.
    — Strunk & White, The Elements of Style
    @laceynwilliams | @revsys

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  28. Chapter Three
    Wri$ng well
    @laceynwilliams | @revsys

    View Slide

  29. Your code communicates; you control how well
    it does that.
    @laceynwilliams | @revsys

    View Slide

  30. Simple is be*er than complex.
    Sparse is be*er than dense.
    Readability counts.
    -- Tim Peters, The Zen of Python
    @laceynwilliams | @revsys

    View Slide

  31. ... your descriptions are often
    more minute than will be
    liked...
    — Jane Austen
    @laceynwilliams | @revsys

    View Slide

  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

    View Slide

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

    View Slide

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

    View Slide

  35. Chapter Four
    Understanding plot
    @laceynwilliams | @revsys

    View Slide

  36. @laceynwilliams | Source: Wikipedia

    View Slide

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

    ,
    %4*
    4.
    )*
    ,
    #4(
    5.
    )4$
    @laceynwilliams | @revsys

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  42. denouement
    >>> mr_wickham.is_accomplished()
    False
    >>> elizabeth_bennett.is_accomplished()
    True
    @laceynwilliams | @revsys

    View Slide

  43. Chapter Five
    Character development
    @laceynwilliams | @revsys

    View Slide

  44. Everything we do involves reading and wri2ng.
    Everything we read and write involves other
    people.
    @laceynwilliams | @revsys

    View Slide

  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

    View Slide

  46. !
    github.com/williln/djane-austen
    !
    @laceynwilliams
    !
    [email protected]
    !
    revsys.com
    !
    laceyhenschel.com
    @laceynwilliams | @revsys

    View Slide