Creating a Chatbot… No Coding Experience Required
Written by: Cassie Laney - Girls Who Code participant (2020)
Throughout the past year, current generation witnessed a large portion of our lives turn digital with the spread of Covid-19. School days turned into zoom schedules and paper turned into Word documents. With this unprecedented transformation into a virtual world, I wanted to understand the basis of what keeps us connected: code. When a peer introduced me to Girls Who Code at Fred Hutch, it seemed like the perfect opportunity to jump into this limitless area. Girls Who Code program offered through Fred Hutch is an opportunity that provides girls near the Seattle area the opportunity to learn how to code and what it can be applied to with no previous coding knowledge required, perfect for curious minds like mine. Not only did it teach me the basics of coding, but it introduced me to an amazing group of intelligent girls and professionals in the STEM field. Although we learned and experimented with code in Python, the material taught could still be applied to any coding syntax. Within this club, girls were split into three groups to brainstorm and code three unique chatbots: a meme bot, a book suggester, and a music suggester. In collaboration with my team members Ashley, Gina, and Jillian, we created a book chatbot that would suggest book titles and authors based on user input.
Although a book suggestion chatbot may not seem as exciting and thrilling as a meme bot, it seemed like a perfect topic for two reasons. First off, this topic could apply to real-life situations such as libraries or bookstores and help people find new books. Second, it was simple enough to give room to experiment with coding and broad enough to advance the chatbot and incorporate more code as our knowledge expanded. The first version of the chatbot consisted of simple print statements that did not leave a lot of room for an individualized experience for each user. Later on, we figured out how to not only incorporate user input but also create outputs that would correspond with user input. As our understanding of code grew, the complexity of the chatbot’s code grew with it.
Creating a chatbot or any type of code can appear intimidating at first glance, but it is not as hard as it seems as long as you have access to the right resources. Throughout my coding experience, I had the help of not only my peers and the Girls Who Code tutorials, but also the help of experienced coders and facilitators that would help with anything from brainstorming to figuring out the code itself. Learning to code can seem super overwhelming at first so I’d like to share some tips and advice that I wish I had known when I started:
- It is okay to mess up! You cannot grow without a little error to learn from.
- You do not need to memorize all of the different commands or script in order to code successfully. Even the greatest minds and coders forget how to code certain functions.
- It’s totally normal and acceptabke to look up or google coding syntax, or even analyze other pieces of code. Within my chatbot, I wanted to implement a randomizing factor that would allow book suggestions to be different for every experience. The line of code that allowed the chatbot to randomize its outputs was actually from a superpower/scientist generator used at the beginning of the Girls Who Code session to introduce us to code.
- Questions are your best friend, do not be afraid to ask them! I learned just as much through asking specific questions or how to code a certain function as I did through the tutorials and slideshows presented.
- Create a flowchart of what you want to code to do. Just like writing an essay, it can help to not only have the goal of your project in mind but to create a roadmap to guide yourself through creating the code. Creating a flowchart of the end goal of the code helps keep everything in order and personally helped a lot with if statements.
- Do not be afraid experiment! You can accomplish so much more or advance your code if you go in without expectations of perfection.
I know for myself, saying goodbye to parts of code or starting over on a section can seem daunting and discouraging. Even though it is a hard process, it is integral to the evolution of your code! Here are a few tips to make editing and revising code a little easier on your mind:
- Save a copy of the pre-edited code – you can save it to a personal folder with all other drafts to look back on. This helps knowing your code won’t be gone forever!
- Copy-paste sections of code and use hashtags to turn bits of code or ideas still in the works into lines the program skips over. If you are ever are stuck on a section of code and cannot quite figure it out, this is a great method that will enable you to focus on another area without affecting other pieces of code.
- Utilize version control like GitHub! GitHub’s system ensures that you never lose code you developed or cut out. With GitHub, you can access every part of your code’s history line by line and the changes made throughout. This blog post was written in GitHub, which made it super easy to not only save the code history, but also receive comments from reviewers. My chatbot was written in a program called Trinket, which allowed for easy sharing of code versions and finished chatbots.
I first went into coding with intimidation and fear of failure. It was simply an activity I wanted to see if I could do, but I was heavily hesitant. In the end, I came out with a community of girls like me who want to expand their horizons. I met many active thinkers, creators, and intelligent people throughout this experience who not only helped me learn how to code, but also grow. This opportunity also gave me a new interest and introduced me to the world of coding. It taught me all of the practicalities and how I could utilize code within my life. Throughout this experience, I learned how to turn print statements into a book suggester with conditionals, if statements, and functions. Coding is definitely a learning process, but it is a completely attainable skill with the right resources and a little faith.
Want to see my first coding project? You can view my team chatbot here.