Learning how to program in Oman in the 90’s
I grew up in Oman and lived there until I finished high-school in 1999. In 1991, when I was ten years old, my father bought me a 386SX for my birthday having noticed my burgeoning interest in computers. For the first few months, I mainly played games. But even that was a non-trivial endeavor in those days. You couldn’t just click or touch an icon on the screen to launch the game; you had to use command-line1. The technician who set up the computer showed me a few MS-DOS commands and I learned others from my friends who already owned computers.
There wasn’t anywhere you could really purchase computer games in Oman those days (as far as I knew anyway), so we would have to copy them from each other. This required me to learn how to do things like copy files, delete them, create new directories, etc., in addition to learning how to deal with the idiosyncrasies of different installer-programs. Furthermore, RAM was a scarce resource in those days and sometimes you would have to fiddle around with your AUTOEXEC.BAT, CONFIG.SYS, or create “boot disks” to play the more resource-hungry games (especially to get around the 640K limit imposed by DOS). This was a process of trial and error, but I was patient and motivated (wanting to play a game is a great motivator!). As a result, I slowly started becoming pretty proficient in DOS.
At some point in ’91, I remember getting a notice from my school about an after-hours computer-course that was going to be held on the premises. I showed it to my dad and told him that I was interested in joining because I wanted to learn more about computers. He readily agreed. Thus began my journey into the wonderful world of Computer Programming.
The class was held once a week and I would count down the days before each one. The first few classes went over the basics of working with DOS (most of which I already knew at the time) before moving onto programming proper. Before even introducing the language, the teacher introduced a concept called GIGO (Garbage In Garbage Out). “The computer is stupid”, the teacher told us. “You have to tell it what to do, and it will do exactly what you will tell it to do.”. So I learned that if the program I wrote didn’t work properly, it was probably my fault. After some preliminary principles, the teacher introduced us to the programming language that we would be using. That’s how Logo became my first programming-language.
Logo was a fun programing-language to learn; it was almost like a game. There was immediate feedback, since you could see what the “turtle” was drawing on the screen. I remember finally grasping the concept of “functions”, so that you could repeatedly call a set of Logo instructions, varying the parameters each time, allowing you to draw some pretty complicated patterns.
The next language I learned was BASIC, and it would dominate my programming life until I graduated high-school. We started with IBM BASICA and then moved to GW-BASIC, which was compatible with IBM’s BASIC. I wish I could remember my thought process at the time, and what it felt like to learn a proper programming-language from scratch. What I do remember was that I had zero preconceptions and innumerable expectations; I knew that by learning how to write code, I would be able to write my own games and tools. Even if I didn’t know how to do it, I knew that it was possible. I also remember that it was incredibly exciting to be using a “grown up” language; Logo still seemed more like a game to me. I would religiously practice writing my own programs when I got back home and throughout the week, much to my parents’ chagrin, because I preferred doing that to actual schoolwork!
I recall that some point I finally “got” programming; I was able to decompose a particular problem to little steps and translate that into BASIC. This gave rise to something that I value to this day: by breaking down the problem into tiny pieces, I became intensely aware of my own lack of knowledge (there were pieces I didn’t know how to implement), and that let me know what I should try to learn or figure out next. I do wish I had kept my notebooks from those days, because I would frequently sketch out my algorithms and draw pictures before actually writing the code; this is something I do to this day. In those early days, it helped me deal with the cognitive load of complex (at least for me at the time) problems and helped me plan out my approach. Though the resulting code was sometimes hopelessly naïve, it most definitely wasn’t wasted effort.
My programming classes continued, but I was starting to get bored because by figuring out things on my own, I was ahead of the class. I thought that perhaps in the next session we would be taught more advanced topics in BASIC, but instead we switched to learning dBase, which I found dreadfully boring. As a result, I had to get my fix elsewhere. This was difficult in the early 90’s in Oman. There was no internet, and I didn’t have access to programming magazines (much less knew that they even existed). In desperation (and boredom), I started poking around in the source of example programs that came with my BASIC distribution, trying to figure out how they worked. A lot of it went over my head, so what I would do was change the code in different ways to see what happened. It was a process of experimentation, and trial and error. Little by little, I was able to slowly figure out what the more complicated commands did, and thus add more tools to my “BASIC toolkit”.
When I ran out of programs to inspect, I started scouring my school library looking for any book that dealt with BASIC. This was an exercise in frustration that would only occasionally reveal a gem; the main issue was that I was unaware that there were different flavors of BASIC. For example, I was starting to get into playing around with graphics a lot since I wanted to write my own games. I recall being extremely excited when I ran into a book in the library that claimed to cover this exact topic. I couldn’t wait to get home that day to try out the programs in the book. However, I was very disappointed when the programs didn’t even work; this was because the programs in the book were written in the Applesoft BASIC dialect, which had been made for the Apple II series of computers. Even still, I went through each example program in the book, diligently typed them out, and then attempted to run them; most didn’t work but some would, and through these I was able to learn something. When I did find a book with a compatible dialect of BASIC, it was like getting a birthday gift. I still remember the excitement of typing RUN and hitting enter, after I had spent a bunch of time entering the code from the book; some of these programs were hundreds of lines long! Inevitably there would be syntax errors and I would have to go back and fix them.
Once I got the syntax errors out of the way, I would have to deal with logic errors. Sometimes I introduced subtle bugs while copying, like typing a greater than sign instead of a less than sign, a wrong array subscript, or a wrong line-number in a GOTO or GOSUB statement. After fixing all the errors, I would try to figure out how the program actually worked. I remember adding my own lines of code to print out values of variables to see how they changed as the program ran. I would then modify how these values were calculated to see their effect on the execution of the program. In this slow, often error-prone method, I was able to tease out information about the inner-workings of these programs. I started getting comfortable doing this and didn’t mind the manual nature of the process, as I was learning a lot doing so. This valuable skill helps me out to this day; I don’t mind debugging framework-code or looking at disassembled bytecode to figure out what is happening. It is actually something that gives me more confidence and peace of mind, because I never like taking things for granted and blindly assuming that things “just work”; I always want to know how they work. Fiddling with the sample programs in my BASIC distribution, and fixing errors in programs I typed from books also introduced me to debugging code that I hadn’t written myself. This was a valuable lesson, because it taught me to how to read, process and understand other people’s code.
By sixth or seventh grade I had taught myself enough to be slightly dangerous. Having learned about the CHAIN command, I wrote my own menu-system that would let me launch different programs, including non-BASIC programs (this was via the SHELL command). I remember demoing this to my computer teacher in school (by then we had computer classes as part of the curriculum) who was impressed and encouraged me to keep learning and do more. I had also written my first game at that point; it was just a simple math game that posed math problems to the user. A correct answer would give them 5 points and the wrong one would deduct 1 point. By the end of eighth grade though, I had finally written a game with graphics; it was a simple slot-machine game. I had a ton of fun writing it and it was a huge hit at the science exhibition that year. At some point I even started teaching myself C, after finding out from my computer teacher that it was easier to write more powerful games in this language. Unfortunately I wasn’t able to make much progress because I had a hard time finding a good C compiler that I could use.
Being self-taught got me into a little bit of trouble at times. In ninth grade I switched schools, and in my first programming-class at the new school the teacher asked us to write a program to sum numbers from 1 to a number provided by the user. We only had a small number of working computers so three or four students clustered around a single computer. The students I was with weren’t that interested in programming and so just let me write the program. This kind of code was quite easy for me at this point and I wrote the solution in no time. As always, I quickly got bored because the teacher was still going around the class inspecting everyone’s solutions and he hadn’t gotten to us yet. So I decided to “spice up” the program by including a few PLAY commands that would play musical tones; I thought the teacher would be impressed. Instead, he looked around and asked in an angry voice, “Who did that?!”. I sheepishly raised my hand and he made me go sit in a chair for “playing games instead of working.”. Of course, my protestations to the contrary fell on deaf ears. When he finally got to our machine, he looked at the code and asked, “Who wrote this?”. All the kids there pointed to me. I thought I was going to be in trouble again, but instead the teacher asked me to come back from my “time out” and then had me explain how I solved the problem to the rest of the class.
I remember that I also tried to write some “utility” programs; I created my own journal program after being inspired by the one in Doogie Howser, M.D.. It was hopelessly limited, of course. It wasn’t a true editor; you couldn’t move around the screen and modify what you had already typed (I think I literally just used an INPUT statement). But it did have the ability to save journal entries. I even had a primitive “encryption” system based on a Caesar cipher; I would randomly generate a number (between 1 and 13) and then shift each character by that number. I used some convoluted formula to obfuscate the key and wrote it out to the encrypted file as well. Then when I read in the journal file, I would de-obfuscate the key to find the original number and then un-shift the characters by that amount. I think by this point I had also moved from GW-BASIC to QBasic which was much more powerful. In QBasic I ended up writing a shooting-gallery game as my tenth grade final-project that I also demoed at the science exhibition. It was definitely very rough and the code was terrible; I had to figure out how to do animation on my own and so things were quite hacky.
By ’97 we finally got dial-up internet in Oman. The trickle of information changed into a firehose! I discovered an online community of QBasic programmers and numerous QBasic pages on GeoCities and Xoom. I was ecstatic! I downloaded as many of the pages as I could so that I could go over them offline. I had also started learning HTML at this point and made my first webpage that showcased my own QBasic code and programs.
I remember that I had grand plans to have my own QBasic tutorials and even a forum where people interested in QBasic could gather and discuss programming techniques. None of those materialized, however. I graduated high-school in ’99 and by that time I was writing code in C++ and had also started learning Java. My interest in QBasic and writing games slowly faded away once I began college and I started gaining interest in subjects like artificial intelligence, agent-based modeling, and language design. In fact, in the middle of my freshman year of college I even wrote an interpreter in Java for a programming-language I designed and created, called bAdkOde. I had no clue what I was doing, so the parser and interpreter were both horrific, but I learned a lot (mainly how not to do certain things).
double a, b, hypotenuse; >"This bAdkOde script calculates the length of the hypotenuse of a right triangle.\n"; >"a:"; <a; >"b:"; <b; hypotenuse = (((a ^ 2.0) + (b ^ 2.0)) ^ 0.5); >"\nThe Hypotenuse of the triangle is " + hypotenuse + "\n";
Today my interests are still rather similar – I still like AI (in fact, I’m working on my PhD in game-theoretic artificial-intelligence right now) and I still like to create things that help others be productive; rather than just using tools, I prefer making them. My work is also much easier these days in the age of things like Stack Overflow, GitHub pages, and YouTube tutorials on any conceivable programming-topic. But I still fondly remember and wax nostalgic about those early days as a green computer-programmer; days that were characterized by an insatiable hunger for knowledge and an unfortunate paucity of information. The experience taught me that through perseverance, passion, and initiative, nothing is impossible to learn and master.
1Yes, Windows was around, but I didn’t have it installed; neither did most of my friends. Plus, games needed all the memory they could get at the time and Windows used up too much of it.