Archive for August, 2009

Random Concepts

Wednesday, August 26th, 2009

Sometimes the creative juices aren’t flowing very readily. Sometimes it just seems hard to sustain a train of thought long enough to produce a mini-essay. Perhaps I should try what I see some newspaper columnists do – dispense random thoughts, and perhaps a gem will coalesce from all those little bits.

Not long ago, an idea was floated that it would be good if somehow an apprenticeship program could be developed for RPG. Not many schools teach RPG as part of their computer science curriculum. But how do you start something like that? It’s kind of neat when you can teach someone without any programming experience a computer language, as I am indeed trying to do now. But as an industry-wide trend? I don’t see it happening.

I bought one of those $298 Compaq laptops from Walmart a few weeks ago, and I am pleased with it. As it happened, a columnist for ZDNet wrote a column entitled “Culture of cheap: How discount computers cost the consumer.” It provoked a lot of responses, and I was moved to write one – not that it was all that perceptive. The responders were roughly divided into two camps: “You get what you pay for “ and, to quote the American songwriter Ira Gershwin, “It Ain’t Necessarily So.” I was in the second group.

It so happened that somehow, on the Web site, somehow all of the quotation marks I used were converted into question marks. (I love PCs…. NOT) Someone who held an opposite view picked up on this, ignorantly slurred my operating system Kubuntu (’Why don’t you install a real operating system , like Ubuntu’- . Of course, Kubuntu is a variant of Ubuntu created by the creators of Ubuntu), then somehow decided my spelling and grammar were lousy, thus proving that I didn’t know what I was talking about. Since my spelling and grammar were impeccable (not bragging, just stating the facts), I simply had to respond to him with a little enlightenment on Kubuntu and suggested to him that he take my post to a spelling checker and a good English teacher and see if it was really that bad. ( I must be getting either older or smarter; I used to respond to stupidity much more sarcastically.)

Finally, I came across a very neat article about the use of Boolean variables in Basic. Of course Boolean variables are used as a data type in RPG; and indicators are just Boolean variables in disguise. The article noted that in Basic, if you say “PRINT 2=2” it will not give an error, it will print -1, “True” in Basic, while “PRINT 1=2” will print 0, “False” in Basic.

Let me quote his assertion now.

“It seems that relational expressions need not exist only within an IF statement or as a condition of a WHILE loop, yet those are the only constructs in which one ever sees them being used. Which brings us to The Great Unknown Of (Basic) Programming, and you heard it here first:

The relational and logical operators can be used in ANY mathematical context!

A corollary to that is:

Any LOGICAL CONDITION can be expressed as an ALGEBRAIC EQUATION

That means formulas. (It also happens to mean that the keywords IF and THEN are technically redundant, and that any program can be written without them! “

Isn’t that a neat idea! I don’t know for sure how I’ll be able to use it in the future.

So X=2: IF Y<>0 THEN X=3

becomes

x= 2 – (Y<>0).

As he expresses it: “The term (Y<>0) is evaluated. If true, it is assigned a value of -1. The expression becomes X = 2-(-1), or 3. Should Y = 0, then (Y <> 0) would be false, and its value 0. Then, X = 2-(0), or 2.”

Of course since in RPG the true and false values are ‘1′ and ‘0′ and are not really numeric values, it would take a little work to adapt the concept to RPG; and since I’m doing this late at night, my brain is only running at half-speed, and a full elaboration of the concept will have to wait. But to be able to eliminate Ifs and whiles! That way my code could be guaranteed to be obscure! But maybe I’d better go slow on this. :)