In the last post, I talked about how programming is built upon logic and problem solving. There are entire books that teach programming without even discusses computers. And while there are 100s of programming languages in existence, the key concepts remain constant.
Okay, but what is programming?
A definition frequently throw around is:
“A computer program is a set of instructions…”
To me, that sounds very vague. Like cooking a meal or something?
Actually… yes. Oftentimes people use cooking (think of the video in the last post) to demonstrate how coding works. (Oh yeah, I should probably mention that when I say “coding” I mean “programming.”)
Essentially, a computer program is sequence of separate, small commands one after another. You are giving directions to the computer by taking a larger idea and breaking it apart.
What do these instructions consist of?
Programs can consist of many small things — adding two numbers together, displaying text, creating shapes, changing colors of those shapes, etc.
The computer, then, takes these instructions and executes it at lightning speed. I know it’s hard to wrap your head around now, at least for me, but that’s how you end up with all these complex games like Angry Birds or Candy Crush. It’s just the combination of much simpler sets of instructions.
Computers do exactly what you tell them.
So, the instructions you give better make sense.
Instructions are called statements. And they are like sentences in English.
“(Statements) use words, numbers, and punctuation to express one thought, one individual piece. Most programming statements are pretty short, just a few words. Now, exactly what words, numbers, and punctuation you use depends on the programming language.”
— taken from the Lynda.com’s Foundations of Programming Online Course
Essentially, computers are like extremely (actually impossibly) well behaved dogs. They listen to your commands. Again, the exact way you give a specific command depends on the language being used.
Images: Lucas Richter/Flickr; Dinner Series/Flickr