Wednesday, May 23, 2018

Coding With Josh Funk

by Sue Heavenrich

How to Code a Sandcastle (a Girls Who Code book)
by Josh Funk; illus. by Sara Palacios
44 pages; ages 4-8
Viking, 2018

If you know how to code, you can do anything: solve big problems, design a car, print a prosthetic hand - even build a sandcastle! Which is good news for Pearl, when she heads to the beach with her robot buddy, Pascal.

All Pearl needs to do is learn how to tell Pascal what to do, and how to do it. As she learns, when telling a robot (or computer) to do something, you need to give it specific instructions. In a sequence. And if you want it to continue doing something over and over and over again, you might want to know how to create a loop of instructions.

So how did the Josh Funk, author of Dear Dragon and Lady Pancake & Sir French Toast, end up writing about coding?

GROG: Hey, Josh! How did you come up with this fun and sandy idea? 

JOSH: Thanks so much for having me on the GROG! I’ve been following since the very beginning!

A  few years back, I started trying to write a fictional story that also relayed some elements of coding that was appropriate for the picture book-aged audience. And let me tell you … it was NOT easy. I went through three and a half completely different stories before landing on How to Code a Sandcastle.

Photo by Carter Hasegawa
When we submitted the story to my editor at Viking/Penguin (she previously edited Dear Dragon), she told us that Penguin and Girls Who Code had recently entered into a partnership to create a bunch of children’s books about coding. My editor had showed the story to Reshma and Girls Who Code and it all came together at that point.

GROG:  How did you determine what coding terms / instructions to focus on?

JOSH: At first, I thought back to my first computer science course in college. Second, I have kids who have been taught certain aspects of coding since kindergarten, so I’ve seen what they do. And third, I did research. (Shocking! I know!)

And you know what, coding is just like any other subject. You need to know the alphabet before you can read. You need to know how to count and some basic arithmetic symbols before you can do math. And to code, you need to know about sequences, loops, and conditionals (I call them ‘If-Then-Else’s in the book). You might call a ‘loop’ a ‘repeat’, but every coding language has something like that.

It turns out that sequences, loops, and conditionals are the first things the Girls Who Code movement introduces in their coding program as well.

GROG: Can you talk about the process of developing a story around showing young readers what these instructions mean and how they are used?   

JOSH: This was the trickiest part. But I think things started to click when I realized two things:

First, the setting had to be something familiar to children. Starting out in a made-up fantasy world is complex enough without introducing complicated coding concepts (trust me, I tried). So when I simplified it to the task of building a sandcastle at the beach, this was key. (thank you to my critique partners who continually pushed me in this direction)

Second, I needed to not try teaching everything in a single story. There’s a LOT more coding than just sequences, loops, and conditionals. But when I also tried talking about variables, for loops vs. while loops, and pointers - that was just WAY too much (but YAY for sequels - HOW TO CODE A ROLLERCOASTER is where we learn about variables - in the fall of 2019).

GROG: Pearl tells Pascal "that's enough" - is there a way to code when to stop?  

JOSH: Depending on the computer language, there are certainly ways to break out of loops. In fact, in C/C++, you would use the word break - which is why Pearl tells Pascal, ‘time for a break’ to get out of that first loop halfway through the book.

Normally, the best way to get out of a loop is to set the start and end conditions appropriately (for example, you’ll repeat something a certain number of times or while a certain condition is still true) - but that might have gotten a little too complicated for a book like this.

GROG: Aren't you worried Pascal will get sand in his bearings? 

JOSH: And this is why I don’t write strict nonfiction. HOW TO CODE A SANDCASTLE is ‘informational’ fiction. Some might even say ‘speculative’ - as we don’t yet live in a world where we can instruct robots to build our sandcastles for us … at least that I know of ….

To find out more about Josh Funk and his wonderful books visit him at and on Twitter at @joshfunkbooks. Turns out, Josh knows how to code - he studied computer science. He's pretty good at writing instructions for computers, but not so good at writing bios, so please help him out:
Josh enjoys _______ during ________ and has always loved __________. He has played ____________ since age __ and his biggest fear in life is being eaten by a __________.


  1. Great interview, Sue and Josh! Can't wait to read this book. Sounds like it'd "coded" to be a winner!

  2. Sue and Josh -- THANKS for the great post! I LOVED hearing the story behind this coding-for-kids picture book. And I can't wait to read it.

  3. I just saw this at B and N yesterday. Josh did a great job. Thanks, Sue for the behind the scenes look at the process.

  4. Love it! Maybe even an old dog like myself can understand something about coding! Congratulations!

  5. Oh, I love this concept of how to write on a complicated subject and how to break it down. Plus, Josh is the best, and great interview, Sue. Plus I learned a bit about coding myself!

  6. Terrific interview Sue and Josh. I'm looking forward to reading this book!

  7. V-e-r-y interesting! Must take a look at this book. As a former engineer, I appreciate the focus on girls who code. Yay!

  8. I discovered your this post while trying to find information regarding blog-related research ... It is a good post .. keep posting and updating information.corteges mariage