*Magnify*
    April     ►
SMTWTFS
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Archive RSS
SPONSORED LINKS
Printed from https://www.writing.com/main/books/entry_id/956973-Blog-Prompt-Your-First-Programing-Lesson
Rated: 18+ · Book · Writing · #1634630
Brief writing exercises and thoughts on writing. Maybe the occasional personal musing.
#956973 added April 19, 2019 at 9:10am
Restrictions: None
Blog Prompt: Your First Programing Lesson
This post is a response to today's blog prompt from the "Blogging Circle of Friends :

Write about something you're very knowledgeable about, for example a favorite hobby or passion of yours.

I love programming computers. I started doing it in junior high. (I don't "draw crude images on the screen using Logo" on the Apple II computers in my elementary school.) I love it so much, that I made it my career. (In retrospect, that might have been a bit of a mistake. But that's a post for another day. Maybe).

So in the spirit of today's blog prompt,I'm going to give everyone a free lesson in computer programming. Don't worry, you don't need to have any previous knowledge. (Well, that's not entirely true.But trust me, you already have the knowledge you need for this lesson.) We're not going to delve into C, java, C#, the .NET framework, or any of those other weird terms you might have heard. All you need for this exercise is a way to write or type something. So get your pen and paper ready. Or open up Word, Notepad, Pages, or whatever. Because this lesson starts with an exercise. Ready? Here you go.

Write out detailed instructions on how to make a peanut butter and jelly sandwich. Pretend that a computer can understand the English language and will follow your instructions exactly as written.

That's all I want you to do for this lesson. Not hard, right? I mean, I'm betting you know how to make a peanut butter and jelly sandwich. Heck, unless you're allergic to peanuts or something, I'm betting you've actually made a few of them in your life. So you can probably do so without even thinking about it. (That will actually make this exercise hard. And that's part of the point, believe it or not.) So get writing out your instructions. When you're done, we'll finish the lesson.

All done? How'd you do? Let me ask you few questions.

Did you remember to state up front that the reader will need a jar of peanut butter, a jar of jelly, and a loaf of bread? How about a knife? If not, the computer is going to be lost and confused when it gets to the part of your instructions that mention theses things. "Spread the peanut butter on the bread. Wait, I'm supposed to have peanut butter?"

Did you mention opening the jars of peanut butter and jelly? If not, the computer may stand there confused as to how to get the peanut butter out of the jar.

Did you mention using the knife to spread the peanut butter? The computer may use its fingers (or whatever it uses like fingers) to spread it instead. Messy! (And do you want to eat that sandwich now?)

If your instructions said to spread the peanut butter on one slice of bread and the jelly on the other slice (me, I always put the peanut butter and jelly on the same slice of bread and then just put the plain slice on top), did you specifically mention making sure the sides with peanut butter and jelly are facing each other when you put the two slices together?

Did you think to describe how to accomplish simple operations, like opening a jar and spreading something on a slice of bread? Sure you know how to do that sort of thing because you're human and these things are practically muscle-memory. But computers don't have muscle memory. They need to be told how to do these things. Every time, because they don't remember how they did something from before. They only know about what they're doing right now.

So, now how do you think you did? Unless you've done an exercise like this before, I'm guessing you missed some stuff. I know I did. I first did this exercise -- except it wasn't presented as a lesson in computer programming -- back in fifth grade. My teacher had the entire class do this. And then she surprised us by choosing some of our instructions at random (or maybe she picked those she knew would be funny), pulling out a jar each of peanut butter and jelly, a loaf of bread, and a knife and started following the instructions. One set of instructions didn't even mention taking the bread out of the wrapper, so "put the peanut butter on the bread" resulted in setting the entire jar on top of the still-wrapped loaf. Embarrassment and laughter ensued. I don't remember what my instructions looked like, but I'm sure I missed a bunch of stuff.

So don't be too hard on yourself for whatever steps you might have missed. It's kinda the point of the exercise. I bet if you rewrote your instructions now, you'd do a lot better. In fact, if it'll make you feel better, go ahead and do it now. If you do, understand you're actually engaging in the central activity of computer programming.

To do computer programming, you have to look at a task you want the computer to accomplish, understand all the details of what's required to accomplish that task and then express it in a way (write code) that tells the computer how to go about it. The computer needs to know:
1. What inputs and/or data does it need (like peanut butter, jelly, and bread).
2. What tools does it need (the knife).
3. What operations does it need to execute on their inputs (the steps to follow)
4. What's the final output (a yummy sandwich!)

Learning a programming language is simply a matter of learning a particular way to communicate this information to the computer. Knowing how to identify and break down the task is the more important part.

I will note that back when I was in college, I tutored a number of women in their thirties who were taking their first programming class. They often came to me because they were struggling. I found that the reason they were struggling is because their instructors focused way too much on the details (grammar and syntax) of the language. So I'd sit down with them and talk about the assignment in terms of what the program needed to do. Once they started thinking about the assignment in terms of identifying the steps the program needed to take to accomplish the task, they caught on pretty quickly. The moral of the story is that there were a lot of college instructors back in the early-to-mid-90's that were just awful at teaching computer programming to newcomers. (Or maybe colleges were just terrible at making sure newcomers to programming that were taking night classes -- as were most of the students I was tutoring -- got into the appropriate introductory classes.) I sure hope things have gotten better in the past 20+ years.

Of course, there are a lot more things you need to learn to be a computer programmer. For example, we haven't covered functions (also called procedures and subroutines in some programming languages). These are reusable pieces of code that can be called from different places in the program. For example the steps for opening a jar is pretty much the same regardless of whether the jar contains peanut butter, jelly, pickles, or the assortment of screws that my dad has collected over his sixty years of doing carpentry. So you might write an "open jar" function and then in your instructions for making the sandwich you say something like "take the jar of peanut butter and perform the open jar function on it." It's a lot easier than saying "pick up the jar of peanut butter in one hand and grip the lid with your other hand and twist in a counter-clockwise direction" and then say the exact same thing for the jar of jelly.

And that's the nature of everything else you would learn if you kept learning how to do computer programming. All subsequent lessons teach you different ways to understand, break down, and describe how to accomplish the desired goal so they computer can do it.



© Copyright 2019 JarredH (UN: seithman at Writing.Com). All rights reserved.
JarredH has granted Writing.Com, its affiliates and its syndicates non-exclusive rights to display this work.
Log in to Leave Feedback
Username:
Password: <Show>
Not a Member?
Signup right now, for free!
All accounts include:
*Bullet* FREE Email @Writing.Com!
*Bullet* FREE Portfolio Services!
Printed from https://www.writing.com/main/books/entry_id/956973-Blog-Prompt-Your-First-Programing-Lesson