A delightful, award-winning picture book that makes coding concepts click in the brains of kids ages 4–12. As a Technology, Coding and Robotics teacher, I highly recommend this book, and I’ll tell you exactly why!

If there’s one book I keep coming back to when introducing coding to young learners, it’s How to Code a Sandcastle by Josh Funk. I’ve had this book since 2018. It’s smart, funny, beautifully illustrated, and – most importantly – it actually teaches real coding concepts in a way kids genuinely get! Isn’t this exciting? Let me tell you all about it!
What is this book about?
How to Code a Sandcastle is a picture book written by Josh Funk and illustrated by Sara Palacios, published in partnership with the nonprofit Girls Who Code in May 2018. It’s part of the “How to Code with Pearl and Pascal” series, aimed at children ages 4 to 12.
I’ve actually used this book at home too — the first time I read it with my own kids, they were 4 and 5 years old. They didn’t quite grasp the coding concepts yet, but that didn’t stop them from having an absolute blast with an unplugged STEM activity I paired it with. They had to build a sandcastle by following a simple algorithm, and both of them made it all the way through from start to finish — which, if you’ve ever done a hands-on activity with a 4-year-old, you’ll know is a win in itself! 😄 If you’d like to try it at home or in your classroom, I actually have the activity available in my TpT store right here: How to Code a Sandcastle | Unplugged coding | STEM challenge cards | drawing
When I later used the book with my 8 and 10 year old students, I found that’s really the sweet spot — old enough to genuinely connect with the coding concepts, but still young enough to be fully swept up in the story. That said, don’t let that stop you from reading it earlier. As my own kids proved, the fun starts long before the concepts fully land.
The story actually follows Pearl, a curious and determined young girl who has been trying to build the perfect sandcastle all summer — only to have it repeatedly ruined by rogue frisbees, mischievous dogs, and waves. On the very last day of summer vacation, Pearl decides enough is enough. She enlists the help of her trusty robot friend, Pascal, to get the job done once and for all. There’s just one catch: Pascal is a robot, so Pearl has to communicate with him in code.
What follows is a laugh-out-loud adventure where Pearl and Pascal break the big “build a sandcastle” problem into smaller, manageable steps — and in doing so, introduce young readers to the foundational logic of computer programming, all against the backdrop of a perfect summer beach day: warm waves, sunshine, sand between your toes, and adorable swimwear.
The coding concepts inside
What makes this book stand out is how naturally the coding concepts are woven into the story in my opinion. It never feels like a textbook — it feels like a story that just happens to teach you something. Here are the three core concepts the book covers:
- Sequence — Code must be written in a specific order. Pearl learns to give Pascal step-by-step instructions, and quickly discovers that order matters a lot.
- Loops — Instead of writing the same sequence over and over, you write it once and tell the program to repeat it. Pearl uses this to gather sand more efficiently.
- If-Then-Else (Conditionals) — If something is true, you do one thing. If it’s false, you do something else. Classic conditional logic, made totally accessible.
And by the way, if you want to make these concepts a bit more practical, I have an unplugged directional coding activity in my TpT store that’s themed around the book, the characters and the beachy vibes. It pairs perfectly with the story and keeps the fun going without a screen in sight. Grab it here: How to code a sandcastle book themed | Unplugged Coding Activity | Algorithm
The illustrations in the book are bright, warm, and full of personality, which helps you actually visualize these concepts. When Pearl sets up a loop for Pascal, the artwork shows the sequence literally arranged in a circle, helping kids see what a loop looks like rather than just hearing about it. Sara Palacios’s art is doing real educational heavy lifting, and it works wonderfully.
Pascal himself is an absolute delight. He genuinely tries to follow Pearl’s instructions but keeps getting them gloriously wrong — which is both hilarious and a brilliant way to show kids why precision in coding matters. If Pearl tells him to “get decorations,” he comes back with a baby’s pacifier. She learns quickly that she has to be very specific! This trial-and-error dynamic mirrors the real experience of debugging code, which is a lesson every young coder needs early on.
Who made this book (and why it matters)

Author Josh Funk isn’t just a children’s book writer — he’s an actual software engineer with over 20 years of experience writing in C++, Java, and Python. That expertise gives me reassurance and shows in how accurately and accessibly the concepts are presented.
The book opens with a foreword from Reshma Saujani, founder of Girls Who Code, who makes the case for teaching coding from the earliest possible age — just like we teach kids about animals, history, and space before they even start school. The goal is to make coding a familiar part of childhood, not something intimidating that only shows up in middle school.
Illustrator Sara Palacios brings the book to life with mixed-media artwork, vivid colours, and a racially diverse cast of characters. Pearl herself is a Black girl — a deliberate and meaningful choice in a field where representation for girls and children of colour is still something we’re actively working toward.
Awards & Recognition for the book:
- 2018 Smithsonian Ten Best Children’s Books
- 2019 ILA Teacher’s Choice Reading List
- 2018 Summer Indie Kids’ Next List Selection
- 2019 ALSC El día de los niños / El día de los libros Selection
- Booklist Starred Review
- Kirkus Reviews Recommended
What’s in the back of the book?

At the end of the story, there’s a section called “Pearl and Pascal’s Guide to Coding” — two pages that give a more detailed, kid-friendly explanation of all three coding concepts from the book. This is incredibly useful for teachers who want to deepen the learning after a read-aloud, or for children who want to go back and review.
There’s also a small coding glossary tucked into the back matter — a handy reference to return to, and great support for kids and adults who are newer to the coding vocabulary.
Why this book is a goldmine for Coding & Tech Teachers
Finding a genuinely good unplugged resource for early coders – one that holds kids’ attention AND teaches something real – is harder than it sounds. This book checks every box in my opinion. Here’s why:
- Perfect read-aloud anchor lesson. Use it to kick off a unit on sequences, conditionals, or loops. The story gives you a narrative hook kids remember, and they’ll connect back to it when they encounter these concepts in Scratch, Blockly, or Code.org later on.
- Great for unplugged activities. After reading, have kids write their own “code” to instruct a classmate or a toy robot to complete a task like making a sandwich, setting the table, drawing a shape. The format transfers beautifully to offline activities. This is where you can find many plugged and unplugged activities I’ve made on the book: Technology Realm Resources TpT store, category “How to code a sandcastle”.
- Representation that matters. Pearl is a confident, capable Black girl who isn’t afraid of setbacks. For classrooms working to close the gender and diversity gap in STEM, this kind of role model is genuinely valuable. It signals clearly that coding is for everyone.
- Aligned to real CS standards. Sequence, loops, and conditionals map directly to the foundational vocabulary in K–8 CS curricula, including CSTA standards and Code.org pathways. This isn’t a vague “tech-adjacent” book — it’s the real thing.
- Kids actually love it. Pascal’s endless mishaps are laugh-out-loud funny. There’s even a dog named “Ada Puglace” (yes, a nod to Ada Lovelace) who accidentally turns the castle moat into a disaster zone. The humor lands across age groups, and there are Easter eggs for tech-savvy adults too.
- A series to grow with. Once your students love Pearl and Pascal, there’s a second book — How to Code a Rollercoaster — that introduces variables, more complex loops, and deeper conditionals. Perfect for students ready for the next level, and also a book I highly recommend.
How it helps students learn
One of the biggest hurdles in teaching coding to young children is abstract thinking. Loops, conditionals, and sequences exist in the invisible logic of a computer — and that can be hard for little minds to grasp. What this book does brilliantly is anchor these abstractions to something tangible and relatable: building a sandcastle, something most children have actually done.
When kids watch Pearl debugging Pascal’s mistakes — being more specific, adjusting her instructions, trying again — they’re seeing the engineering design process in action. They learn that getting it wrong the first time is normal, that persistence matters, and that breaking a big problem into smaller ones is the smartest approach (generally in life, not just in coding). These are transferable life skills just as much as they are coding skills.
Teachers who’ve used the book in their classrooms, like me, report that students connect it to other coding tools they use later on, which is exactly the kind of bridge-building we want. I’ve discussed this with other Technology teacher colleagues and friends on conferences and meetings. The book doesn’t just entertain — it builds a mental model that kids carry forward.
My final thoughts
How to Code a Sandcastle is one of those rare books that works on every level. It’s fun enough for a story-time read-aloud, educational enough to anchor a CS lesson, diverse enough for every child to feel welcome, and well-crafted enough to earn a permanent spot on my classroom shelf.
Whether you’re teaching a robotics class, running a coding club (or a Robotics one, like me), or just looking for a great supplementary read for your STEM curriculum — this is one I’d strongly recommend. It’s available on Amazon, Barnes & Noble, and most libraries carry it too. There’s also great read-alouds on YouTube that you can watch and play for your students for free.
And if you’re looking for ready-made teaching resources to pair alongside it — activities, a book companion, worksheets, lesson plans — come check out my TpT store, this is a link. I’ve got materials that work really nicely with this book and other kids’ tech books exactly like this one. 🙂
Have you read this book with your students? Drop a comment below — I’d love to hear how they responded, and whether there are other coding or tech books you’d like me to review next!

