Learn to Program – iOS: Lesson 1 – What is code?
Tutorial written by TheCodeMonsters
This is the first lesson in the many more to come of “Learning to Program iPhone”. This series is centered around non-programmers looking to learn how to program. But before we get into any code lets talk theory.
I want you to ask yourself, what is code?
And I don’t want you to think of the traditional scientific answer being: “Code is a series of statements that instructs a machine what to do”. No, I mean, what is it theoretically, not scientifically.
Well lets think about what a piece of code does. Here’s a little snippet of pretty universal and basic code:
int a = 10;
Really there two parts to this statement. so lets talk about the first part:
What did we just tell the machine to do? We told it to open up an allotted amount of space on in its memory (ram). So it’s kind of like reserving a table at a restaurant.
We call up the Operating System (the restaurant manager) and tell it “Hey, I’ve got a party of ten people that need a table”. The Operating System will then go into the hardware (the physical restaurant) and will clear up whatever was left there before and set up space for ten people. Now lets talk about the second part:
a = 10;
This is like us arriving at the restaurant with our 10 guests and sitting down. So we’re physically there now.
So now that we understand basic code, lets go back to the initial question, what is it? I believe that at the heart of code and the machine, it’s simply data manipulation.
This is very important (even though its pretty basic) to understand. All were doing is making space, creating memory, and manipulating it.
Well that’s it for lesson 1, I really want to keep these lessons short and “bite-size”. So next time you meet a price of code, think about what it does at a VERY basic level, as shown above. I will have quizzes that you can complete however since this lesson was more theoretical than right wrong answer, I’ll leave it out on this one.