I have wondered several times how I would introduce 'programming' to someone who has never done it, not even a little bit.
Below is Larry Wall's take on it. He is the creator of Perl programming language.
The rest of this post is based on an idea from the above video - the idea of robots being at your disposal to do certain tasks.
We can probably explain programming-constructs, by :
And that is probably half the battle won right at the start.
------------------------------------------------------------------------
More complex point that can be introduced after a couple of programs -
------------------------------------------------------------------------
Example:
PROBLEM:
Print numbers 1 to 100 on screen
TINY-ROBOTS AT YOUR DISPOSAL:
1. LOOP tiny-robot
2. PRINT-TO-SCREEN tiny-robot
Info about the LOOP tiny-robot -
obviously since it is a robot, we have to tell it exactly how many times it has to loop;
once we give tiny-robot this number, it stores it and starts looping; it keeps track of how many loops it has completed, how many are remaining, etc; the LOOP tiny-robot is quite smart in this aspect.
Info about PRINT-TO-SCREEN tiny-robot -
this tiny-robot does nothing but print to screen whatever you give it.
SOLUTION:
Instructions from us (programmer) to the tiny-robots will be:
"LOOP tiny robot - please loop 100 times"
"During each loop, since you keep track of how many loops you have already done, give that number to the PRINT-ON-SCREEN tiny-robot, and ask it to print that number on screen.
-------------------------------------------------------------------------------
(In the above example, I have tried to tackle the 'loop' construct, which is a slightly advanced concept for an absolute beginner.
Have to try and add IF-THEN-ELSE construct example;
If idea seems good, perhaps, I will try to create examples for all the main programming-constructs.
In the worst-case, it can be a good way for me to try out while trying to understand new concepts)
Below is Larry Wall's take on it. He is the creator of Perl programming language.
The rest of this post is based on an idea from the above video - the idea of robots being at your disposal to do certain tasks.
We can probably explain programming-constructs, by :
- asking the student to imagine that each programming-construct is actually a tiny-robot. So, for e.g., a for-loop, is actually a tiny-robot that is capable of just doing a 'loop'. Similarly, we can imagine a if-then-else tiny-robot, print-to-screen tiny-robot, etc
- Notice that I modified 'robots' to 'tiny robots' so as to convey the idea/feeling that a tiny-robot can do a 'tiny' task
- This idea might work because everyone knows that robots need to be instructed what to do i.e. robots need to be given 'commands'.
- And it is also easy to add that the commands have to be very specific, otherwise the robot will not understand what to do. We would have introduced concept of 'syntax' by doing that.
And that is probably half the battle won right at the start.
------------------------------------------------------------------------
More complex point that can be introduced after a couple of programs -
- We can ask the tiny-robots to give commands to each other.
------------------------------------------------------------------------
Example:
PROBLEM:
Print numbers 1 to 100 on screen
TINY-ROBOTS AT YOUR DISPOSAL:
1. LOOP tiny-robot
2. PRINT-TO-SCREEN tiny-robot
Info about the LOOP tiny-robot -
obviously since it is a robot, we have to tell it exactly how many times it has to loop;
once we give tiny-robot this number, it stores it and starts looping; it keeps track of how many loops it has completed, how many are remaining, etc; the LOOP tiny-robot is quite smart in this aspect.
Info about PRINT-TO-SCREEN tiny-robot -
this tiny-robot does nothing but print to screen whatever you give it.
SOLUTION:
Instructions from us (programmer) to the tiny-robots will be:
"LOOP tiny robot - please loop 100 times"
"During each loop, since you keep track of how many loops you have already done, give that number to the PRINT-ON-SCREEN tiny-robot, and ask it to print that number on screen.
-------------------------------------------------------------------------------
(In the above example, I have tried to tackle the 'loop' construct, which is a slightly advanced concept for an absolute beginner.
Have to try and add IF-THEN-ELSE construct example;
If idea seems good, perhaps, I will try to create examples for all the main programming-constructs.
In the worst-case, it can be a good way for me to try out while trying to understand new concepts)
No comments:
Post a Comment