web dev (pythonic)

Stories from Cyberia

I wanted to share some recent findings, from the perspective of someone with lots of white hair and memories.

My fantasies around computers started around 8th grade, when I scoured the Time-Life series with titles like Mathematics, The Mind, The Cell, The Body… twenty-six volumes in all.

Back then, real computers were “mainframes” (filled whole rooms) and I hoped maybe I’d meet one in college — which I did. My dorm had an APL terminal in the basement, connected to a mainframe at the computer center.

APL (A Programming Language) was just what I though a computer language should be; it had the appearance of ancient Greek.

Fast forward, a few decades, and we’re looking back on a plethora (a goldmine) of computer languages. One such language is J, a pure blood descendant of APL but with standard ASCII keyboard characters.

Another language, likewise considered somewhat esoteric, is OCaml, a descendant or variant of Standard ML (SML).

OCaml is well understood (mature), and respected, but for its first twenty years has remained out of the limelight. Is OCaml now poised for a new place in the sun? How did we get to where this is even a serious question?

I remember hearing about ML from when I lived in a protected hallway in Queens, courtesy of my friend Ray Simon, and a Chinese graduate student, a computer science major, who was letting Ray sublet a room.

“ML is for computer scientists” was my sense of it back then, when I worked for McGraw-Hill and first considered how “learning to code” might be phased in at the high school level. This was the mid 1980s.

But now, as we close on 2020, Ocaml is making a comeback apparently, in the form of ReasonML.

“What is ReasonML?” you ask. This was new to me too.

The answer involves the frustrations surrounding what’s probably the most explosive language of all time, in terms of lines generated.

Of course I’m speaking of JavaScript, native to every browser, and now on the server as well, running free of its former “prison” (in the sense of limiting context).

Lets rewind a bit and talk about web browsers, officially “clients of the World Wide Web”.

A browser is specifically designed to turn the markup language HTML (a different “ML”), augmented with Cascading Style Sheets (CSS), into the glorious web pages we all experience, while meanwhile running JavaScript to keep these pages dynamic and responsive.

The HTML + CSS together define the document’s structure, including layout and content, in what’s known as the Document Object Model (DOM). JavaScript has full access to the DOM and is free to change it on the fly.

When the “web browser” was still a very new idea, different subcultures started to compete for “control” over the market, meaning they competed with free offerings coupled to websites that might only be experienced in their full glory if one used Internet Explorer and not Netscape or vice versa. In other words, no one common standard had been agreed to, and Microsoft in particular wanted to introduce its own “in-browser” language, in a bid to set standards by being the de facto “king of the hill”.

Sun Microsystems, a champion in Silicon Valley, was eager to challenge Redmond’s takeover attempts and worked with Netscape just around the same time it introduced Java, which it hoped would become the lingua franca of browserdom, with Netscape’s JavaScript (renamed from LiveScript) more of a “helper language” around the edges.

JavaScript was named that to give the Sun ecosystem a more unified look and feel. Coffee. A programming language, actually two of them, coupled with a legal drug of choice, gave the whole ecosystem a consistent theme.

Whereas Java might have been a godsend to those struggling with C++, and remains a strong language and subculture to this day, it never became the in-browser darling first envisioned.

JavaScript, submitted to a European standards body (ECMA), would take that role, shouldering huge responsibilities.

The browser was becoming the preeminent application of all time in many ways, as the portal to all others.

JavaScript, developed hastily and rushed to market, was buckling under the weight.

I’m tempted to rewind back to the advent of the web browser and tell the story again from the perspective of GNU and the free software revolution.

Champions of the internet were likewise at the vanguard of a movement to keep the emerging cyberspace from falling under the control of privately owned technologies.

“GNU is Not Unix” (what GNU stands for) was the project to recreate the world’s best understood and most internet-ready operating system as an asset no one subculture could control. Software engineers were tired of hacking away on these wonderful creations only to be denied access to them when changing jobs or finally obtaining that graduate degree.

JavaScript, now evolving as an open standard, took on different names. ECMAScript sounded ugly, but ES was OK. ES5 evolved into ES6 and so on.

New syntax was added. Talented and experienced computer scientists rescued JavaScript from second class status and returned “the good parts” to a pedestal. ES6 was something to admire, and even if most browsers couldn’t run it yet, a web developer could still use it, and then “transpile” the code to an older browser-compatible version.

A lot of you know the story from around here forward, and appreciate, first hand, the vast JavaScript ecosystem that grew, almost overnight it seems, from all this focus and attention.

What JavaScript (still called that) still suffered from, was a lack of compile time type checking.

Like Perl, PHP and Python, and later Ruby, the JavaScript language is and was a “scripting language” meaning an interpreter would run in memory alongside, allowing the program to rewrite itself in some ways, even while already running.

Computer scientists call this ability “late binding,” meaning the programmer doesn’t need to commit “up front” to a lot of type-enforcing rules.

Finally, then, we get back to OCaml, which is strictly typed.

You know the word “type” from “stereotype” and “typecast”. When an actor is “typecast” as a villain, that means said actor will have a hard time finding roles as anything but a villain.

In a programming context, the type of an object limits what might be done with it, which in turn serves as a check on whether the program is valid.

As it turns out, when coding complex solutions, the more of our logic we can “freeze” (nail down, make immutable), the easier the program is to reason about, as a rule of thumb.

Keeping code from becoming next to impossible to debug and maintain is a high priority unless you want to pay to have the same applications coded over and over.

A language that encourages declaring types and immutability is less likely to be dragged down by its own complexity. So how might JavaScript gain more of that power?

Microsoft came up with one answer. They called it TypeScript, which would compile to JavaScript.

Google’s new web development framework, called Angular, incorporates TypeScript as part of its workflow.

Facebook came up with another answer: ReasonML would be fitted over top of OCaml, providing an alternative syntax that turns to standard OCaml under the hood.

The new syntax looks as much as possible like JavaScript. The output of the workflow is actual JavaScript, but interimly one is writing OCaml, wherein typing stays strong.

The idea is a web developer, already fluent in JavaScript, and perhaps in ReactJS (also introduced by Facebook), will leverage this knowledge to master a dusted off, refurbished OCaml, thereby potentially attaining that holy grail, of maintainable, still flexible, and robust code.

--

--

--

Lots online.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

SonarQube Integration with iOS

Unix Domain Sockets in .NET 6 — Basics and Real-World Examples

Enter Into the IT World With Python Language

python training in chennai

Cleaning up after Spectre and Meltdown: figuring out how badly they slowed down your servers

💎Looking to apply DISCIPLINA to your project?💎

Project #5: OLED Display Using Adafruit SSD1306 on Arduino IDE

Flutter PayPal Integration

Understanding Amazon EC2 Terminology

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kirby Urner

Kirby Urner

Lots online.

More from Medium

More Dev Notes

Moving from .com to .org

God Doesn’t Play Dice Once, but Twice!

Everyday Things We Can Thank NASA For