Makin' Bots: Using Hands-On Workshops to Teach Essential Coding Skills.
Robin was my colleague at City University of New York (CUNY) until recently and is now a user experience librarian at North Carolina State University in Raleigh. We hit on the idea for a Twitter bot workshop several years ago at a CUNY librarians' emerging technologies meeting. We felt it would be interesting to teach programming skills using bots. In December 2015, we gathered a group of 20-30 librarians in a computer lab to spend an afternoon talking about code and working on some bots. Participants got to learn a bit about programming and build some Twitter bots that they could show off to their friends and colleagues. The workshop was productive and fun, so we ran it a couple more times--at the Code4Lib annual conference and at ALA's annual conference. This article highlights what we learned about code pedagogy over several iterations of our workshop.
Bot Literacy and Why to Teach It
Bot literacy is a term that we coined to describe our workshops. It draws on the idea of digital literacy in general. Literacy has some blurry and contested boundaries. Bot literacy is likewise a bit vague, but it suggests a very practical goal: learning the nuts and bolts of how bots work.
Learning about bots is useful; it provides new programmers with insights on how automation shapes the modern web. Bots exist everywhere, including on Twitter, Wikipedia, and the Forbes website. Understanding how they work informs us about some of the changing ways that digital information is produced and provides us with helpful insights into the functioning of our networked world. A conceptual grasp of how bots work provides new programmers with a useful and contemporary skill.
While we're not suggesting that hot literacy is distinct from digital literacy, we believe it's a good starting point for teaching others practical programming skills.
Teaching the Fundamentals
Robin and I focused our workshops on introducing basic programming skills through hands-on work with bots. We taught our workshops using the Python programming language to create Twitter bots. We chose Twitter as the use case because Twitter is not only very widely used, but it also has a highly robust API that is great for bot-making; it was, at the time of the workshops, easily accessible by everyone without advance credentials. Although we went with Twitter and Python, other bots and other programming languages will work with this approach.
Python is a popular language among librarians and is a very good choice for beginners. Even so, we didn't attempt to cover its functionality comprehensively or systematically in our workshops. Instead, we emphasized problem-solving skills that are useful for anyone working with code, whatever language he or she might be using. We felt that learning core programming skills--such as computational thinking and debugging--are much more important than learning any specific feature of Python.
Aside from writing some Python, making Twitter bots involves working with the Twitter API, so our workshops took a careful look at how APIs work. APIs are especially important because they are a foundational concept in modern web development. They allow different services to communicate programmatically, usually without human intervention. They are a powerful threshold concept (ACRL 2015) for beginner programmers. Many web APIs will be interesting to librarians, including those from OCLC, the Digital Public Library of America (DPLA), the Library of Congress, LibGuides, various library discovery services, and social media platforms. Learning to use web APIs can be a transformational experience for someone learning to code. Armed with this knowledge, new programmers can accomplish online tasks that were previously beyond their reach. Learning how to work with a web API opens up an entirely new side of the internet to the learner. It is a powerful gateway concept to becoming a more digitally engaged librarian and programmer.
Learning by Doing
Teaching programming is challenging. One common problem with code education for beginners is that it is often too disconnected from reality or too abstract. Many beginners are introduced to programming concepts without the benefit of a compelling use case. This can mean that programming exercises can be boring, since it can be hard to get excited about theoretical ideas presented without an obvious application.
In our workshops, we aimed to avoid this problem by focusing on a tangible goal--such as creating a Twitter bot. This makes it obvious how useful basic programming concepts can be. Building something real makes programming ideas come to life. When we get immersed in solving programming challenges, we (almost unintentionally) pick up a lot of core concepts.
A snippet of Python script in one of our sample bots 1 #1/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 4 # Twitter Bot Starter Kit: Bot 1 5 6 # This is the most basic bot. It sends out a tweet! 7 8 # If you haven't yet created credentials.py, modify credentials.template 9 # to include your own Twitter account settings. This script will then tweet 10 # using your bot's account 11 12 # Housekeeping: do not edit 13 import tweepy 14 from credentials import * 15 auth * tweepy.OAuthHandler(CONSlfMER_KEY, CONSUKER.SECRET) 16 auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET) 17 api = tweepy.API(auth) 18 19 20 # What the bot will tweet 21 tweet ? 'Hello ALA!' 22 23 # Send out the tweet and print it to the console 24 api.update_status(status-tweet) 25 print(tweet) 26 27 print("All done!")
So the challenge for us, as workshop leaders, was to lead our group toward building a meaningful project, while still addressing basic programming ideas. To do this, we used a scaffolded approach. Scaffolding involves "controlling those elements of the task that are essentially beyond the learner's capacity, thus permitting [them] to concentrate upon and complete only those elements that are within [their] range of competence" (Wood, Bruner, and Ross 1976). Anderman and Anderman also provide a useful introduction to this pedagogical approach (2009). Our scaffolding consisted of a series of premade bot scripts for participants to experiment with. If you'd like to see some examples, several of our bot scripts were published with accompanying instructions in The Journal of Interactive Technology and Pedagogy (Davis and Eaton 2016).
Step by Step
The goal in these workshops was not to teach the mechanics of programming. At least, that wasn't the main goal. We had another higher-level purpose in mind: We wanted to teach participants how to teach themselves to code. To do this, we aimed at developing problem-solving skills and programmatic thinking skills. Once programmers have learned these skills, they are equipped to overcome most programming challenges independently. For this reason, mastering the ability to solve programming problems is a critical to becoming an effective programmer. So rather than teach a fixed body of knowledge, we focused on teaching a problem-solving methodology that would serve our learners well in the future.
The workshops tackled the bot scripts in order of increasing complexity. The first example was a minimally viable bot that just tweets, "Hello Twitter!" To orient workshop participants to the code, we explained how it worked and gave them a chance to run the script themselves. If they wanted to, they could also modify the code and run it again. As expected, some of these attempts at modification resulted in errors, which provided us with an opportunity to talk about what the script was doing and what caused the error. Providing hands-on, supported time to experiment helped participants debug their scripts. Debugging is an essential and unavoidable part of programming. We tried to communicate that errors are a normal and frequent experience--not a failure or something to be feared.
The goal was to build participants' confidence and skill by exposing them to progressively more sophisticated bots. This allowed for an understanding of some core programming concepts, such as iteration, looping, and variables. A significant part of the learning was self-directed through experimentation with the sample bots. This afforded participants the opportunity to try the time-honored programming technique of "changing some stuff to see what happens." They could make changes to their bots, run them, and see the resulting changes (or errors) in action.
We also focused on a gradual transfer of responsibility. At first, we only expected that participants run the bots to see what they do. But as we iterated, the learners had more opportunities to customize the hot to their liking. Customization gave the participants a growing level of autonomy in their learning. Those who became more comfortable with the concepts and techniques could go on to write their own hot code. Indeed, some participants reached a level of autonomy in which they were writing interesting customizations. Ultimately, the long-term goal for the learner is to become comfortable enough with Python to write code from scratch, for a hot or for non-bot purposes. Autonomous, self-directed coding is the yardstick of becoming a programmer. Our scaffolded bot-making approach attempted to provide the first steps on that journey.
Lastly, our workshops highlighted some of the social aspects of bot-making. Bots are not merely technical constructions; they are made for social purposes, and they take social actions. Indeed, stories of manipulative bots from the last U.S. election cycle were very much on participants' minds. For this reason, we thought it was important to address ethical questions. We discussed bot-making as a social activity and advocated for bots that are whimsical and fun or help solve practical library problems.
What We Learned
Developing these workshops taught us a lot about pedagogy. Programming is not an easy subject to teach; it has unique challenges that are not found in many other subject areas. We discovered that a creative, scaffolded approach supported our participants well. Scaffolded examples guided our participants' growing knowledge of coding concepts.
At the first workshop, we pre-installed all of the necessary code on terminals in a computer lab. By the last workshop, at ALA's 2018 annual conference, we had moved to a cloud platform, with participants working on their own laptops. As the project grew, we found that there were a lot of moving parts to orchestrate to make the workshop successful. Fortunately for us, none of the services we relied on broke at a critical moment; each time, we were able to run the workshop without major obstacles.
In the process, Robin and I learned a lot about code pedagogy from running these workshops, and hopefully participants learned a bit about writing code too. We got a lot of positive feedback, which was really encouraging. Certainly, we all had a lot of fun, and we built some Twitter bots that contributed some humor, nonsense, and librarianship to the internet.
However, the workshops did come to a decisive end. In July 2018, Twitter created a new bot-registration process that severely limited our ability to run the workshop. Under the new rules, bot makers needed to complete an application in order to access the Twitter API. Presumably, Twitter did this to improve the quality of bots on the platform. While that is certainly a worthwhile goal, one of the side effects is that it prevents beginning bot makers from getting started. Unfortunately, there was no feasible way for participants to complete the bot-application process during the short time frame of the workshop. Alternately, asking participants to complete the application in advance wasn't feasible either, as there would be no way to ensure that all participants were on board before the start of the workshop. For this reason, the Twitter bot workshop at ALA's 2018 annual conference was our last.
But Then Again
The approach we developed could probably be replicated using another platform, such as Slack (the chat service) or Mastodon (the open source social network). While these two services are both less well-known than Twitter, they both have useful APIs that allow for building bots. We haven't tried these in a workshop setting, but they are an interesting possibility for future programs.
Anderman, E.M., and Anderman, L.H. (2009). Scaffolding. Psychology of Classroom Learning: An Encyclopedia (Vol. 2, pp. 759-763). Detroit: MacMillan Reference USA.
ACRL. (2015). Framework for Information Literacy for Higher Education. Retrieved from ala.org/acrl/standards/ilframework.
Davis, R.C., and Eaton, M. (2016). "Make a Twitter Bot in Python: Iterative Code Examples." The Journal of Interactive Technology and Pedagogy. Retrieved from jitp.commons.gc.cuny.edu/make-a-twitter-bot-in-python-iterative-code-examples.
Wood, D., Bruner, J.S., and Ross, G. (1976). "The Role of Tutoring in Problem Solving." Journal of Child Psychology & Psychiatry & Allied Disciplines (Vol. 17, No. 2, pp. 89-100).
Mark Eaton (mark.eatoniakbcc.cuny.edu) is a reader services librarian at the City University of New York's Kingsborough Community College. He is responsible for social media at the Kingsborough library and often writes Python code to support his colleagues, students, and the library.
|Printer friendly Cite/link Email Feedback|
|Publication:||Computers in Libraries|
|Date:||Sep 1, 2019|
|Previous Article:||Google Forms: FOR LIBRARY TECHNICAL SERVICES: [T]HE TECHNICAL SERVICES DEPARTMENT USED GOOGLE FORMS TO CREATE A SURVEY THAT ALLOWED LIBRARY STAFFERS...|
|Next Article:||Organizing Data and Practical Data Science.|