What is Code?

For our purposes, the instructions that you put together to tell a computer what to do constitute code. That idea may seem relatively simple, but things can get complicated when you consider exactly how you provide these instructions. Do you write a note? Do you speak up and say "OK, Google..."? Do you thumb through thick paper manuals and craft a text file that is fed to a C compiler?

If any of these approaches can get a computer to do what you want it to do, then it's reasonable to say you have created code. Many students are first introduced to computer programming using a system called Scratch, that looks like this.

Scratch is sort of like a bucket of building blocks that allow you to write programs by snapping pieces together. The right hand part of the screen above shows part of a Scratch program that moves a ball back and forth on the screen. In order to write the program, you drag elements from the middle section to the right hand section. The elements will only fit together in certain ways, so using Scratch can make it easier to create programs that don't contain certain types of errors. On the other hand, there are not a lot of programming systems that use this drag and drop approach, so if you want to move on to other forms of programming, you will need to learn new techniques.

Here is an excerpt of a program written in the C++ programming language.

This may look more like a sequence of mathematical equations, which it sort of is. This code is part of a program that draws a Hilbert curve on a small screen. It ends up looking like this

Writing code like this is very versatile when it comes to getting your program written. You just need a text editor. On the other hand, you also need additional software tools to run your program, so even if you have written a program, you won't really know if it works without going through some extra steps.