Programmer's Points: "Hello, Linux!"

Column written by M. L. C. Pluspluss on Wednesday, March 3, 1999

from the welcome-to-1980 dept.

As I have become a member of the Open Source "community" I have discovered that while many of you can talk the talk, not as many can walk the walk in terms of coding your way out of a wet paper sack. Why look at all the silly posts one sees on that tiny little rag dashdot.borg and how ignorant many readers are. It is "make the window grab the background pointer" this and "feed the list slowly into /dev/null so it doesn't choke" that. I've come to realize that while many are wan'abees, few are trained. I was quite satisfied to leave this state of affairs as it is (we won't be able to keep milking this Y2K thing forever, you know) and just make sure my card was left with the employer of those same wan'abees.

But the courage shown by my colleague, Jon Splatz, in stepping outside of his comfort zone, of moving into the new world while bringing his own particular brand of expertise to a new community has inspired me.

You see, I am an expert programmer for the world's greatest operating system (yes, I know many of you have already guessed it, it is Microsoft Windows for Workgroups) but I have found that there is change on the horizon. New and strange programs have been coming out of Redmond of late. I've heard something about Windows 95 (though how they could have jumped that many versions without a press release is beyond me). The troubles in Washington, particularly the questions about whether DR DOS is being unfairly prevented from competing with MS DOS have alarmed me to. Add to this the difficulties over Stacker and I just knew the time for change had come.

So like many in this business, I am re-evaluating my skills and looking for new opportunities. It just so happens that Humorix, looking for new talent contacted me, mentioning that one of my business associates had referred them to me as something of a joke (I think he meant, the teller of a good joke; that Dave always talks so fast I'm sure Mr. Braug just didn't hear the whole sentence). While I can see nothing very funny about programming and I'm not quite sure why a Humor Web site (such as it is, frankly I don't exactly get all these jokes about Linux) needs an in house programming tutor, I'm up for the challenge.

So for my first discussion, I thought I would start with something simple like your basic "Hello, World!" program in BASIC. Unfortunately, Mr. Braug explained, BASIC just isn't news for nerds or stuff that matters.

I was aghast when I heard this (I'm a nerd, or at least that is how they referred to me in school, and I know BASIC very well; not as well as Bill Gates, maybe, but pretty well). Some of my best work was done in BASIC. In fact, my senior project back when I was in college was a highly sophisticated tic-tac-toe player that could win nearly 50% of the time against a six year old (my sister).

Everyone should learn BASIC. To understand Windows programming, one really must have a good understanding of BASIC because this was the primary (some say only) language Bill Gates would allow to be used at Microsoft during the crucial years when the foundation of Windows was being built. I've been told by reliable sources that the origional version of Microsoft Money was written in BASIC (of some sort). The later switch to C++ for the operating system was a mistake in my opinion because of the loss of flexibility it entailed.

I really have no wish to step on my generous employer's toes in my first article but considering the pressing needs of familiarizing you, the gentle Linux enthusiast, with your past (and perhaps a part of your future?) let me present to you a first BASIC program.

1. Line numbers

You will find line numbers to be fundamentally useful and important devices for helping you decide which line should execute next. Some versions of BASIC have adopted labels as a means of identifying sequence in execution but I feel that the advantages of line numbers greatly outweighs their supposed disadvantages. I've even heard, though I've never been forced to wade through such code, that some degenerate versions of BASIC don't use line numebrs or even labels (Such versions should be carefully avoided as the abominations they are).

You will probably want to use a base 10 numbering system, separating each statement by 10 ordinal units. I have encountered some code that used a hex numbering system. This was quite helpful for calculating the amount of delay provided by a goto loop-delay circuit (but I will avoid such topics as the advanced use of goto for the time being).

2. The code

Your first line might look something like this:
10 REM This is my first program

The statement separator is the simple new line. No more problems remembering the line terminator symbol (no more ; for all you sufferers under the tyranny of C). Thus your second line might be:

An optional way to clearly end your program is to give this last line:
30 END

And that is it. The Hello, World! program in BASIC. There are several more features we could implement in just a few short moments but I will leave those to you who wish to revisit the cradle of modern computing.

3. Exercises

On your own you might want to try these problems:

    1. Cause the words "HELLO, WORLD!" to be printed over and over on the screen.
    2. Do the same but with each sentence printed one after the other (Hint: look at the GOTO statement).
  1. Cause the word ABBA to be printed out backwards.
  2. From the code you wrote for problem 1b, take the word you reversed in problem 2 and print it over and over.
  3. (More difficult) Implement the Eliza program using just the PRINT command and the GOTO command.

In the future, I will continue to introduce the roots of the modern computing environment by looking at the fundamentals of some key operating systmes. I also plan to investigate proper coding style, proper documentation, specification, implementation, and my personal favorite, proving correctness. It is my humble goal to provide you, the Linux enthusiasts, with the skills you need to help Linux take its place alongside the great operating systems such as MS DOS/Windows and CP/M.

Rate this story

No votes cast