Teaching coding: What is a faded example?

[This article was first published on George J. Mount, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

When researching this post, I learned that scaffolding is highly coveted material in Minecraft:

Scaffolding helps you reach the top of your builds with ease. Just keep stacking them as you go! It’s also handy for avoiding fall damage.

Minecraft Wiki

Scaffolding can be used to similar effect when teaching coding, in an exercise called the “faded example.”


Imagine a faded example as a sort of fill-in-the-blank challenge, but with code. You can start students with a nearly completed block of code, but ask them to fill in some blanks.

Over time, you can ask for more and more blanks until the student is essentially coding the whole problem. This arrangement is often known as “scaffolding.”

The benefits of faded examples

This approach helps students work from example to example, learning progressively more about the code as they advance. It introduces an element of interactivity and debugging into the exercise in a way that starting off a blank file does not.

Faded example demo

The below is a greatly simplified example of a faded example done in the R programming language. Here, you are asked to call some basic functions on the iris data frame.

Notice how you go from some “scaffolding” in the first question, to none in the next.

# This will get executed each time the exercise gets initialized iris <- read.csv("https://raw.githubusercontent.com/uiuc-cse/data-fa14/gh-pages/data/iris.csv")
# A data frame named iris has been loaded # to your environment. # Print the first six rows of iris. ___(iris) # Print descriptive statistics for iris. ______
head(iris) summary(iris)
test_function("head") test_object("iris") test_function("summary") success_msg("Congrats on completing a faded example!")

Check out this article for an overview of data exploration in R.

This pattern of practicing code will be immediately familiar to you if you've ever taken a course at DataCamp. (Disclosure: I am the developer of the DataCamp course, Survey and Measurement Development in R.)

Learning how to teach code

From this example you should see that it takes more to teaching code than giving students a blank text file and asking them to start typing. There's lots of cognitive science and technology at work.

For more presentations and ideas of how to teach coding and data analytics, subscribe to my resource library.

To leave a comment for the author, please follow the link and comment on their blog: George J. Mount.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)