A More Complete Programming Language
TIME LIMIT: 2 HOURS
You, using a pen and paper, can do anything a computer can; you just can’t do those things billions of times per second. - Paul Ford
A programming language is any language used to create a program.
What these programmers are generally driving at with this academic contention is that HTML and CSS are not Turing complete.
Born in 1912, Alan Turing was the grandaddy of modern-day computer science. A stunningly brilliant mind, he was the primary cryptanalyst (code-breaker) for the Allies during World War 2 and is credited with shortening that war by several years and tens of millions of lives.* In 1936 BC (before computers), he published a super-famous paper called “On Computable Numbers, with an Application to the Entscheidungsproblem.” This paper described a “universal computing machine”, which is a machine that can perform any conceivable mathematical computation that can be described. Of course, the machine also has to have enough memory to store the various bits of data it needs to make the described calculation.
This is worth repeating: A universal computing machine is any machine which can perform any mathematical computation that can be described. Another way of saying this: A universal computing machine is any machine which can execute an algorithm, or set of instructions. When you couple the ability to use algorithms (“If this, go do X. Else, do Y.”) with memory to store data, you suddenly have a machine which can take inputs and produce outputs.
Thus was the software industry born. The essential problem then became hardware – how do we make the machines which have memory and can execute programmable sets of instructions? Thus was the computer hardware industry born. The German Z3, built in 1941, was the first Turing complete digital computer. Program code was stored on punched film tape. Initial values were entered manually.
Lest we wax too historical, return to our initial question: What is a programming language? We have decided to distinguish programming languages by their virtue of being Turing complete. A programming language (or “machine”) is Turing complete if you can solve any computable problem that is describable, i.e. you can reduce it to a set of instructions. A programming language is any computer language which will let you write a set of instructions.
So what is a set of instructions? Basically, it is branching logic – “If this, then that.” You can’t (shouldn’t) really use branching logic in HTML or CSS, which is why they are not really programming languages. You just use HTML and CSS to mark up content and then style that content, respectively.
else if, and
Common Features Of Programming Language
Although all that they need is conditional logic, programming languages often let you do the following:
- store a value for future use
- loop over groupings of data
- reuse blocks of code
- some way to talk to the operating system
- evaluate expressions to be either true or false (handy for that branching logic!)
Making Plans With Pseudocode
Before we have written any code of substance in this book so far, we have always made a plan. On a more micro-scale, you should generally make a plan whenever you’re writing any programs. To make programming plans, you should use pseudocode.
Pseudocode is a high-level, informal implementation of a piece of code. It is a description of your logic to solve a problem. It is an algorithm that has not yet been translated into programming language. Here’s an example of an algorithm for asking a user to verify that a sign-up form is correct:
function Verification(data): verified = DisplayVerificationBox(data) if verified.status == true: DismissVerificationBox() SubmitForm() else: GoBackToForm(verified.errors) Event.Listener(FormSubmission) --> execute(Verification)
When you find yourself struggling to write your programming logic in the future, I encourage you to break out your Programming Journal and try to write out the logic in long-hand. Comments in your code are another great place to write pseudocode. Try to think top-down about whatever result you are trying to achieve – abstract your problem into smaller pieces.
- Spend 5 minutes using Google.com to answer the following questions:
What is a program?
What is a programming language?
What is a conditional statement?
What is computation?
What is an algorithm?
What is computer science?
* Alan Turing was chemically castrated by the government for being a homosexual and committed suicide less than a decade after the conclusion of that war.
** Interpreted languages, anyway.