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

Pattern Language for Rubyists (Rev.2)

Pattern Language for Rubyists (Rev.2)

What is the difference between experts and beginners? How can we describe our important knowledge? This presentation introduces the pattern language and its relation to software development, then shows an example activity.

Hiroki Yoshioka

June 11, 2015
Tweet

More Decks by Hiroki Yoshioka

Other Decks in Programming

Transcript

  1. Pattern Language
    for Rubyists
    @irohiroki

    View Slide

  2. View Slide

  3. Overview
    “Pattern Language”
    Pattern Language and software
    Whether it matters to us

    View Slide

  4. @irohiroki
    "HJMFDPBDI
    8FCEFWFMPQFS
    l3BJMT%FWFMPQNFOU1BUUFSOTz
    "TJBO1-P1

    View Slide

  5. A pattern language is a method of describing
    good design practices within a field of expertise.
    – Wikipedia, “Pattern language”

    View Slide

  6. Christopher Alexander

    View Slide

  7. Quality Without A Name
    Picture by Lies Thru a Lens 

    View Slide

  8. Beyond its elements each building is defined by
    certain patterns of relationships among the the
    elements.
    –Christopher Alexander, “The Timeless Way of Building”

    View Slide

  9. “Courtyard which live”
    –Christopher Alexander et al, “A Pattern Language”

    View Slide

  10. And each law of pattern is itself a pattern of
    relationships among still other laws, which are
    themselves just patterns of relationships again.
    –Christopher Alexander, “The Timeless Way of Building”

    View Slide

  11. –Christopher Alexander, “A City is not a Tree”

    View Slide

  12. From a mathematical point of view, the simplest
    kind of language is a system which contains two
    sets:
    1. A set of elements, or symbols.
    2. A set of rules for combining these symbols.
    –Christopher Alexander, “The Timeless Way of Building”

    View Slide

  13. “Pattern Language”

    View Slide

  14. Natural Language Pattern Language
    Words Patterns
    Rules of grammar and
    meaning which give
    connections
    Patterns which specify
    connections between
    patterns
    Sentences Buildings and places
    –Christopher Alexander, “The Timeless Way of Building”

    View Slide

  15. Each pattern is a rule which describes what
    you have to do to generate the entity which it
    defines.
    –Christopher Alexander, “The Timeless Way of Building”

    View Slide

  16. Picture by Liz Castro

    View Slide

  17. View Slide

  18. The specific patterns out of which a building a town
    is made may be alive or dead. To the extent they are
    alive, they let our inner forces loose, and set us
    free; but when they are dead they keep us locked in
    inner conflict.
    –Christopher Alexander, “The Timeless Way of Building”

    View Slide

  19. Dead Pattern

    View Slide

  20. Living Pattern

    View Slide

  21. “Window Place”
    –Christopher Alexander et al, “A Pattern Language”

    View Slide

  22. View Slide

  23. 1. Independent Regions
    2. Distribution of Towns
    3. City Country Fingers
    4. Agricultural Valleys
    5. Lace of Country Streets
    6. Country Towns
    7. The Countryside
    Pattern #1~7

    View Slide

  24. 105. South Facing Outdoors
    106. Positive Outdoor Space
    107. Wings of Light
    108. Connected Buildings
    109. Long Thin House
    Pattern #105~109

    View Slide

  25. 197. Thick Walls
    198. Closets Between Rooms
    199. Sunny Counter
    200. Open Shelves
    201. Waist-high Shelf
    202. Built-in Seats
    Pattern #197~202

    View Slide

  26. You can use it to design a house for yourself, with
    your family; or to work with other people to design
    an office or a workshop or a public building like a
    school.
    –Christopher Alexander et al, “A Pattern Language”

    View Slide

  27. Back to the binary world…

    View Slide

  28. Discoverer of Pattern Language
    Kent Beck
    eXtreme Programming
    Ward Cunningham
    Wikiwiki
    “Technical debt”

    View Slide

  29. The Starting Point of Software Patterns - youtu.be/_V0kVOLOCrY

    View Slide

  30. View Slide

  31. A Small Pattern Language
    for GUI
    1. Window Per Task
    2. Few Panes Per Window
    3. Standard Panes
    4. Short Menus
    5. Nouns and Verbs

    View Slide

  32. “We presented these patterns to a team of
    application specialists writing a specification for a
    special purpose programming environment.
    Without detailed understanding of any of
    Smalltalk's interface mechanisms (MVC for
    example) they were able to specify very reasonable
    interfaces after one day of practice.”
    –Kent Beck, Ward Cunningham, “Using Pattern
    Languages for Object-Oriented Programs”

    View Slide

  33. View Slide

  34. View Slide

  35. View Slide

  36. View Slide

  37. View Slide

  38. Do you have
    a pattern language
    in your mind?

    View Slide

  39. We have written this book as a first step in the
    society-wide process by which people will gradually
    become conscious of their own pattern languages,
    and work to improve them.
    –Christopher Alexander et al, “A Pattern Language”

    View Slide

  40. View Slide

  41. @irohiroki
    @ukstudio
    @mochiz
    @tatsuoSakurai
    @kei_s
    @moro
    @ttakuru88
    @takkanm

    View Slide

  42. View Slide

  43. View Slide

  44. How we found Rails dev. patterns
    1. Kick off meeting
    2. Discuss development knacks (pristine
    “patlets”)
    3. Group patlets in KJ-method
    4. Rewrite the groups in pattern form
    5. Find sequence of patterns (WIP)
    6. Refine the patterns (WIP)

    View Slide

  45. Rails Development Patterns
    18 patlets / 6 patterns in form
    Reviewed at AsianPLoP 2015
    Work in progress on GitHub (rails-
    patterns/rails_dev_patterns)

    View Slide

  46. “ެࣜ৘ใ”

    (Official Information)
    Context: You are going to use a new or
    unfamiliar feature of Rails.
    Problem: You may copy and paste
    misinformation from the web.
    Solution: Refer the official Rails guide
    or the API reference.

    View Slide

  47. “ެવͷSQL”

    (Not-so-Secret SQL)
    Context: You are going to use an
    ActiveRecord to make a database
    query.
    Problem: You may make ineffective,
    wasteful queries.
    Solution: Confirm what SQL the
    ActiveRecord generates.

    View Slide

  48. Do you have
    a pattern language
    in your mind?

    View Slide

  49. We have written this book as a first step in the
    society-wide process by which people will gradually
    become conscious of their own pattern languages,
    and work to improve them.
    –Christopher Alexander et al, “A Pattern Language”

    View Slide

  50. Thank you!
    @irohiroki
    [email protected]

    View Slide