33
Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Embed Size (px)

Citation preview

Page 1: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Exploring design space with Interactive pattern storiesJames Siddle, Kevlin Henney

Exploring design space with Interactive pattern storiesJames Siddle, Kevlin Henney

ACCU 2009ACCU 2009

Page 2: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

AgendaAgenda

Workshop purposeConcepts

Patterns, languages, sequences, stories

Introduction to interactive pattern stories

Interactive sessionIntroductionBreak out groupsSummary

Workshop purposeConcepts

Patterns, languages, sequences, stories

Introduction to interactive pattern stories

Interactive sessionIntroductionBreak out groupsSummary

Page 3: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Workshop purposeWorkshop purpose

Input to book writing effortGather feedback

what was learned from interactive stories

format likes/dislikesGenerate ideas

alternative story pathsideas for other pattern-based

interactive stories

Input to book writing effortGather feedback

what was learned from interactive stories

format likes/dislikesGenerate ideas

alternative story pathsideas for other pattern-based

interactive stories

Page 4: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Note on use of feedbackNote on use of feedback

Please:don’t divulge anything unless you’re

happy for it to be used in the bookno confidential or sensitive information

Workshop attendees will be acknowledgedWill make specific acknowledgements

if requestedCorrection to printed materials

J. Siddle representing himself, not IBM

Please:don’t divulge anything unless you’re

happy for it to be used in the bookno confidential or sensitive information

Workshop attendees will be acknowledgedWill make specific acknowledgements

if requestedCorrection to printed materials

J. Siddle representing himself, not IBM

Page 5: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Patterns, languages, sequences, storiesKevlin Henney

Patterns, languages, sequences, storiesKevlin Henney

ACCU 2009ACCU 2009

Page 6: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

PatternsPatterns

Patterns capture recurring problem–solution pairs with respect to contextA pattern is named and contributes to

design vocabularyA problem is characterised in terms of

forces and the solution offers an approach with consequences (both pros and cons)

A pattern represents a design decision, whether conscious or not, explicit or not

Patterns capture recurring problem–solution pairs with respect to contextA pattern is named and contributes to

design vocabularyA problem is characterised in terms of

forces and the solution offers an approach with consequences (both pros and cons)

A pattern represents a design decision, whether conscious or not, explicit or not

Page 7: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Pattern StoriesPattern Stories

A pattern story brings out the sequence of patterns used in a design exampleThey capture the conceptual

narrative behind a given piece of design, whether from a system in production or an illustrative example

Forces and consequences are played out in order, each decision illustrated concretely

A pattern story brings out the sequence of patterns used in a design exampleThey capture the conceptual

narrative behind a given piece of design, whether from a system in production or an illustrative example

Forces and consequences are played out in order, each decision illustrated concretely

Page 8: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

JUnit StoryboardJUnit Storyboard

Page 9: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

POSA4 Warehouse StoryPOSA4 Warehouse Story

Page 10: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Pattern SequencesPattern Sequences

A pattern sequence captures the underlying narrative behind a storyA sequence can be described and

applied independent of a pattern storyPattern sequences focus on

incremental developmentPattern compounds are examples of

named, short sequencesE.g., MVC, Interpreter, Pluggable

Factory

A pattern sequence captures the underlying narrative behind a storyA sequence can be described and

applied independent of a pattern storyPattern sequences focus on

incremental developmentPattern compounds are examples of

named, short sequencesE.g., MVC, Interpreter, Pluggable

Factory

Page 11: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

JUnit Storyboard DistilledJUnit Storyboard Distilled

JUnit storyboard can be summarised as a pattern sequenceI.e., Command, Template Method,

Collecting Parameter, Class Adapter, Pluggable Selector, Composite

A summary of the sequence does not show how roles interactE.g., what classes play what roles in

Composite

JUnit storyboard can be summarised as a pattern sequenceI.e., Command, Template Method,

Collecting Parameter, Class Adapter, Pluggable Selector, Composite

A summary of the sequence does not show how roles interactE.g., what classes play what roles in

Composite

Page 12: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Batch IteratorBatch Iterator

A Batch Iterator is an Iterator that uses a Batch Method to express pullGood for collection access in high-

latency environments, e.g., distributed systems

A Batch Iterator is an Iterator that uses a Batch Method to express pullGood for collection access in high-

latency environments, e.g., distributed systemstypedef sequence<any> many;

interface SomeBatchIterator{ boolean next_n(in unsigned long how_many, out many result); boolean skip_n(in unsigned long how_many);};

typedef sequence<any> many;interface SomeBatchIterator{ boolean next_n(in unsigned long how_many, out many result); boolean skip_n(in unsigned long how_many);};

Page 13: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Pattern LanguagesPattern Languages

A pattern language connects many patterns togetherIt captures connections and possibilities

between different patterns, including alternatives, options and necessary steps

There may be many possible and practical sequences through a languageIn the limit, a lone pattern sequence can

be considered a narrow pattern language

A pattern language connects many patterns togetherIt captures connections and possibilities

between different patterns, including alternatives, options and necessary steps

There may be many possible and practical sequences through a languageIn the limit, a lone pattern sequence can

be considered a narrow pattern language

Page 14: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

STL PatternsSTL PatternsAlgorithm–Algorithm–

Representation Representation SeparationSeparation

ContainerContainerStreamStream

IteratorIterator

Half-Open Half-Open Iteration RangeIteration RangeCounted Counted

Iteration RangeIteration RangePast-the-Past-the-End ValueEnd Value

Pointer Pointer ProtocolProtocol

Smart Smart PointerPointer

Categorised Categorised ProtocolProtocol

Pluggable Pluggable TypeType

Pluggable Pluggable ObjectObject

Encapsulated Encapsulated AlgorithmAlgorithm

Container-Container-Encapsulated Encapsulated

AlgorithmAlgorithmCopied Copied ValueValue

constconst IteratorIterator

AdaptorAdaptor

Deduction Deduction HelperHelper

Tagged Tagged CategoryCategory

Tagged Tagged OverloadOverload

Nested Nested TraitTrait

Traits Traits HolderHolder

TraitsTraitsBase ClassBase Class

Trait-LookupTrait-LookupTemplateTemplate

Function Function ObjectObject

Page 15: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Context EncapsulationContext Encapsulation

Decoupled Context Interface

Role-Specific Context Object

Encapsulated Context Object

Role-Partitioned Context

ECOECO

ECO, DCIECO, DCI

ECO, DCI, RPCECO, DCI, RPC

ECO, DCI, RPC, RSCOECO, DCI, RPC, RSCO

ECO, RPC, DCIECO, RPC, DCI

ECO, RPC, DCI, RSCOECO, RPC, DCI, RSCO

ECO, RPC, RSCOECO, RPC, RSCO

ECO, RPC, RSCO, DCIECO, RPC, RSCO, DCI

Page 16: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

DesignDesign

As a noun, design is the named (although sometimes unnameable) structure or behavior of a system whose presence resolves or contributes to the resolution of a force or forces on that system. A design thus represents one point in a potential decision space. A design may be singular (representing a leaf decision) or it may be collective (representing a set of other decisions)....

All architecture is design but not all design is architecture. Architecture represents the significant design decisions that shape a system, where significant is measured by cost of change.

Grady Booch

Page 17: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Design SpaceDesign Space

An individual design represents a point in a multidimensional design spaceA pattern story represents a sequence

of points, a path, in design spaceA pattern represents a softly

bounded region in design spaceA pattern sequence represents a

sequence of regions, a pattern language a branching set of regions

An individual design represents a point in a multidimensional design spaceA pattern story represents a sequence

of points, a path, in design spaceA pattern represents a softly

bounded region in design spaceA pattern sequence represents a

sequence of regions, a pattern language a branching set of regions

Page 18: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Introduction to Interactive Pattern StoriesJames Siddle

Introduction to Interactive Pattern StoriesJames Siddle

ACCU 2009ACCU 2009

Page 19: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

AgendaAgenda

Introduction Concepts Interactive fiction attributes Design choices Example Exploring design space Interactive pattern story creation What if…?

Introduction Concepts Interactive fiction attributes Design choices Example Exploring design space Interactive pattern story creation What if…?

Page 20: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

IntroductionIntroduction

Why interactive pattern stories?Pattern story is one design

example Interactivity extends concept

ExplorationEngagement

Focus on learning

Why interactive pattern stories?Pattern story is one design

example Interactivity extends concept

ExplorationEngagement

Focus on learning

Page 21: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

ConceptsConcepts

Pattern concepts Language, sequence, story

Interactive Fiction Branching narrative Second person (you) Game Examples – CYOA, Fighting Fantasy

Interactive pattern story Combine interactive fiction …with pattern story

Pattern concepts Language, sequence, story

Interactive Fiction Branching narrative Second person (you) Game Examples – CYOA, Fighting Fantasy

Interactive pattern story Combine interactive fiction …with pattern story

Page 22: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Interactive fiction attributes

Interactive fiction attributes

Engaging formatGameplay / fun It’s about YOU Illustrations showing

consequences

Encourages self-motivated learning, exploration

Engaging formatGameplay / fun It’s about YOU Illustrations showing

consequences

Encourages self-motivated learning, exploration

Page 23: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Design choicesDesign choices

Derive from connections in the pattern language Alternative patterns Optional patterns

Choices not limited to those in the pattern language Less desirable alternatives

Speculative versus Known

Explore the multiverse

Derive from connections in the pattern language Alternative patterns Optional patterns

Choices not limited to those in the pattern language Less desirable alternatives

Speculative versus Known

Explore the multiverse

Page 24: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

ExampleExample

1

You are developing a request-handling framework, and are faced with the problem of how requests can be issued and handled so that the request handling framework can manipulate the requests explicitly, but in a uniform way.

You decide to objectify requests as COMMAND objects, based on a common, abstract, execution interface….

Go to 2

Page 25: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

ExampleExample

2

You need to ensure that compound requests are handled. Compound requests correspond to multiple requests performed in sequence and as one; they are similarly undone as one.

The problem is, how can compound requests can be expressed without upsetting the simple and uniform treatment of COMMANDs within the framework?

If you want to create a special kind of COMMAND to deal with all compound requests, go to 3.

Otherwise, if you're happy for compound requests to be handled by the framework as it stands, go to 4.

Page 26: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

ExampleExample

3

You decide to create a COMPOSITE COMMAND object that aggregates other COMMAND objects. To initialise a COMPOSITE COMMAND correctly, you add other COMMANDs (both primitive or COMPOSITE) to it in sequence.

This allows arbitrary compound requests to be composed, simplifying framework use, and reducing complexity and coupling. This enhances maintainability and evolvability of client code.

But this does reduce understandability of the framework– COMPOSITE implementations can be complex and non-obvious.

The End – you win!

Page 27: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

ExampleExample

4

You decide to support compound requests through concrete COMMAND objects which aggregate other COMMAND objects.

The existing framework already supports this, but while this leaves your framework simpler, it means that clients of the framework will find it harder to use.

Clients will need to represent each compound request via a unique concrete class, which will be difficult to maintain and harder to evolve.

The End – you lose

Page 28: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Exploring design spaceExploring design space

Read one full story, making choices

Digest outcomeGo back to the start, repeat

Skim read highlighted sentences, phrases

Try different paths, with different outcomes

Reflect

Read one full story, making choices

Digest outcomeGo back to the start, repeat

Skim read highlighted sentences, phrases

Try different paths, with different outcomes

Reflect

Page 29: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Interactive pattern story creation

Interactive pattern story creation

Start with a linear story Derive from a pattern language

Add a variation pointGuided by pattern textUndesirable alternatives

Add more to create a treeBranches may join

Provide just enough information

Start with a linear story Derive from a pattern language

Add a variation pointGuided by pattern textUndesirable alternatives

Add more to create a treeBranches may join

Provide just enough information

Page 30: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

What if…?What if…?

Reading doesn’t appeal? Branching narratives are not constrained to written format

Reading doesn’t appeal? Branching narratives are not constrained to written format

Page 31: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Thank you for Thank you for ListeningListening

Questions?Questions?

Thank you for Thank you for ListeningListening

Questions?Questions?

Page 32: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

Interactive SessionJames Siddle, Kevlin HenneyInteractive SessionJames Siddle, Kevlin Henney

ACCU 2009ACCU 2009

Page 33: Exploring design space with Interactive pattern stories James Siddle, Kevlin Henney ACCU 2009

IntroductionIntroduction

Breakout groupsReading time – 10-15 minsDiscussion time – 20 mins

Capture outputFlipchartsKey questions on handout formSide 1-feedback, Side 2-ideas

Summary / Q&A

Breakout groupsReading time – 10-15 minsDiscussion time – 20 mins

Capture outputFlipchartsKey questions on handout formSide 1-feedback, Side 2-ideas

Summary / Q&A