Smarter - easier - cheaper printing for Chromebooks

Ugly Beautiful My 20 years of Javascript development

Ugly Beautiful JS

My 20 years of Javascript development and torment

Please allow me a moment to be smug.

Some loyalties are painful, like supporting your team in the tough times.

When you were there long before the fairweather fans jumped on the success bandwagon, when you know what failure feels like.

I think there must me something in my psyche which allows me to even get into these relationships: I must have a soft-spot for an underdog.

This underdog phenomenon is explainable, ultimately it’s about persistence and reward - because when the wave of success finally crests above the ocean of disappointment I feel a sense of satisfaction that surely only me and the other original fans get - am I right?

But backing underdogs becomes addictive and the payback rate is slow.

Here’s the list from my youth:

  • As a kid in the 80’s I supported the Green Bay Packers - finally in the 90’s they actually got quite good. My friends mercilessly laughed at me in the meantime, no cool teams wore green & gold. Blue for the Cowboys and red for the 49’ers, yes. The 90’s came too late and I will always be tormented for supporting one of the weakest teams of the 80’s..

  • I’ve supported Cardiff City Football Club since forever - now they are in the Premiership. That is a long and winding road my friends. For us Bluebirds, the black and white photos of the FA Cup trophy of 1927 is all we have so far...that’s a long wait.

  • I bought a IBM PC clone when all of my friends had Amiga 500s or Atari STs. They called me a dweeb. I had no decent games. I didn’t care, because I knew I wanted to program. Now I can’t seem to find a single office using Amigas or Atari STs… (cue deluge of mail)

  • But worst of all, from the late 90’s I beat the drum for Javascript when it was pretty basic and when others called it cancer.

Other developers looked at me with a sense of pity and disgust when I enthused about JS - it’s the look you give maimed roadkill before you walk back to your car.

Worse still if I tried to argue the case I would get emails with CAPITALIZED titles like ‘LOOSELY TYPED CRAP’ with links to sites like weird,  many issues and doomed.

But still I persisted thru the new millennium and into the 2010’s, writing bad javascript, trying to scale the language to enterprise when clearly it was clearly designed to be written by a solo hacker in their bedroom wearing only underpants.

20 years has passed since my first alert(‘Hello world’) - time enough to reflect.

Time enough to realize that if you stick at something long enough, you may be rewarded.

Now the age of Javascript has finally arrived I feel a little smug about it.

Looking back, I admit it, I was in a cult

The 2000’s were tough for the devotees in the JS cult.

We gathered in small groups, darkened rooms, looking for salvation. We checked over our shoulders to make sure that we weren’t followed by the ‘enterprise architects’. We whispered the name of our leader - Douglas Crockford - in hushed tones. He didn’t know us, but we knew him. And we hung on every word. The new savior had a prophet and the prophet's name was JSON. We knew JSON would one day be the word, but for the moment it was our secret.

In the real world Java was the new messiah, a gleaming isomorphic vision of a glorious unified future. Write-once-run-anywhere. Enterprise Java Beans. Java containers. Sexy. It was Enterprise with a double capital ‘E’, J2EE. If you could spell Java, you were hired.

And money talks - as a contractor in the mid 2000’s you could command $800+ a day writing Java, you would be lucky to get the price of a cup of coffee volunteering your JS skillz. Skills that you had carefully honed from your bedroom, wearing only your underpants.

The was a time when adding 6 letters to a skill on your resume reduces your employability from $800/day to zero - Java-S-C-R-I-P-T.

During this period of my life I also admit that I flirted with other languages. I went speed-dating (kids, this was how you met in the days before Tinder). I was young, experimental, free. I dabbled. I didn’t see any harm in exploring what the world of programming languages had to offer.

For a while I found comfort in the rigidity of the ‘C’ lifestyle, even if my JS upbringing made be a little forgetful of memory allocation. I found myself reading real paper books on C, libraries full of them, great knowledgeable tomes dedicated to topics like structures and pointers. It felt like a proper programming religion. Like Catholicism, except with more rules. I met a lot of old people with beards, who talked at length about language purity, compilation and macros - they were convinced that there was only one true path for ever and infinity (or &infin as they would say). I kind of respected that. I couldn’t get on with wearing sandals with socks so I left in 2005.

For a while I also longed to join the achingly cool Ruby gang, these were the hipsters before the Hipsters. They wore satchels, drank latte before latte was a thing. They had rails and everything. They could (and frequently would) give you 10 reasons why Ruby was syntactically superior than your programming religion - regardless of whether you asked them to explain or not. These guys would stop you on the street and talk to you about their new religion.

They were everywhere.

Then one day they vanished. Maybe their spaceship came to take them back.

Much maligned and untrendy, Javascript continued to be the ‘language you unfortunately had to use for the web-bit of the system’.  Java Enterprise guys hated Javascript and set about creating ways to not write javascript. With some impressive success.

In the meantime quietly but surely the hackiness of Javascript lead discipline-minded people to bring order to the chaos. Initiatives to consolidate and build universal libraries/frameworks like jQuery were emerging to mixed reception - ‘heavy’, ‘slow’, ‘bloated’ vs people who found them ‘lifesaving’, ‘accelerating’ or just ‘sane’ compared to code chaos. This was the beginning of the JS legitimization movement.

At the same time, professionally, we were on the bleeding edge of JS, but my company also had some additional challenges, we were trying to use JS and HTML on embedded platforms.

Note: Embedded platforms are typically a small single-purpose devices running a low-power CPU or system-on-chip. They are a LOT slower and have way-less memory than the equivalent PCs of the day. We were trying to get HTML and JS running quick on these, which I can assure you was tough.

The 80-20 rule

HTML/JS user interface optimization on desktop computers and embedded systems was a living hell.

We soon established a rule-of-thumb which applied to any HTML/JS enterprise application we would author, our Javascript 80-20 rule was thus:

  • Spend 20% of our time coding the functionality thereby creating product value
  • Spend 80% of our remaining time actually getting the performance to be somewhere near acceptable, predictable or even just plain stable… ugh.

We noted from our server-side colleagues that releasing enterprise software in other languages (like C++ or Java) was typically the complete flip of that equation.

Now I’ll be the first to admit that JS was not necessarily the bottleneck here. We were combining HTML (3.2 & 4) with JS, meaning that we also mis-used HTML markup beyond its intended use-cases. This lead to bugs, unintended functionality but most notably significant performance issues.

Our applications were HUGE - multi megabyte hundred-file monsters containing spaghetti of markup, functional code and styling.

There is a special word for bad performance in HTML/JS applications, it an onomatopoeic masterpiece which describes in one syllable exactly the experience you get when using a badly performing HTML/JS application;

JANK


Janky                 ˈdʒaŋki/

Adjective NORTH AMERICAN   informal

adjective: jank

  1. of extremely poor or unreliable quality.
  2. "the software is pretty janky"


Let me try and explain:

  • Jank is a special type of slow.
  • It’s an unpredictable, stuttering, juddery type of slow.
  • Jank is rarely the same twice, so every time you use an application it will be janky in a different way.
  • Jank and it’s partner in crime lag leads to a feeling of disconnection from the app.
  • The app becomes a something you have to use, not your friend or helper, something you fight.
  • Most importantly Jank is ANNOYING, to everyone.

And it’s very difficult to debug.

Which is why jank and lag took 80% of our time.

The battle with Jank continued for many years, you can thank the war on Jank for the existence of React Native.

A SPA day

Our apps got heavier and heavier, we moved more of the functionality from the server to the browser.

We were writing SPAs - Single Page Applications, but didn’t really know that they had a name. To us they were self-contained HTML/JS/CSS applications that separated model, view and controller. We were trying to bring order to the chaos.

At a marketing level tried calling them ‘thick clients’ - vs thin client, but the implication was that our clients were thick i.e. stupid or slow as opposed to lithe HTTP/JSON (later called REST) driven resident applications that we wanted them to be. We toyed with other excellent marketing words such as ‘dense’, ‘heavy’, ’sumo’ before settling on ‘intelligent’. Honestly, the marketing term didn’t matter as long as the Jank remained...

The upshot is that SPAs were here to stay - now there are a dozen frameworks, techniques to help write and maintain enterprise scale SPAs. I won’t name them, that would be way too boring.

The eureka moment.js

I can remember a single point in time that changed everything, it reinforced everything I had ever felt about the possibility of Javascript and it happened in 2012.

It was a shining example, irrefutable, undeniable evidence that I could put under the noses of the sandal-wearing C brigade and the latte sipping (ex-Ruby now PHP) Hipsters that  finally proved that JS was the rightful king.

** Geek warning **

This guy had written an x86 emulator running a Linux operating system in Javascript.

Repeat: You could run a Linux OS in a browser, from a standard webpage. No native code hackery required. This genius guy had written a VMWare/Virtualbox type system in Javascript, probably wearing only underpants! Take that Ruby!

This pretty much proved that the evolution of the language has progressed enough that developers were now only bound by their imagination not the restricted capability of the language or the environment in which it ran.

In parallel others have been carrying the torch forward with some pretty amazing stuff - most notably for enterprise it was Google that decided developing an entire office suite to run in the browser was the next evolutionary step in computing. Google Docs, Sheets, etc are the result. Microsoft has belatedly realised that you can’t fight the web tide and the latest Office 365 offering runs well in the browser.

My latest company also tries to carry the JS torch forward.

directprint.io has written a full printer driver stack in pure isomorphic Javascript (runs in the browser or on the Cloud). No ‘C’ or sandals+socks in sight. My role means that I am stepping away from the code, but I still love the language/technology and everything it stands for.

Printer drivers and alike written in Javascript are only possible due to the other JS cult devotees that have kept quietly evolving the language by creating tools like Node and making huge efforts on language feature and syntax improvement.  JS now has the most libraries of any language. Is this good or bad? It certainly shows it’s popular (or maybe somehow still deficient?)

And I Promise, ‘callback() hell’ is no longer a thing.

You’re welcome to join the Javascripters - they don’t need to hang out in darkened rooms any more, they are everywhere. All you have to do is right click this page and select Inspect, click Console and type alert(‘I want to believe’);

Go on, take your first step…


Article by David Jenkins, Founder, CEO directprint.io.

https://directprint.io is a print management solution designed for Chromebooks.

This article mentions trademarks of other companies, including Google and Apple, respect.

directprint.io - 5 ways schools can save money on printing

https://directprint.io