Elbowing JavaScript out

综合编程 ikura

The following is an e-mail interview with Amy G. Dala. Amy is a seasoned hacker whose antics have always surprised & inspired us over at ikura.

We posed some questions to her, with follow-up questions where needed. The subject of the ‘Q&A’ was regarding Amy’s recent crusade in creating JavaScript-free web applications. Enjoy!

IKURA:
I am of the mind that not only is JavaScript ( JS
) here to stay, but just like C++ & Java just before it, JS
has won. How do you see it?

Amy
: Yes. Javascript has probably won. Which is too bad. The language itself could be worse. True. But the fact that it lives in the web stack right next to the presentation layer, really sucks (I think). I don’t even mind it living in the backend, as is the case with Node.js. But the frontend? So I’d agree that it’s here to stay. But I don’t think we have to embrace it for all web stuff as much as we have.

IKURA:
Would you explain how you came about writing web-apps that use zero JS
in the first place? What was the project that started you down this road?

Amy
: I have been wanting to try building a complex webapp that uses nothing but a backend, CSS
, HTML5
for a really, really, really, long while. Then one day my colleague Ari said he had a client that he couldn’t take on. Would I like to take it? I thought the client was a perfect victim because the project fell in between complex, but not too complex. That project ended up using ikura’s services, BTW
, and is how you and I were introduced in the end. And that was the start of my now 15-project track using no javascript. It’s amazing what you can accomplish with dynamic templates, a fast backend, CSS
, HTML
.

IKURA:
I assume there were moments with that first project — I respect that you can’t go into the details of a client project — where you said to yourself: ‘I could put some JS
right here, and that would be an elegant solution.’ No?

Amy
: I used to play with a toy called Robotix
when I was a kid. Actually, it was my big brother’s and he really hated it when I played with it. When Shane lost interest in it, I asked my dad if we could get this and that set, so I could make cooler things. Worried that I was making engineering more a priority than piano, my dad always refused. I was stuck (but in a good way) using a very limited set of tools even as my Robotix constructions were getting very, very complex. It’s the same here, with a limited toolset, no use of javascript allowed, it was up to me to figure problems out using only the backend to lean on. Surprisingly, it was easy. You begin to suspect javascript a lot after you get over just how easy things are without it.

IKURA: An aside: what back-ends have you been using to ‘lean on’?

Amy
: Mostly Django
, Sinatra
, and Phoenix
. Phoenix is new to me but it’s really, really awesome.

IKURA:
After you had let me know that you’d be down for a little ‘Q&A,’ I tried making a toy ‘No-JS’ web application, using OTP
coupled with Cowboy as my back-end. I wanted to see if I could get into the same head-space as you. Here’s what I observed as I went along.

  1. I didn’t think about JS
    until late in the project’s life.
  2. When it was time to solve problems where JS
    would typically be employed, there seemed to be no solution other than JS
    .
  3. In several cases, I put some JS
    in there (as a place-holder until I figured out how to accomplish things without it). The JS
    was a fine solution but I genuinely felt that it was a dirty hack; it felt like a kludge.

What are your thoughts on my observations?

Amy
: I hope you figured it out in the end! Your last point is the one that got me thinking about a javascript-less world in the first place. I mean, think about it even on a source-code level. The page loads, then, afterward, you tell some scripts in the footer to observe the presentation in this pristine state, then to go around and mess about with it. Is there any other place in the stack where we architect code to work like this? Maybe some Nginx configs, or langs that use eval
or goto
… But it’s not like half our codebase is made up of those!

IKURA:
I see your point about the source-code. It’s unique, for sure. I suppose templating engines — like DTL
, or the likes in Rails — have us approaching problems slightly different, where things get coded pro-actively, not slapped on. Would you agree?

Amy
: I would submit that the templating approach makes you plan better, and since you broached the feeling
word earlier, it just feels better this way to me. Even with the most elegant javascript approach to a problem, at best the design in one that just feels retrograde instead of straightforward and assertive.

IKURA: What are some cautions you would give anyone about to try ‘JS-free’ web-development?

Amy
: First off, be prepared to pass a good deal of content to your templates from your backend. And with that, it’s a good idea to pick some templating engine that can take all those variables and be flexible with flow control. Django’s template language
is outstanding. Just take heart that this amount of “passing things from the backend” is normal, and to embrace it. Next, I would warn that when you brush up against flow issues, where you think you need javascript, just take a walk or something. There inevitably exists a scriptless solution. Lastly, be OK
with forms that submit circa 1999. Just remember, this is not an antipattern! Single page webapps, I believe, come from a very, very strange reaction to deathly slow Rails/Django/PHP backends. Perhaps it’s the single pager that’s the antipattern…

IKURA: A final two questions. What’s the worst hack you have had to make using the templating approach? Lastly, are you going to start a ‘No-JS’ movement? And of course, feel free to share any final thoughts on everything.

Amy
: I won’t be starting a movement. No. I don’t want any Node.js people coming after me! I would just remark that next time you peruse a popular website, observe how little javascript is probably needed in a lot of cases. Take the homepage of Reddit
, for example. Or Craigslist
. Then observe how much javascript it actually used. It’s used a ton because we have been given the tool, and in having this tool, we use it.

Regarding worst hack. That’s a hard one. In one of my javascript-free projects, I couldn’t figure out how to embed a realtime graph. In the end, I went with a 3rd party API
solution, who probably do
use javascript on their end, but technically, that project has no javascript in it on my end. I was pretty stuck without them, but it ended up being pretty great! I probably could have written something myself, but didn’t in this case. All’s well that ends well, I always say.

A million thanks goes out to Amy. G. Dala for her time in sharing her whimsical ‘No-JS’ development credo. It was a fun e-mail exchange & it’s never regrettable to hear what others are trying in the trenches of hacking.

what’s ikura?

follow on twitter

稿源:ikura (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Elbowing JavaScript out

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录