Vacation Time!

Head’s up: We will be closed from tonight until Monday, in observance of hunting season! Feel free to leave a voicemail/email, and we will return it Monday evening.

Grand Opening!

Hope everyone had a happy 4th! we’re officially open for business!! Computer running slow? Want some upgrades? Give us a call at (509) 863-3316!

Teaching the Girlfriend to Code: Part 1, The Absolute Basics

Hello love! This one’s for you. I’m gonna start writing a collection of lessons on how to program, just for you (cause I love you, and you wanted to learn anyways <3).

I guess at some in point in time, I have to start at the very beginning. The very, very beginning, I have an article on the history of computing floating around somewhere, so I’ll leave that part out, and skip to “what is programming for?”

What is programming for?

In short, developing software, AKA computer programming, is a way of commanding a computing device (desktop/laptop, mobile phone, tablet, heavy machinery, etc.) to perform a series repeatable tasks. Simple enough, right? That being said, computers are relatively stupid; they cannot act for themselves, and can only do exactly what you tell them to do, meaning if they do something wrong, it is because they were programmed to do it the wrong way.

Computers are instructed, or programmed, using programming languages. A programming language is exactly that, a language. This language can be translated into something called machine language, which can then be understood by the computer and used to command it. As of right now, there are literally thousands of programming languages that can be used for programming. Some of these languages are mathematical and look very cryptic (example: C and C++), while others and very similar to English, and can be read as such (example: Visual Basic). If you want to see what some of these languages look like, check out the 99 Bottles of Beer website. They have the song 99 bottles of beer written in 1500 different programming languages!

Types of programming languages

With there being literally thousands of programming languages that are used for different purposes, it would be helpful to start breaking them all down into categories. The big three categories are:

  • Markup languages – Are used to decorate a document (like a research paper) to do things like highlight text, indent paragraphs, etc. Originally, this was the main purpose or markup languages, HTML (acronym for HyperText Markup Language) being the first notable markup language. Now, markup languages are pretty much just used to make websites.
  • Scripting languages – Are programs that are written to run inside of and control other programs. These “scripts”  are read by a program, and then the program translates them to perform tasks. The only difference between a scripting language and a regular programming language is that a scripting language can’t run directly on a computer without the help of other programs.
  • Programming languages – Are used to instruct the computer itself to perform tasks.

The programming language category can then be split into three more subcategories:

  • High-Level programming languages – A programming language is considered “high level” if the programmer can use the language without worrying about the details of the computer itself. If you can write your program without having to care about things like “what manufacturer of computer is this program going to work for?” then you are using a high-level language.
  • Low-Level programming languages – A “low level” programming language is a language where the programmer needs to know pretty specific information about the computer they are working on. Low level languages are usually pretty hardware-specific, meaning that your program may only run on certain computers, and not work at all on others.
  • Assembly Language and Machine Code – Assembly language (usually just called assembly or “asm”) and machine code are essentially the same thing. Assembly is a human-readable version of machine code, and machine code is the one and only language computers actually understand. Assembly itself is considered a low-level language, it only works on the hardware that it is designed for.

Let’s take a look at an example of some of these languages. Let’s say we have a variable x, and we want to make it equal to -1. In a high-level programming language, this could look like:

x = -1

If you were to look at a low-level language like assembly, you could probably see something like (at the very guts of it, there would be a lot more work to do to get to this point):

MOV ECX, -1

Cryptic, right? Guess what the computer itself sees? Something along the lines of:

00000030B9FFFFFFFF

in hexadecimal. Or, much more accurately (in binary):

000000000000000000000000001100001011100111111111111111111111111111111111

What the hell is up with all of these weird numbers you ask?

Numbering Systems

This might be a bit of a tangent, but it is good to know. Humans (yourself, and possibly me to) use a Base-10 “Decimal” numbering system for everything, meaning that our numbers go from 0-9. Computers, on the other hand, use a Base-2 “Binary” numbering system, meaning the only numbers that exist are 0 and 1.

Why? Because a computer (a digital one at least), can only ever be turned on, or turned off. There is no in between. That being said, you’ve seen this before (it’s literally tattooed on my arm):

This is the international symbol for the power button, and it is made by taking the number 1 and laying it over the top of the number 0, to represent “on” and “off”. Yay for symbols!

Back on track. Computers only understand binary, and humans are lazy. As an example, to represent the letter ‘A’ (capital A), the decimal number 65 is used. To a computer, 65 is really 01000001 in binary. But who wants to decode that? When talking about bits and bytes (FYI: a “bit” is one binary digit, and can be 0 or 1, and a byte is a group of 8 bits, which can represent any decimal number between 0-255), programmers use the hexadecimal numbering system, which allows us to write the same number in a shorter way. For this example, the decimal 65 (binary 01000001) can be written in hexadecimal as “41”. Don’t worry about figuring out how to translate between the different number systems yet; an advanced topic for another time. There is a handy website here that will show you these conversions, if you’re interested.

So why do computers only understand binary? That’s simple. A computer is just a machine that runs off electricity. Electricity (in it’s simplest form) can be turned on or turned off, just like a light switch. A computer itself is just a collection of millions of light switches wired together. Since these switches can be on or off, we can represent them with two numbers, 0 for off, and 1 for on. When you write code for a computer, all you are doing is telling the computer which switches to turn on and off, and when to do it.

Summary

  • Programming is the art of telling a computer what to do
  • There are thousands of programming languages
  • The main categories of languages are programming, scripting, and markup languages, which all have their own uses
  • Programming languages can be high-level, low-level, or machine code
  • Humans have 10 fingers, computers are light switches

Like this article? Feed the developer, every dollar counts: