So this thread on Slashdot got me to thinking.
A few years back I was doing program reviews for the State Department of Education. It was an eye opening experience I’ll tell you that. By and large most of the teachers I had interacted with were on the ball, but there were a couple that had I the ability, I would have terminated immediately.
One was a class in which they were learning about the Microsoft Office suite. A laudable goal I suppose. But me being the never happy with the minimum type had a sour taste on this review.
Why? Because on the day we were there the class was working on a payroll spreadsheet. But what really caught my attention was the fact they were using a tax lookup sheet, a physical piece of paper that showed the tax for a given amount.
So I asked the teacher if she had anything planned to use VBA or Visual BASIC for Applications.
The teachers answer was that you needed all sort of math to program a computer and my response was “If you have a semester of Algebra I you can get by.”
In fact I’ll clarify, all you need to do is understand Boolean logic.
There are several constructs in Boolean:
Believe it or not, you learned about this in Algebra I. Yes you did, because Boolean math aka Logic is part of it.
I’ll take it one by one. But first know that for an evaluation to be true the conditions particular to the operation need to be met.
In the case of AND, both inputs need to be true in order for the output to be true.
In the case of OR, only one or both of the inputs need to be true for the output to be true.
In the case of XOR (Exclusive OR), only one of the inputs can be true, not both, for the output to be true.
In the case of NOT, the input is inverted. If a true condition is the input the output is false.
As for mathematics themselves, if you know about integer operations such as modulus, absolute value, and a few other tricks you have the skill set to learn a programming language.
All you have to do is learn the syntax of a programming language. The BASIC language is fairly forgiving. But PHP, Python, and a whole slew of languages, even the overly verbose COBOL use plain English in most cases.
Sure, in some there are constructs like:
if(a && b = 1)
Which translates to do something “if both a and b are true”.
Yeah that simple.
Translated that means execute a loop using variable a as the index. Continue to run the loop while a is less than or equal to 10. The final part that ‘a++’ says to increment a.
That’s C style above.
BASIC is even easier.
if x=y then
Whatever follows the ‘then’ keyword is executed if the test x=y evaluates as true.
So let’s say x=1 and y=1 – that would evaluate to true because X=Y.
The for loop:
for i = 1 to 100
Use variable i as your index variable. Loop through until 100 loops.
Hope that demystifies programming just a little bit for you.