For terminal stuff, https://asciinema.org/ 

On Tue, Oct 18, 2022, 7:02 PM David Schwartz via PLUG-discuss <plug-discuss@lists.phxlinux.org> wrote:

On Oct 18, 2022, at 1:21 PM, techlists@phpcoderusa.com wrote:

On 2022-10-18 12:30, David Schwartz via PLUG-discuss wrote:

There’s a movement afoot to use JS as a sort of “universal
assembly language”. The great benefit here is that unlike stuff like
Java’s JVM, JS is far more widespread since it’s implemented in
every web browser, although not 100% identically (even though
standards groups are doing their best to get there).
As such, there’s a growing base of tools that let you write code in
a higher-level language that gets translated into JS. So why teach JS?
Why not focus on one of the HLLs that gets compiled down into JS?

My tutorial is for teaching beginners how to program.  I think JS might be the easiest entry point since all that is needed is 1) computer or laptop, 2) modern browser, 3) file system, and 4) text editor.

Nothing to download or install unless the person taking the course does not have the specified browser.

One can learn HTML, Cascading Style Sheets (CSS), JavaScript, and even AJAX with limited tools.  For AJAX I recommend downloading one of the libraries to make life easier and to account for the browser differences.



JS is basically interpreted ‘C’ with lots and lots of syntactical back-doors and often counter-intuitive idioms. As a first language to teach someone, I wouldn’t go near it.

I can probably count the number of programming concepts that initially got my brain tied in a knot on one hand. To be sure, one of them was my first exposure to how web pages worked — mainly the fact that they were stateless and there was no way (at the time) to share state data from one page to the next other than passing it onward to the next page by passing it forward as querystring args. A couple of things were added to support that in most servers, but it’s still not obvious if you don’t know to even look for it. Most inexperienced programmers have no idea what “stateful” or “stateless” even mean, let alone having to know when to deal with it.

I had been programming with Delphi for a few years at the time, and passing state info between forms can be easily done at several levels with both Delphi and Visual Studio C#/.NET. (That’s because the same guy designed both of them.) Prior to this, statefullness had to be managed manually.

One HUGE chunk of programming complexity that Delphi brought to Windows programming at the time was that it completely hid the hideous Windows Event Loop, in part by presenting an “object inspector” that had two panes: one was a “Properties” tab that each component defined and could be edited right there, rather than in code; and the other was an “Events” tab where you merely had to double-click on a specific event and it would either: (1) create a prototype of the method; or (2) position the cursor to it,  within the editor pane, where you merely had to type in some code to respond when that event was called by the underlying Event Loop. What it eliminated was having to manually create and manage that stinking Event Loop by hand — it is managed entirely by code generated by the IDE. It’s still there in every Windows app to this day, but nobody who’s only ever used Delphi or Visual Studio has ever seen it.

The biggest problem with most C/C++ programming (and JS as well) is the likelihood of making coding errors that may appear to work on the surface, but eventually lead to memory leaks and related errors later on. I understand that the relatively new language, Rust, evolved to avoid a lot of these potential problems. A new Linux kernal was just posted that has begun to replace a lot of C/C++ code with Rust code. So maybe that’s a better language to teach today.

My point about Delphi and VS is that they have a very nice, easy-to-use GUI-based programming environment that implements a powerful WYSIWYG form designer. Microsoft has something that can be used for building web-based apps, but I understand it doesn’t render web widgets in the IDE as they would appear at run-time. And in fairness, right out of the box, Delphi totally sucks for web-based programming.

But as a Delphi component library, WebCore bridges both of those gaps and presents a very nice WYSIWYG environment for building web-based apps. Some of the renderings look a little more accurate inside of VS Code than in the Delphi IDE, because Delphi is itself a Windows-based program while VS Code may use the Chrome rendering engine to manage its UI surface (but I’m not totally sure about that).

On the surface of things, you can build a web app using TMS WebCore in a nice WYSIWYG UI environment (both Delphi and VS Code) and never have to touch a lick of HTML, CSS, or JS, or even know anything about the fact that web services are inherintly stateless — which in my mind has got to be one of the most significant programming advances in the past 20 years or so.

As an aside, I’d like to add that I believe that web apps are the future of this industry because they enable you to write only ONE version of the app that will run anywhere you can run a browser. You can even use Electron or TMS’ Miletus to wrap it inside of a run-time browser simulator and run it as if it’s a NATIVE APP inside of virtually every major computing platform today. 

So you can create what might be called a “wire-frame mockup” in WebCore that’s got as much or as little functionality in it as you want, using only ObjectPascal. The Object Inspector lets you tweak various look-and-feel parameters on a per-component basis, although that’s probably not smart for things with lots of pages. (It may support Delphi’s Styles, tho; I don’t use them.)

The upshot is, you can build your app out functionally and leave the “look-and-feel” parts to later. Then you can add CSS tags and call them out in specific component properties using HTML to alter their appearance and (some) run-time behaviors.

\
Writing stuff in a text editor to make web apps using HTML, CSS, JS, and layers of UI libs is so 2k-ish today. I refused to do ANY Windows programming until Delphi came out b/c it was the first environment that abstracted out enough of the nauseating Windows API that I could stomach writing Windows apps. To this day, I still cannot stomach writing any kind of rich-UI apps, including web apps, that require one to write text descriptions of a visual design — sometimes referred to as "declarative programming”. 

I got my fill of that with TurboVision in the early 90’s. TV was a C++ framework for Turbo C++ that let you build text-mode GUI forms by describing everything in Pascal — the same way you have to create web pages by describing everything textually in HTML that refer indirectly to weird tags in CSS — two very different declarative languages that are both poorly suited for the task at hand. 

And some of us here have been around long enough to know that HTML looks like it was probably derived from so-called “escape sequences" used to do simple print enhancements on dot-matrix printers (Epson and Centronics come to mind).

Anyway, I keep hearing there are WYSIWYG programming tools for building web apps, but so far I’ve seen none that are as simple to use as WebCore.

I invite you to go to the TMS Software website (tmssoftware.com), visit their blog, and check out some of the posts by Andrew where he’s doing a lot to bridge the gap between writing code in Pascal, some support code in JS, and getting the run-time version to look like it was all written in HTML, CSS, and JS. He posts all of the code right there in the articles, and you won’t have to understand much Pascal to see what’s going on. Aside from the one unit he ususally puts all of his local JS functions in, everything else is done entirely in the IDE’s property editor or within Event handlers in the code. It’s quite amazing. 

And it all gets transpiled down into JS when you “compile” it, since it’s using JS as the underlying assembly language. Anything “advanced” about the appearance of the JS code is a testament to the quality of code that the pas2js transpiler puts out.

You don’t have to go with this, but just be aware that this is pretty much the current “state of the art” in this arena, AFAIK.

-David Schwartz




While I realize that most Linux folk are allergic to anything
commercial, someone has to pay the bill for truly innovative stuff.
Some products I’ve been working with for a long time are from a
company called TMS Software. I work with Delphi, which was derived
from Borland’s TurboPascal line, and TMS is one of the few premium
component library vendors left in the market. In this case, they have
been working on something called WebCore for a few years now that uses
an open-source tool called pas2js to translate Delphi’s ObjectPascal
code into JS. Their WebCore facility isn’t free, but it does work
and run standalone inside of the Visual Studio Code environment — no
Delphi IDE is required. It allows you to use their visual designer to
lay out forms and write event handlers in Delphi’s ObjectPascal
language, which is then translated into JS and packaged into a few
files that can be uploaded to your web host and run in the web browser
as a web app. You’ve gotta see it to believe it!
You can see a relatively simple app I built as my first non-trivial
test with WebCore at the following URL. It took me about an our to
write this app.
BestKeywordMixer.com [2]

Very interesting.  So you can create an entire web app this way?  Sounds like it would speed up the process. Rapid Application Development which is what is missing on this Interweb thingy.

I took a look at the JS code and it looks very advanced.


---------------------------------------------------
PLUG-discuss mailing list: PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss