Introduction to Programming 000

Quite some time ago, I went to college for Computer Science degree. I knew that I wanted to provide for a family, that I didn’t want to perform a job with a lot of manual labor, and that doctors and lawyers would fit the bill. But I also knew that I was good with computers, I’d hacked a few games after all. I’d even written a few programs. In fact, the first one I ever “wrote” I can still provide from memory.

10 print Hello World
20 goto 10

But let me get into what this post is really about. An introduction to the world of programming. Currently, I’m teaching my son 6th grade math. It’s introducing him to Algebra. Algebra is cool. It makes math useful, repeatable even. It’s kind of what programming does. The first things you learn in school are definitions, terminology, the words, and what they mean. That way you can communicate with everyone else that learns about the same subject. Without further ado, let me introduce you to some common concepts of programming.

Operators

Just like 6th grade math, you need operators to do anything. Consider 2+2. It equals 4. That’s what your 1st grade teacher taught you. The ‘+‘ sign is the most important piece here. It is the operator. It tells you what to do with the things around it. There are lots of operators out there. Most of the ones you learned in Math apply. And there are few other special operators – but we need to cover other items before we introduce them.

Variables

Leaning back on algebra, variables are representational. They can vary in what they represent. For example, if we say x is a variable, and we have an equation x+1=2, we know that the x variable is 1. Or, if we say, the total is x+1, we can set x to a certain number, say 2, and know that the total is 3. Variables are a huge part of programming. Without them, we wouldn’t be able to record the result of operations. Now, speaking of operations, one of the special operators, is the assignment operator.

In many languages, the assignment operator is notated by the = sign. In other languages, it is a combined => symbol. An example of an assignment operation, would be as follow.

x = 10+2

if we were to print the value of x, it would say 12.

Types

Unlike Algebra, programming variables can be different types. This is because, different things need to be tracked in a computer. In algebra, you’re just tracking numbers. Examples of different types are:

  • integer
  • boolean
  • string
  • object
  • float

An analogy would be something like measurements. If you try to measure flour for a cookie recipe, and you use 2 tablespoons instead of cups – or – you used 2 grams instead of 2 cups – you end up with goop (I know from experience, goop doesn’t taste good). And for this reason, programming languages use types. Keeping track of a of number is an integer. Keeping track of someone’s name, well, that’s a string, and keeping track of your next door neighbor and their email address (is creepy) but that group of types, that’s an object.

Differences between Programming languages

I’m not going to cover a lot on different programming languages at this time. Just know they are out there. A lot of the core principles are the same, or similar, even if the terminology is different. This is because the C programming language became an effective way for programmers to convey ideas. If you’re into language history, think of it as the ‘Latin’ of the programming world in that a lot of other languages stem from it.

Next step

At this point, I’m going to recommend downloading Golang and finding a text editor or IDE. Because eventually, we’ll get started on using some of these concepts in an actual application. Once you’ve gotten an IDE – head on over to Program 1: Build a simple text bot!

A day in the life of a Computer Science Major

If you’re wondering what declaring a C.S. major will look like – read onward. Turns out, you’ve already figured out you want to work on computers, not toilets. No offense to toilet fixers, but it’s just not my cup of tea. The same goes for doctors – it’s great they save lives, but, there’s just too much trauma involved. Well, you’ve made it to school, college, university, pick your name of choice. And here is what a day in the life of a computer science major really looks like.

You go to class, like everyone else. And if you’re at a liberal arts college, you got to the same classes as a everyone else. There’s only one or two classes a semester you really care about – the other classes are all just ‘there’ as part of the program. So we sit through the superfluous classed, get down enough information to pass whatever test it is, then hold out for the interesting class that involves some kind of coding. Pretty similar to anyone going to a credit filler class.

Now, it’s time for a real class. Professor gets up, starts off with a crazy story about how his commute was <insert generic story here>. 5 minutes later, everyone has straggled into the classroom. The talk now shifts to a Q/A session – quickly followed by a round of projected code – then 20 minutes of the class trying to do what the professor asked. Homework handed out, and that’s it.

Now, some C.S. majors take the down time for doing the assignment. Most skip and hangout, watch trending and relevant stuff – or play games. The gamer stereotype has slowly been fading – but it is still quite prevalent. In other words – a C.S. major has pretty much the same college life as any college student – it’s just the extra curricular activities not covered here that are truly different.