I like javascript.

There. That's out of the way.

dbucklin wrote a great post about
coding as craft. I am not a craftsman.
I hack things together. I don't even
know enough to know whether my coding
is ugly or full of security holes. I
try to be as concise as possible and
to keep it tidy, logical, and
commented. That's about it.

What I really liked about dbucklin's
post were the use-what-you-want-to-use
comments. There's a general animosity
toward javascript in gopherspace (and
elsewhere), but I think it's
misplaced. There's no reason to blame
a tool for what people do with it.
Javascript is not particularly 'heavy'
or 'bloated.' You can definitely
overload a site with it and it plays
a significant role in tracking and
advertising. But those results are the
products of decision-making. They're
not problems with the language
itself.[1]

In any case, a couple of years ago,
the unofficial Google News app (NewsG)
for webOS died and I decided that I
wanted to create a replacement for it.
Yeah, I know. I'm on the wrong side of
that one too! ;)

I hadn't programmed since the days of
BASIC and Turbo Pascal, so the whole
project was exploratory for me. It was
a lot of fun and I derived a great
sense of accomplishment from it.

webOS apps rely on proprietary
javascript frameworks called Mojo and
Enyo, and neither is particularly well
documented. It quickly became apparent
that using those frameworks was going
to be difficult for me -- and that
learning them was going to take me
into a dead end. I hoped to learn
skills that would be transferrable to
other settings in the future. Outdated
mobile frameworks didn't really help
in that respect. In addition, I didn't
have my own VPS at the time, so my
solution had to either run on the
device or be hosted on my webhosting
account. As a final consideration, I
wanted the app to be easily portable
to other platforms.

The solution to all of these problems
was javascript. I worked through a
great book called Eloquent Javascript
and -- with the help of w3schools and
a whole bunch of helpful people on
sites like Stack Overflow and Stack
Exchange (not to mention an RSS feed
renderer called feed2js) -- I managed
to cobble together a web app that
displays Google News RSS feeds with
the option to open the links through
Google's mobilizer to speed up
rendering on very old devices. The
entire site is written in html, css,
and javascript. It's neither heavy nor
bloated. The proof is that it works
quickly on my old HP Pre3, which has
one of the worst browsers ever made.
As a result, I have to conclude that
it takes a LOT of javascript
(gargantuan amounts!) to weigh down a
modern browser.

There were real benefits to creating a
javascript-based web app in this
manner. The first was that it was
relatively easy to create webview apps
to install on different devices and
then format the site differently on
each device via browser detection and
css. The second is that I never have
to update the mobile apps. When
something breaks, I just update the
website code, and the users (there are
at least two of us!) don't have to
download app updates.

You can try out the site here:
http://darkstar.x10host.com/news_beta

It will work best in your desktop
browser or on webOS or BlackBerry OS7.
There are no stylesheets targeting
Android or iOS devices so it will
probably look terrible on them.

The mobile apps are here:

webOS:
https://github.com/Shuswap/NewsZ-Build

BlackBerry OS 7:
http://darkstar.x10host.com/Launchers/NewsZ/NewsZ.jad

And I shared the webOS web app
template I created here:

https://github.com/Shuswap/template_webview_app



[1] I am painfully aware that I just
made the standard anti-gun-control
argument about javascript. But you
know it's true. Javascript doesn't
kill browsing. People kill browsing.