Overview: Algorithms and Programming

Overview: Algorithms and Programming

Context

This strand is at the core of how computer science gets done. Programming is how humans give instructions to the computer, directions are encoded into commands that the computer follows. Everything a computer does is encoded.

This idea of encoding directions is not unique to computer science. Throughout human history people have used encoded information to collect and transmit step by step instructions. The industrial revolution moved production from handmade items, to the use of machines. This eventually became the modern assembly line, where following exact steps produces predictable results in terms of product quality. 

This examples highlight central elements of the practice of computer science. Larger problems need to be broken down, or deconstructed, so that the steps can be repeated and produce consistent results. These steps can be encoded as specific instructions. In the case of a factory each stage represents a small step in creating the final object.

In other examples these step by step instructions are encoded using some type of written instructions. In music composers write out the notes for musicians to follow that include information about how fast or loud to play. Written musics also includes information about repeating sections. We will see this same structure in programming, called loops.

It is helpful to remember computers are basically dumb boxes (despite all the buzz about artificial intelligence). They need exact instructions, in the right order, to produce correct results. All software used, from a web browser to an app on a phone, is written by a person or team of people using programming languages.

Definitions

Encoding is changing information from one form of information into another.  Writing letters to represent sounds is a form of encoding, just like elevator buttons represent the floors of a building. Writing programs includes creating the steps we need a computer to follow, then encoding them using a programming language. These commands must be exact, they have to do the exact same thing every time. This predictability is what allows us combine commands to design algorithms.

Algorithms are step by step instructions that produce a result. Humans use algorithms to decompose processes into step by step instructions, and often algorithms are used to create processes that can be automated. 

In the context of computer science  algorithms must:
  1. Use a common set of instructions that are clearly defined and produce consistent results. 
    1. In the context of programming these are the commands. They are precise and understood both by the human programmer, and the programming environment (like Scratch or Python) that translates them into commands the computer will run.
  2. The instructions are carried out in the correct order to produce the desired result. 
    1. Think about putting the ingredients of a cake in the oven without measuring and mixing them first. The steps may be correct and clear, but the order will not a cake. 
  3. Produce a result and eventually end
    1. If you have ever had a mobile phone or a laptop freeze and need to be rebooted, you have likely experienced an algorithm not ending correctly.
Programming languages are created by people and used for different purposes. For example Python is meant to be an easy to read language that can be used to create application for computers and on the web. On the other hand R was created specifically for doing statistical programming, and is often in the sciences to process data. These are both examples of text-based languages, where the commands are typed into the computer.

Another interface for programming are the block based languages where the programmer drags blocks and puts them together in a specific order to create programs. There are several advantages at the elementary level, including the ability to quickly create interactive graphical programs and avoiding typos and spelling mistakes.  While many of these were developed to be teaching tools for students, some university classes now also use them for computer science courses. Examples include Scratch, Code.org’s AppLabb and StarLogo Nova for Project GUTS. 

Resources

  1. Tools of Programming

External Links

  1. Algorithms and Coral Reefs

    • Related Articles

    • Variables

      Definition Computers store information in binary.  A series of 1's and 0's represent numbers, letters, pictures, and everything else the computer stores. The computer tracks all of these locations so that the data can be retrieved when it is needed. ...
    • Tools of Programming

      Link to Printable PDF When students begin to program, especially in block-based languages, it is easy for them to be engrossed with all of the features. As they explore it is important to both cultivate their excitement for creation and expression, ...
    • What is Computer Science?

      Defining Computer Science Computer science moves beyond using technology tools towards an understanding of how they work and ultimately designing new solutions to enduring human problems. Despite common misperceptions, computer science is not simply ...
    • Overview: Networking and the Internet

      Context: Humans are inherently social and connected creatures, and this drives much of the technology we create. In 1800 BC Chinese soldiers used smoke signals along the Great Wall of China to communicate dangers over hundreds of miles, while in the ...
    • Overview: Computing Systems

      Context: This strand focuses on the hardware in computers. In computer science, hardware is not just about memorizing components, but rather asking the fundamental question - what makes something a computer? As computers get smaller and invade more ...