Teaching with Block-Based Programming Languages

Block-based language can play a crucial role in introducing students to computer science.

When I received my student teaching/field experience placement for the semester, I was pleasantly surprised to find that my schedule included two course sections of computer science: one intro class, and the other is AP Computer Science Principles. Both classes are introductory courses (no previous programming experience required), although I agree with the College Board’s recommendation that students taking AP CSP have algebra 1 credit as a prerequisite along with knowledge of the Cartesian (x,y) coordinate system. Most of the kids taking the intro (non-AP) course at my school are 10th graders, so just about all of them have obtained their algebra 1 credit by the time they start the class.

Both classes offer flexibility in how the courses are structured. My intro class follows the Microsoft TEALS curriculum which uses the Snap programming language. Our AP CSP course follows the Beauty and Joy of Computing (BJC) curriculum, which also uses Snap. All curriculum resources are adapted and modified for the needs of the students I teach, and it’s nice to have such a solid resource to refer to.

I first cut my teeth on computer programming as a first-year undergraduate student in 2013 using Java. I didn’t stick with computer science for my formal education, but chance and opportunity would play out such that I would later go on to take courses in Python and statistical computing with R. I was certainly never the best programmer in my class, but I thought that I learned tons and had a good deal of fun along the way.

I have moderately strong feelings that Python is a great first computer language. Sure, you lose some of the slightly lower level stuff that gets abstracted away for learners compared to a language like Java or C++. I know when I first started learning Java, some of the boilerplate stuff was pretty intimidating. Take for example, a standard first program in Java:

class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!"); 

Compared to the same thing in Python:

print("Hello, World!")

Most students will think: what the heck is going on in that second line of the Java example? One day students will understand what each bit of that line means, but most of the students I teach just need to see something accessible on their screen. More importantly, they need to see a coding project that runs to boost their confidence and inspire them to try and create newer, better things.

One really nice thing about the two courses that I teach is that educators have the flexibility to choose which programming language the courses are taught in. Normally, I’d proudly proclaim to the masses that Python is the best language for those new to computer science. I still think it works incredibly well for undergraduates, adult learners, and highly-motivated high school students. The more I learn about teaching computer science at the high school level, the more convinced I am that block-based programming with an introduction to Python as pacing/time allows is the best way to support and nurture a love of programming with this population. Near the end of the school year, my students will get to explore Python a bit and I’ll be curious to see what they think of it.

I used to look down on block-based programming languages like Snap and Scratch, but now that I’ve been using them to teach introductory high school programming for about a month I’m singing a different tune.

A simple random number game created in Snap. The program generates a random number between 1-10, and asks the user to try guessing the number until they get it right.

My students are excited to complete hands on projects because they can dive right into the Snap environment and try out new ideas and concepts. The visual nature of block-based programming helps students understand how different concepts and logic fits together, and honestly Snap feels more like a game sometimes rather than a proper programming language.

Will the next AAA video game title or technological breakthrough be coded in Snap? Absolutely not. But if I can use block-based languages as a tool to get kids excited about programming, to go on and create with languages like Java and C++ (or even just develop an appreciation for the role of computing in our society), then I think I’ve done my job as an educator.