So, what is programming?

Well, that is a good question. And I think that it has a simple answer:
Programming is the act of transforming a desired process into an algorithm and then implementing it.
I don't know if anyone else ever said it that way - So I am going to pretend that I was the first 😀
But what does that even mean? If I want to be a programmer/coder what do I have to do?
Well, there are two major steps there:
  1. Transforming a desired process into an algorithm (a defined set of steps to be followed)
  2. Implementing it
The first step means that you have to figure out all of the little steps that are part of the process that you want the computer to perform. Doing this is usually harder than the actual coding.

Here is an example to illustrate: add up the odd numbers between zero and 100

Well, for a person - that would be enough. Computers need a bit more detail. For example, what is an odd number?

And, this is where pseudo-code makes its appearance. Pseudo-code is something that looks like regular 'human' language but begins pulling in programming concepts.

Here is one pseudo-code version of instructions for this example:
  1. Create a variable to hold the total.
  2. Make sure it is initialized to zero
  3. Start counting up from zero
  4. If the current number is odd - add it to the total
  5. When you get to 100, stop.
As you can see, there are some steps that a person would not need to be specifically told. Computers need all of them (and some others that I left out). But, taking the time to analyze the problem and start breaking up high level processes into smaller steps - you are making the problem into something that can be implemented in code. There is no 'pseudo-code' language and you are free to make up your own. As you begin to be more familiar with programming you will probably find yourself writing something that looks closer and closer to actual code. Eventually you will most likely find yourself essentially writing code right off (at least for simple programs).

If that was pseudo-code then what is 'code'?

Code is just pseudo-code rewritten using the syntax, keywords, and formatting of a programming language. The reason that pseudo-code is useful is that the same pseudo-code can be translated into multiple programming languages.

Here is that pseudo-code rewritten in JavaScript:


 And, here it is in Python 3:



Modern programming languages have been created to share similar features (when everyone can agree on them) and their own features (when they disagree).

So - that is essentially what programming is. Turning a human description of a problem into a computer description of how to go about solving it.

This example is trivial and you don't need a computer to solve it. You could just as easily do it on paper or in your head. But using a computer is probably faster. And if the problem was harder?... Like sum up the numbers to 1000, 1000000? Minor changes in even this program would allow you to extend what it can do to solve both of these.

Where computers and programming really come into their own problems start getting bigger and it would take a person a really long time to solve them.

Creating pseudo-code is something that anyone can do with or without picking a programming language to learn or even having a computer! And the kind of thinking that it takes to start breaking problems into pseudo-code can be useful even if you never actually write a line of code. It helps you to really understand the problem and what goes into its solution.

Moving on to transform pseudo-code into actual code is where the magic comes in. It is one of my favorite things to do because it is a creative process where you get to bend the computer to your will and make something in your head...real.

Comments

Popular posts from this blog

Is trying to program making you loopy...?

Laid out (arrayed) out before you...

Constants and Variables....