Programming 101

Before you can learn how to program you need to understand what a computer is, a computer at its simplest form is a really fast calculator that can only do one thing at a time. Technically it can do more than one thing at a time but we will come to that discussion at a later date.

In the 1940’s computers and electronics were very basic, there was no internet, no mobile phones or iPods. The world was at war and the Allies and NAZI’s were busy designing computers to assist with encrypting war messages or to accurately predict artillery accuracy. One of the first programmable computers (ENIAC) was developed by the US during WW2 to help calculate artillery firing tables. The ENIAC was able to perform calculations in hours that previously took days. The ENIAC was 100% electronic, the NAZI’s were designing a mix of electronic and mechanical computers (but lucky for us the allies blew it up).

Moving forward to the 1960’s NASA was planning on sending humans to the moon, they needed a way to make computers on the Apollo spacecraft more reliable. NASA contractors files patent US3517171 for a “Self testing and repairing computer”. This patent allowed computers to interrupt a running program and start doing something else more important. Without the benefit of this invention most computers would still be boring calculators running batches of calculations.

So you may be asking when do we stop learning about history and start programming?

    Ok in the next 5 minutes we will create a program to create a new thread, initialize the TCP stack, create a socket to send an ICMP packet to ping a server after returning the context to the current thread, but when the ICMP reply returns we will invoke the current thread via a delegate and update the UI.

Just kidding, we will not be doing that for some time to come. We will do some fun stuff before that.

Going back to our quick history lesson, The WW2 allies and NASA had to learn how to write software, we have to master the same concepts before we can program. We need to understand what processor is and what memory is.

A processor is a silicon chip that performs calculations really fast, it is the heart of your computer/iPad/Laptop. Processors are quite powerful these days but they still have to read our calculations from memory and write the results back to memory. Memory is basically a huge empty storage area for data. When you turn on your computer its memory is completely empty until your operating system or software writes data to the memory. Software can read and write anything to memory (images, videos, this blog post or games).

Processors speed are measured in Mhz and Memory is measured in Megabytes. I am using a processor with 4 processors running at 3,400,000,000 Mhz, on any good second I could calculate 3 billion calculations a second.

Most x86 compatible (Intel or AMD) processors use commands like ADD, DIV, SUB, MUL, OR, AND CALL, to calculator or evaluate data. Instructions like Divide are truncated to “DIV” and Multiply is shortened to “MUL”. Lucky we do not call these commands directly, we have fancy programming development environments to do all the hard work for us. See the full instruction set here


  • A computer is a calculator, we have to tell it what to do.
  • A processor can only read from memory, calculate and write the result back to memory.