How We Got Non-programmers to Fizzbuzz in Less Than a Week
We are about to begin our fourth week of Codeup, and the students are currently learning about HTML and how it works with PHP. In three full weeks, our students have learned more about programming in general than most people who start learning on their own. During the first week of instruction, we get our students right to coding. At the end of that week, we have them develop simple programs in command line.
We begin our instruction with an introduction to the command line and the interactive shell. In a future blog post, we will discuss more about what type of environment our students are working with and how to set it up on your computer. For now, we are using Vagrant to boot into our virtual machine in order to make sure all the students are using the same version of PHP and other software. In the interactive shell, students are introduced to PHP and experiment with code there.
From there, we teach students the fundamentals of programming, such as data types and control structures. In PHP, there are multiple data types, so at the beginning, we focus on scalar data types. Afterwards, we challenge our students with arrays and how they can hold other scalar data types along with other arrays.
We also discuss variables, logical and comparison operators, and type juggling to give students a better understand of how variables and the data types variables store can be manipulated using PHP. All the while, we are giving students real world examples of how these fundamentals can be used. This is to keep in their mind that a strong understanding of the fundamentals will lead to a better programming experience. Along with variables and type juggling, we also introduce students to PHP functions, such as echo, var_dump, and print_r, to help them understand how debugging works and to see what their variables and data types look like as PHP is evaluating them.
Toward the end of the week, we talk to our students about loops, such as while, do-while, and for loops. With this knowledge, the students are able to move through loops and have code working within the loops to have specific outputs.
We spend some time each day lecturing, but the majority of the time, students are coding through assigned exercises. They have instructors and fellows moving about the classroom ready to help them if they have a question. We want to make sure students get as much personal attention as possible with our unprecedented teacher-student ratio.
By the end of the week, the students have a strong understanding of how variables work, how math works in PHP, what control structures are and how to use them, what are the data types in PHP, and how to use loops. We challenge them to build FizzBuzz, which is a simple command line application that uses these fundamentals in a real way.
FizzBuzz, for those of you who do not know, is a program that prints out a set of numbers, normally from 1 to 100. For every number that is divisible by 3, the computer prints the word “Fizz” instead of the number. For every number that is divisible by 5, the computer prints out the word “Buzz” instead of the number. Lastly, for every number that is divisible by both 3 and 5, the computer prints out “Fizzbuzz.” There are a number of ways to do it, but the knowledge of the fundamentals of programming is imperative.
What are your thoughts? Please share them with us in the comments. We would love to know your programming story and how you learned how to “FizzBuzz.” Have a solution to the problem? Please share it with us, as well!