Introduction to Computer Programming

Why Learn Computer Programming?

Computers are all around us. Chances are even the appliances in your home like your refrigerator have small computers in them that someone programmed in a language such as C. Programmers are needed to create business applications, phone applications, web sites and video games that run on traditional computer devices. Programmers are also needed to program all those little computers inside nearly any form of electronics that control and connect our world.


What are Programming Languages?

Computers, no matter how advance, only speak one language. Some may say that language is binary, but even binary is an abstraction for what the computer is actually using. At the hardware level computers read voltage levels. In binary, 1 represents a high voltage, and 0 represents a low voltage. Using 1s and 0s to program is machine code. Programming in machine code can be done, but its not exactly human readable. Which brings us to the primary objective of programming languages; to enable us to program computers with human readable code. In the following sections we will introduce some key concepts that are common to most programming languages.



Most programming languages include a means to include other files known as libraries. Libraries make the programmer's life easier because they contain code that has already been written and proven to work. Most languages have some standard libraries, but also include means to create your own libraries. Think of libraries as building blocks than can be used to build our program. If we were building a house instead of a program, libraries would be like the bricks, tiles, lighting fixtures, and other components that we assemble into the house. Each library does something or some collection of somethings. By adding one line of code to our program, we can pull in all the functionality of a library. We will cover how to use libraries further in our Library Tutorial.



Constants are what they sound like. They are values that do not change within our program. For example, the value of pi is always the same and we might want to define that value as a constant if its not already defined by one of the libraries we are using. Another use of constants might be for tuning our program. Lets say we are programming some kind of controller that uses a set of coefficients as gains. We could enter those values every time they are needed directly into the code. However, if we ever want to change those gains, we would have to change the values in the program wherever they appear. If we define these gains as constants, we only need to change the values in one place in the program. We will cover how to use constants further in our Constants Tutorial.



Variables are containers that are used to hold data. Some high level languages do not distinguish between types of data, but most have different types of variables for different types of data such a integers, floating point numbers, characters, strings, and sometime user defined data types. Unlike constants, variables can be changed throughout the program. In fact, the point to many programs is to simply change variables. We will cover how to use variables further in our Variables Tutorial.



Operators are discrete instructions, represented as symbols, used to manipulate variable. There are several categories of operators:

  1. Assignment Operators: Used to assign values to a variable.
  2. Bitwise Operators: Used to perform operations on individual bits of a variable.
  3. Comparison Operators: Used to evaluate the relationship between two variables and return a true or false value.
  4. Logical Operators: Used to perform logical operations and return a true or false value.
  5. Mathematical Operators: Use to perform basic mathematical operations on variables.
  6. Operators used with Pointers. Pointers will be covered in their own section.

We will cover how to use all of the common operators in our Operators Tutorial.


Control Structures

Control structures determine the flow of a program. There are two basic types of control structures in most common programming languages. There are selection type structures that make use of comparison and/or logical operators to select a course of action for the program, and there are loop type structures that repeat a set of instructions until some condition is met. Both of these types of control structures will be covered further in our Control Structures Tutorial.



Functions, also known as methods in some programming languages, are sets of instructions that may be used over an over again. A function does something. It could be as simple as setting a value of a variable or as complex as simulating some kind of physics problem. Rather than write the code to perform these instruction each time they must be performed in the program, we write them only once and refer to them in the form of a function call whenever they are needed within the program. A function can accept values into it often called arguments or parameters, and can return values when they are finished or simply manipulate data directly. We will cover how to use function further in our Functions Tutorial.


Home | Products | Electronics | Programming | SpazzOuts | Contact
© Copyright 2014 - 2017 SpazzTech LLC. All Rights Reserved
Made with Adobe Muse