Crochet as Code: Astro

I am slowly learning Apex as part of my #JourneyToCTA – that is, on my journey to becoming a Salesforce Certified Technical Architect. It has been a slow process, but I’m starting to make connections and having a lot of ah-ha moments. I’ve done Trailhead modules, watched YouTube videos, purchased several apex training courses that I haven’t really been able to pay attention to, and I’m currently part of a radWomen cohort. Maybe it is the group learning that holds me accountable and the fact that my coaches are volunteers, (don’t want to waste their time!), but I’m learning SO MUCH. It is all finally clicking and falling into place.

One of the most helpful things has been the assigned reading. We read a lot of other people’s blog posts (the Salesforce Community is the greatest) some of which are from Women Code Heroes, where Kieren Jameson compares apex to cooking. I highly recommend reading this whole series to anyone, but especially those who are also having a slow start to learning apex. Besides the learning, it also made me think about other connections to code. I enjoy cooking, but something I love and do way more often… is crochet. And crocheting is exactly like writing a program in apex! A set of instructions that need to be executed in order to do or create something. When I had this epiphany, I googled “crochet as code” to see if others had written anything on this, and found a blog post written by Mercedes Bernard on just that. I was so excited that I’m not the only one to have thought of this, and also excited that there are other yarn junkies out there who are also into technology.

A crochet pattern is written out so that the crocheter knows which stitches to make, how many to make, and where to make them. A program is lines of code compiled to tell the machine what to do, how many times, and when. In both cases, its a set of instructions to be executed in a particular order. A crochet pattern is essentially a program; a program is a pattern.

Mercedes Bernard

I’ve been obsessing over yarn for YEARS. By obsessing I mean buying too much of it, pinning it all night long on my Yarn Junkie board, and frequently, but not often enough, creating things with it. Yarn, and specifically crocheting, provides me with some relaxation somehow – something I desperately need in a life that is otherwise filled with work, teenager drama, and diaper changes. I am always on the go, so the repetitive nature of working with yarn allows me to focus on just one thing for a while and I can sort of zone out. If you follow me at all on Instagram or Twitter, you’ll notice me posting about crochet, and more recently – Salesforce Crochet! I was planning on posting some patterns on the blog so that others could join the #salesforcemaker movement, but now I want to take that a step further, and write the patterns in apex! I will also post a normal version of the pattern in normal crochet terms, but this is going to help me learn, and maybe help you learn too. So with that… I introduce the start of a new Crochet <> Code series!

Code <> Crochet

Before we get to making, its important to understand what we’re looking at. In my mind, these apex terms all equal a term in crochet:

Class <> Pattern

A class is a template or blueprint from which objects are created. An object is an instance of a class. Using this logic, our template or blueprint is our pattern. Our pattern will contain objects and methods that make our final product come to life.

Object <> Row

Objects are an instance of a class – or in our case, an instance of our pattern. Each row we create is an instance of the pattern, all building on top of one another to create a final product.

Method <> Stitch

In our case, this is a type of stitch in crochet. A stitch is just a small set of instructions that you follow to create something. For example, a singleCrochet() would include picking up a loop, yarning over, and pulling through your loop.

Variable <> Count

In apex you declare a variable that can be an integer, string, etc. For our uses, we will be declaring an integer variable that will tell us how many times we need to complete a method (or stitch). For example, do 5 single crochet stitches. The number 5 is both our variable and our stitch count.

Putting it All Together

When I’m coming up with a pattern, I’m planning out which stitches I need, testing and retesting, and doing a lot of calculations to make sure the end product will be what I want it to be. Similarly, as I’m learning code I have to try and come up with the best solution to solve a problem. I test and retest, organize requirements, and even do calculations to make sure the end product is what I want it to be. Whether I’m crocheting or writing apex – I’m performing the same set of tasks. I feel like I could go on and on about this, but let’s just get to it! Here is my first Crochet <> Code pattern – Astro!

I crocheted Astro using intarsia crochet. I’m not really sure what the final product will be here, but Astro would be cute as a bobble stitch crochet, a C2C crochet piece, a block in a blanket… the list could go on and on. Astro might also work well on a coffee coozie or something since its just the head. I hope you’ll use the pattern and apply your own creativity and expertise to make something really cool! You could even use this pattern with a bedazzler, perler beads, cross stitch, or any other form of crafting that you like.

PATTERN

Astro Crochet

Materials

  • G Crochet Hook
  • White yarn
  • Dark Brown yarn
  • Skin Tone yarn
  • Black yarn

I used I Love This Yarn from Hobby Lobby because there is one right by my house and they come in lots of different colors. I’m not going to say you have to use any certain type of yarn for this… make it how you want it!

Pattern Notes

I worked this using the intarsia method – meaning I left tails for each color on the wrong side of my work and didn’t carry them through.

This whipped up really fast for me – I actually made Astro in the car while I was waiting to pick my daughter up from band 🙂

Have fun, get creative, and don’t forget to share your finished products with me! Post your finished products on Twitter or Instagram with the hashtag #forceforfun.