Slide 1

Slide 1 text

@maccath | Katy Ereira | #PHPSC17 Knit 1, Perl 1 Where Knitting & Programming Intertwine

Slide 2

Slide 2 text

@maccath | Katy Ereira | #PHPSC17 Programming is... Writing a set of instructions that when run on certain hardware perform manipulations and calculations that produce a desired result

Slide 3

Slide 3 text

@maccath | Katy Ereira | #PHPSC17 Knitting is... Following a set of instructions using certain needles and yarn to perform manipulations that produce a desired result

Slide 4

Slide 4 text

@maccath | Katy Ereira | #PHPSC17 Seeing a pattern?

Slide 5

Slide 5 text

@maccath | Katy Ereira | #PHPSC17 Ok; so knitting is more like computing than programming.

Slide 6

Slide 6 text

@maccath | Katy Ereira | #PHPSC17 But like computer programs, knitting patterns are a set of instructions.

Slide 7

Slide 7 text

@maccath | Katy Ereira | #PHPSC17 These can be represented in different ways; many of which draw parallels with computer code.

Slide 8

Slide 8 text

@maccath | Katy Ereira | #PHPSC17 Unravelling the Mystery

Slide 9

Slide 9 text

@maccath | Katy Ereira | #PHPSC17

Slide 10

Slide 10 text

@maccath | Katy Ereira | #PHPSC17

Slide 11

Slide 11 text

@maccath | Katy Ereira | #PHPSC17 Worked over even number of sts. Row 1: [yo, k2tog] rep. Row 2 & 4: k all sts. Row 3: [ssk, yo] rep. Rep rows 1-4 for pattern. Knitting pattern

Slide 12

Slide 12 text

@maccath | Katy Ereira | #PHPSC17 Worked over even number of sts. Row 1: [yo, k2tog] rep. Row 2 & 4: k all sts. Row 3: [ssk, yo] rep. Rep rows 1-4 for pattern. Knitting pattern - variables

Slide 13

Slide 13 text

@maccath | Katy Ereira | #PHPSC17

Slide 14

Slide 14 text

@maccath | Katy Ereira | #PHPSC17 sts rows

Slide 15

Slide 15 text

@maccath | Katy Ereira | #PHPSC17 sts = 12 row = 5 row 1 row 2 row 3 row 4

Slide 16

Slide 16 text

@maccath | Katy Ereira | #PHPSC17 Worked over even number of sts. Row 1: [yo, k2tog] rep. Row 2 & 4: k all sts. Row 3: [ssk, yo] rep. Rep rows 1-4 for pattern. Knitting pattern - conditionals

Slide 17

Slide 17 text

@maccath | Katy Ereira | #PHPSC17 sts = 12 row = 5 row 1 row 2 row 3 row 4

Slide 18

Slide 18 text

@maccath | Katy Ereira | #PHPSC17 Worked over even number of sts. Row 1: [yo, k2tog] rep. Row 2 & 4: k all sts. Row 3: [ssk, yo] rep. Rep rows 1-4 for pattern. Knitting pattern - iterators

Slide 19

Slide 19 text

@maccath | Katy Ereira | #PHPSC17 row = 5 % 4 = 1 row 1 row 2 row 3 row 4

Slide 20

Slide 20 text

@maccath | Katy Ereira | #PHPSC17 Worked over even number of sts. Row 1: [yo, k2tog] rep. Row 2 & 4: k all sts. Row 3: [ssk, yo] rep. Rep rows 1-4 for pattern. Knitting pattern - methods

Slide 21

Slide 21 text

@maccath | Katy Ereira | #PHPSC17 Row = 5 % 4 = 1 Row 1 Row 2 Row 3 Row 4 k2tog yo yo k2tog

Slide 22

Slide 22 text

@maccath | Katy Ereira | #PHPSC17

Slide 23

Slide 23 text

@maccath | Katy Ereira | #PHPSC17

Slide 24

Slide 24 text

@maccath | Katy Ereira | #PHPSC17 Row = 6 % 4 = 2 Row 1 Row 2 Row 3 Row 4 Row 5

Slide 25

Slide 25 text

@maccath | Katy Ereira | #PHPSC17 Let’s Craft Some Code

Slide 26

Slide 26 text

@maccath | Katy Ereira | #PHPSC17 function pattern(array $sts, int $rows) { if (count($sts) % 2 != 0) { throw Exception(“The number of stitches must be even!”); } // ... } Knitting pattern - pattern method, conditionals

Slide 27

Slide 27 text

@maccath | Katy Ereira | #PHPSC17 function pattern(array $sts, int $rows) { // ... for ($row = 1; $row <= $rows; $row++) { // ... } } Knitting pattern - pattern method, iterator

Slide 28

Slide 28 text

@maccath | Katy Ereira | #PHPSC17 function pattern(array $sts, int $rows) { // ... for ($row = 1; $row <= $rows; $row++) { if ($row % 2 == 0) { evenRow($sts); continue; } // ... } } Knitting pattern - pattern method, more conditions

Slide 29

Slide 29 text

@maccath | Katy Ereira | #PHPSC17 function pattern(array $sts, int $rows) { // ... for ($row = 1; $row <= $rows; $row++) { // ... if ($row % 4 == 1) { rowOne($sts); continue; } // ... } } Knitting pattern - pattern method, more conditions

Slide 30

Slide 30 text

@maccath | Katy Ereira | #PHPSC17 function pattern(array $sts, int $rows) { // ... for ($row = 1; $row <= $rows; $row++) { // ... rowThree($sts); } } Knitting pattern - pattern method, more conditions

Slide 31

Slide 31 text

@maccath | Katy Ereira | #PHPSC17 function evenRow($sts) { foreach ($sts as $st) { k($st); } } Knitting pattern - even round method

Slide 32

Slide 32 text

@maccath | Katy Ereira | #PHPSC17 function rowOne($sts) { for ($i = 0; $i < count($sts); $i += 2) { yo(); k2tog($sts[$i], $st[$i+1]); } } Knitting pattern - row one method

Slide 33

Slide 33 text

@maccath | Katy Ereira | #PHPSC17 function rowThree($sts) { for ($i = 0; $i < count($sts); $i += 2) { ssk($sts[$i], $st[$i+1]); yo(); } } Knitting pattern - third row method

Slide 34

Slide 34 text

@maccath | Katy Ereira | #PHPSC17 // Cast on 20 stitches $stitches = array_fill(0, 20, new Stitch()); // Knit for this many rows $rows = 10; // Let’s knit! pattern($stitches, $rows); Knitting pattern - usage!

Slide 35

Slide 35 text

@maccath | Katy Ereira | #PHPSC17 Charting a Course

Slide 36

Slide 36 text

@maccath | Katy Ereira | #PHPSC17 Credit: Hedgehog Fibres - https://www.flickr.com/photos/29825916@N05/10784075824/

Slide 37

Slide 37 text

@maccath | Katy Ereira | #PHPSC17 4 O 3 2 O 1 O yo k2tog ssk k A Knitting Chart

Slide 38

Slide 38 text

@maccath | Katy Ereira | #PHPSC17 4 O 3 2 O 1 rows repeat pattern sts O yo k2tog ssk k key A Knitting Chart

Slide 39

Slide 39 text

@maccath | Katy Ereira | #PHPSC17 The Future is Looming

Slide 40

Slide 40 text

@maccath | Katy Ereira | #PHPSC17 Credit: Karen Blakeman - https://www.flickr.com/photos/rbainfo/5427088569/

Slide 41

Slide 41 text

@maccath | Katy Ereira | #PHPSC17 Credit: smeech - https://www.flickr.com/photos/39554118@N08/13901738784/

Slide 42

Slide 42 text

@maccath | Katy Ereira | #PHPSC17 Credit: smeech - https://www.flickr.com/photos/39554118@N08/14349266009

Slide 43

Slide 43 text

@maccath | Katy Ereira | #PHPSC17

Slide 44

Slide 44 text

@maccath | Katy Ereira | #PHPSC17 “ The term "Jacquard" is not specific or limited to any particular loom, but rather refers to the added control mechanism that automates the patterning. The process can also be used for patterned knitwear and machine-knitted textiles, such as jerseys.

Slide 45

Slide 45 text

@maccath | Katy Ereira | #PHPSC17 “ [The] use of replaceable punched cards to control a sequence of operations is considered an important step in the history of computing hardware. Jacquard's invention had a deep influence on Charles Babbage.

Slide 46

Slide 46 text

@maccath | Katy Ereira | #PHPSC17 Weaving Everything Together

Slide 47

Slide 47 text

@maccath | Katy Ereira | #PHPSC17 There are challenges faced by knitters, which could be untangled through programming.

Slide 48

Slide 48 text

@maccath | Katy Ereira | #PHPSC17 Formalisation of Knitting Patterns ● Translation ○ “I’d like this pattern to use abbreviations I understand.” ● Charting ○ “I’d like to convert this written pattern into a visual chart.” ● Validation ○ “Will this pattern work, or does it contain mistakes?”

Slide 49

Slide 49 text

@maccath | Katy Ereira | #PHPSC17 KnitML - http://www.k2g2.org/wiki:knitml

Slide 50

Slide 50 text

@maccath | Katy Ereira | #PHPSC17 Arithmetic and Calculations ● Sizing ○ “How many rows do I need to knit to reach my correct size?” ● Shaping ○ “What stitches do I need to make in order to shape this garment to fit my body?” ● Adaptation and alteration ○ “What size needles should I use in order to knit with this thicker yarn?”

Slide 51

Slide 51 text

@maccath | Katy Ereira | #PHPSC17 Job Replacement ● Test knitting ○ Programmatically knit the pattern and analyse the output; does it work, will it fit? ● Technical editing ○ Validate the pattern; spot knitting mistakes and standardise terminology. ● Knitwear design ○ Create knitting charts and garment templates; easy design & create patterns.

Slide 52

Slide 52 text

@maccath | Katy Ereira | #PHPSC17 There are difficulties faced by programmers, which could be ironed out through knitting.

Slide 53

Slide 53 text

@maccath | Katy Ereira | #PHPSC17 Staying Sane ● Stress reduction / avoiding burnout ○ Participating in a meditative hobby such as knitting can help you unwind ● Solving difficult problems ○ Performing a different activity can free your mind to come up with crafty solutions ● Brain training ○ Strengthen your intellectual fibre by exercising your brain

Slide 54

Slide 54 text

@maccath | Katy Ereira | #PHPSC17 Knit for Health and Wellness - http://www.knitforhealthandwellness.com

Slide 55

Slide 55 text

@maccath | Katy Ereira | #PHPSC17 Indulge Your Geekiness ● Mathematical/Geometric Knitting ○ Moebius scarves, non-orientable surfaces, klein bottles, pi shawl ● Coded Knitting ○ Encoding data in knitting ● Fandom Knits ○ Dr Who scarves, cosplay, geeky motifs

Slide 56

Slide 56 text

@maccath | Katy Ereira | #PHPSC17 Credit: birdfarm - https://www.flickr.com/photos/birdfarm/58097731

Slide 57

Slide 57 text

@maccath | Katy Ereira | #PHPSC17

Slide 58

Slide 58 text

@maccath | Katy Ereira | #PHPSC17 Give Knitting a Spin!

Slide 59

Slide 59 text

@maccath | Katy Ereira | #PHPSC17 Yarning for more? Knitting Help: http://www.knittinghelp.com/videos/learn-to-knit Craftsy knitting classes: http://www.craftsy.com/classes/knitting Knitty - free online knitting magazine: http://knitty.com Ravelry - social network and pattern library: http://ravelry.com k2g2 - “the convergence of brains and crafts”: http://www.k2g2.org