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

Jane Austen on PEP8: An English Major's Tips on Writing Better Code

Jane Austen on PEP8: An English Major's Tips on Writing Better Code

Jane Austen said, “It is a truth universally acknowledged, that a single module in possession of a good function, must be in want of a test.” In this talk, we’ll discover how writing tips from your Comp 101 class can make your code cleaner and clearer. Both programming and English value ruthless editing, clear and concise communication, and continuously researching new ideas to refine work.

Presented at DjangoCon US 2015. Video: https://www.youtube.com/watch?v=55gXwFviOuQ

Lacey Williams Henschel

September 08, 2015
Tweet

More Decks by Lacey Williams Henschel

Other Decks in Technology

Transcript

  1. Jane Austen on PEP8:
    An English Major’s Tips for
    Writing Better Code
    Lacey Williams Henschel
    @laceynwilliams

    View Slide

  2. I must learn to be
    content with being
    happier than I
    deserve.

    View Slide

  3. View Slide

  4. View Slide

  5. Always use two spaces
    after a sentence-ending
    period.

    View Slide

  6. Exposition
    Climax
    Denouement
    Rising A
    ction
    Falling A
    ction

    View Slide

  7. Exposition
    Climax
    Denouement
    Rising A
    ction
    Falling A
    ction
    This is Edith.

    View Slide

  8. Exposition
    Climax
    Denouement
    Rising A
    ction
    Falling A
    ction
    She’s using an
    app.

    View Slide

  9. Exposition
    Climax
    Denouement
    Rising A
    ction
    Falling A
    ction
    She enters an
    item into the
    app.

    View Slide

  10. Exposition
    Climax
    Denouement
    Rising A
    ction
    Falling A
    ction
    The item saves.

    View Slide

  11. Exposition
    Climax
    Denouement
    Rising A
    ction
    Falling A
    ction
    Edith closes the
    app, happy.

    View Slide

  12. AssertionError: False is not true.

    View Slide

  13. AssertionError: False is not true.
    Dear reader,
    We regret that an error has been made.
    Warmly,
    The programmers

    View Slide

  14. View Slide

  15. View Slide

  16. View Slide

  17. View Slide

  18. Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    - Excerpt from The Zen of Python, Tim Peters.

    View Slide

  19. I dipped my pen, and began to write the lines that
    must be there, for the sake of the unknown physician
    who would follow me.
    Diana Gabaldon, The Fiery Cross

    View Slide

  20. Omit needless words.

    View Slide

  21. Simple is better than complex.

    View Slide

  22. Vigorous writing is concise.

    View Slide

  23. Sparse is better than dense.

    View Slide

  24. Programmer
    Writer

    View Slide

  25. Sources
    The Freer Biblical Manuscripts: Fresh Studies of an American
    Treasure Trove, ed. Larry W. Hurtado. TEI and transcript.
    Jane Austen with Laptop. The Boston Globe, Aug. 17, 2009.
    Test-Driven Development with Python, Harry Percival.
    Purdue University Online Writing Lab, sample outline.
    View function from Django Girls code.
    Emily Dickinson’s handwritten coconut cake recipe, by Garrett
    Ziegler.

    View Slide

  26. Sources
    The Zen of Python, Tim Peters.
    The Fiery Cross, Diana Gabaldon.
    The Elements of Style, William Strunk, Jr., and E. B. White.

    View Slide