December 16th

I got a lot of great suggestions from a variety of people: Jonathan Beyrak-Lev, Sasha Fenn, Yin Liang, and others. There are too many ideas for me to handle them all; I’ve been trying to digest some of them. Among them:

Use WebStorm, an IDE for JavaScript.
I downloaded it and gave it a try and it looks great. Sadly, it assumes a level of competence that goes over my head. It’s got features to support server-side software; I can’t do that. Some of its error messages go over my head. And it disapproves of some elements of my programming style. In particular, it insists that a parameter passed to a function should have the same name as the one used in the function, which is rather difficult when you want to pass different values to a function. Their “Getting Started” webpage is quite long and uses lots of links to even more material. OK, I suppose that any IDE worthy of the name is going to be complicated. Do I really want to put myself through learning this, perhaps the 50th IDE I’ve used over the years? Ah, for the days of MPW, Lightspeed Pascal, Macro65, and Sweet16!


The Killer Problem
People have suggested a number of solutions to my central problem. I described the three most popular strategies in yesterday’s post. None of them work, but people keep suggesting them. The most likely problem is that I am not implementing the solutions propertly. But I also think that people don’t grasp my true problem. Most seem to think that it’s solely a matter of figuring out how to wait for a button to be pressed before proceeding. Well, yes, that’s part of it, but the problem is more complicated than that. I’ll try to explain it in less-technical words. Here’s the basic program structure:

1. Initialize a huge mess of data, requiring about 8,000 lines of initialization JSON data.
2. Begin the outermost loop, which will execute perhaps 100 times.
3. Select which glob of data will be put on the screen
4. Set up all the HTML code that uses that glob of data as a big string.
5. Write that big string of HTML code into the document.innerHTML. This draws the page.
6. Wait for the user to make his choice and press the “Submit” button in the HTML
7. Erase the page.
8. Go to Step 3 and make a new page.

When I try various experiments, I get several possible outcomes:

A. Nothing happens. Nothing is drawn on the web page. I can’t even bring up the browser’s JavaScript console.
B. I get one page drawn, but nothing more, despite whatever I do.
C. I get multiple pages drawn, but it’s not executing the loop (Step 3 to Step 7). Instead, it’s executing (Step 1 to Step 7), which is a malfunction because I need to save data between executions of the loop.

To summarize, I need a big loop that draws a page, waits for the user input, then proceeds to redraw the page with new data. This would be ridiculously, absurdly simple in assembly language, but apparently JavaScript is too high-falutin’ a language to be able to do anything simply. 

Perhaps I should walk away from this problem and let it simmer for a while. Then someday the answer will hit me and I’ll slap my forehead and say “You snivelling fool!”