Coding... Like Baking an Apple Pie@ Piscataway Public Library
Submitted by: Doug Baldwin, Piscataway Public Library, Jan 5, 2014
In 2013, there has been a significant surge in the “learn to code” movement that has taken various iterations. From MOOCs like those offered by Udemy and Khan Academy, to initiatives like Code Hour and Code Year, everywhere we are hearing the battle cry that learning to code is a skill that as many of us should be acquiring as possible. However, this movement is not without its detractors. Go ahead, do a Google search for “why learn to code” and see that there is an almost even split between blog posts and articles trying to convince you to learn, and those telling you why you should not, and of course many that fall somewhere in the middle.
Spending time here engaging in the pros and cons of each camp could take a series of articles so I will leave that homework to you … Oh com’on! I wouldn’t be a nice librarian if I did that now would I? Actually, I will post some of these articles at the end of this article for your review :)
In the meantime, I would like to use the rest this article to provide a brief, and hopefully easy to understand primer on what code and coding are. With that, we can move into more interesting arenas and resources if the topic starts to peak your interest(.. and I hope it does!).
So let’s define coding, or what used to be more commonly referred to as programming, when I was learning. Coding, at its core and essence, is about writing instructions that a computer or electronic device can follow to perform a particular function or set of functions. Not so scary right? I mean we write or provide instructions to people everyday at the reference desk or in our personal lives. We provide them verbally or we write them down in an order that people can follow and understand, from using a database to baking an apple pie. Well, actually, putting it that way, we are all really coders then right? Hmmm… to a certain extent yes, but then lets start to add in some of that “scary” stuff shall we?
So coding is providing a set of written instructions for a computer, or device, to do something. These instructions we produce by coding we can refer to as “code”. Ok, let’s add something scary like…hmmm… syntax. In coding, as in linguistics, syntax refers to the set of rules that we need to follow in order for the computer/device to understand our written instructions. As long as those written instructions conform to the proper syntax rules, it should be understood (even if does not do what you think it should, it should at least be understood). Syntax guides the way in which we write our instructions, just like ending a sentence with a period, or indenting a paragraph.
Speaking of linguistics, we all know that there are many different languages in which we communicate with each other. Both the speaker/writer and the audience/reader need to understand that language being used for ideas to pass from one to the other. Different languages can have different syntax rules, that apply specifically to that language. The two go hand in hand. The same goes for code as well. There are many different languages in which code can be written. The languages can be just as varied as human language and learning to code can be compared to learning a new language.
Lets look at a few quick examples. See the following statements below:
print("Hello, World!") - Python programming language
PRINT "Hello, world!" - BASIC programming language
<?php echo "Hello World!"; ?> - PHP programming language
puts "Hello, world!" - Ruby programming language
All of the above statements do the exact same thing: they print the words “Hello World” on your computer screen. It is a common simple example used when first teaching a coding language. What is also demonstrates here is the point that each language has its own syntax. Each statement produces an identical result, but depending on the language, is simply written differently. You can see even more examples of the ‘Hello World’ program here:
Ok, so what have we learned so far? Code is written instructions for a computer/device. Code is written in a language a computer/device can understand. Each language, no matter which is chosen, has a set of rules, or syntax, that must be strictly followed in order for the computer to follow the code. Not so bad right? While this may be overly simplified for some (for you folks, I apologize), I hope I have at least allowed others to take a first step toward being less intimidated by the concept.
Over the next few articles I hope to address the following, and likewise hope that you will join me:
Why is this something I should take the time to know about?
How does code and coding apply to me as a library worker? Or to programming (no pun intended) and my patrons.
Ok, so I might be interested, how can I get started in learning to code?
Final thoughts on coding
Articles on Why, or Why Not, Learn to Code:
- Productivity Tools
- Design & Development