RingoJS: Server-Side Javascript                      When Only Java Will DoDarren Cruse                         darren.cru...
Agenda✤   Server-Side Javascript? Ringo?✤   The main difference between Ringo and Node✤   Our Project At Elsevier...✤   Ri...
But first
Something funny
Something funny(from http://programmerryangosling.tumblr.com/)
(from http://programmerryangosling.tumblr.com/)
(from http://programmerryangosling.tumblr.com/)
(from http://programmerryangosling.tumblr.com/)
(from http://programmerryangosling.tumblr.com/)
(from http://programmerryangosling.tumblr.com/)
(from http://programmerryangosling.tumblr.com/)
(from http://programmerryangosling.tumblr.com/)
(from http://programmerryangosling.tumblr.com/)
As I picked out those funny pics...           I didn’t find them all equally funny.And it struck that depending on each of ...
Experiences that determine what we like and don’t like.
Would you have gotten this one?              (from http://programmerryangosling.tumblr.com/)
How about this?              (from http://programmerryangosling.tumblr.com/)
I bet you’d get this...           Don’t believe that trash                         talk girl...                     all of...
I remember a “softwareengineering workshop” class.    (not unlike this book)  Where you had to learn adifferent language e...
It’s absolutely understandable that we become    attached to our programming languages.Look how hard we work to get good a...
I myself seem to like “dynamic” languages.Perl, Groovy, Ruby, Python, Javascript kind of languages.
And I find these user groups fun. Sometimes it’s fun to be around people who have similar               interests, and back...
The people who hear I’m doing server side javascript.           And ask an annoying question.
Why?
An odd way to answer...✤   In the style of:
The following is a highly embellishedoverheard bathroom conversation.
Server Side Javascript?
Server Side Javascript?Why?!!
Server Side Javascript?Why?!!I mean...
Server Side Javascript?Why?!!I mean...Server Side Javascript?
Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!!
Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!!                          Why?
Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!!                                     Why?          ...
Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!!                                     Why?          ...
Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!!                                     Why?          ...
http://en.wikipedia.org/wiki/WTF
http://en.wikipedia.org/wiki/WTF       http://en.wikipedia.org/wiki/F*ck        http://en.wikipedia.org/wiki/Fart    http:...
No I’m serious.
Why Server Side Javascript?
Because
Javascript is the new Java
Huh?
Is it true?✤   Java was supposed to be the write once run anywhere language.✤   But java applets never got popular in the ...
Back to the bathroom...
Back to the bathroom (conversation).
OK so you’re anti-java now.
OK so you’re anti-java now.So you’re switching to node.js
OK so you’re anti-java now.So you’re switching to node.js                                 Well actually no.
OK so you’re anti-java now.So you’re switching to node.js                                 Well actually no.               ...
OK so you’re anti-java now.So you’re switching to node.js                                           Well actually no.     ...
Ringo?
Because javascript ain’t the new java.                      At least not yet.
Because javascript ain’t the new java.                                    At least not yet.flip-flopper!
Because javascript ain’t the new java.                                    At least not yet.flip-flopper!                    ...
How So?
Because...✤   JSON services✤   plus JSON datastores✤   along with Javascripts smooth handling of JSON    These all take a ...
Unnecessary Complexity?
Unnecessary Complexity?What kind of unnecessary complexity?
Unnecessary Complexity?What kind of unnecessary complexity?           Excruciatingly painful unnecessary complexity.
Unnecessary Complexity?What kind of unnecessary complexity?           Excruciatingly painful unnecessary complexity.      ...
Unnecessary Complexity?What kind of unnecessary complexity?           Excruciatingly painful unnecessary complexity.      ...
Unnecessary Complexity?What kind of unnecessary complexity?          Excruciatingly painful unnecessary complexity.       ...
So where does Ringo fit?
Ringo is a gateway drug✤   Ringo is a gateway drug from Java to Javascript.✤   Because its javascript running on top of ja...
Java and Javascript together in the same program?
Java and Javascript together in the same program?That sounds like this...
Java and Javascript together in the same program?That sounds like this...
No way dude it’s more like this...
No way dude it’s more like this...
I like my Java just the way it is.                                     My grandpa likes Cobol.                            ...
Bingo?
Ringo!
Ringo!               www.ringojs.orghttps://twitter.com/#!/ringojs        http://hns.github.com/                       Han...
The main difference betweennode and ringo       Hanne’s drawing stolen from: http://2011.wakanday.org/concurrent-ssjs/
The (other) main differencebetween node and ringo  Stolen from Oleg Podsechin’s Common Node talk at: http://www.slideshare...
Switching gears:About our project at Elsevier(the one using Ringo)
Before Ringo...
Before Ringo...
Fisher-Price Architecture Diagram
Fisher-Price Architecture Diagram
Is “json/java impedance mismatch” overstatingthings?
Is “json/java impedance mismatch” overstatingthings?
When we switched to ringo the same codelooked like this:
Only in the javascript version do you see one for one between:      a. What the JSON service specification indicates       ...
How about this json java style - is it better?
Other languages?(how about groovy?)
Would you call this a “json/groovy impedancemismatch”?
Would you call this a “json/groovy impedancemismatch”?
Javascript has an advantage for clear and readable   code for projects making heavy use of JSON
Sidebar: this is what our nextgeneration project will look like:
But for multiple reasons wecouldn’t go there for our project✤   Much legacy code that we did not have time to rewrite✤   I...
But in time, we’ve wound up here:
RingoJS (hands on)
EtherealJS
From last year...                    http://www.infoq.com/articles/rest-soap
From this year...                    http://www.infoq.com/news/2012/02/websockets-rest
Nathan Evans asks the realquestion...                  http://www.infoq.com/news/2012/02/websockets-rest
Nathan Evans asks the realquestion...
Ethereal’s an experiment...
That responds to this question...(about the fate of REST)
With an answer...
That’s consistent
with the lack of hair on my head.
And Ethereal’s answer is...             (drum roll please)
Remote Procedure Calls
(disappointed?)
Remote Procedure Calls havegotten a bad name...✤   e.g. CORBA’s approach to distributed objects promised location    trans...
But things are changing...  (e.g. the browser’s getting threads in the form of web workers)
But things are changing...(so synchronous calls via xhr can now be done without blocking the user)
And an approach doesn’t have to be right forevery situation...              To be right for some.
And considering the tradeoffs,              RPCs have one big advantage:        They are dead simple to understand.
If we lived in a world where RPCs had notbeen invented...  The next 8 year old who learned to program - would!
The main ideas in Ethereal✤   REST is assuming a heterogenous system with different    nodes implemented in different lang...
With the idea that CommonJSmodules feel a little like “actors”                    (but simpler) browserringo        node.j...
Important Ringo and Rhino Links✤   Ringo:✤   http://ringojs.org/✤   http://groups.google.com/group/ringojs✤   http://hns.g...
Thank You.
My Contact Info✤   Darren Cruse✤   darren.cruse@gmail.com✤   (314)482-9237
RingoJS:  Server-Side Javascript When Only Java Will Do
RingoJS:  Server-Side Javascript When Only Java Will Do
Upcoming SlideShare
Loading in …5
×

RingoJS: Server-Side Javascript When Only Java Will Do

2,247 views

Published on

Slides for a talk I gave at the St. Louis Javascript User Group about server-side javascript, Ringo, and a preview of my work-in-progress project EtherealJS which aims for easy interop between ringo, browser, and node.js.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,247
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
9
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • \n
  • I should warn you guys I think I’m good at writing but in general I think I’m not a good speaker.\nI’ve always liked to write and I think I kind of intuitively write my slides\nin a form that’s good for reading standalone.\nBut in some ways might be making these less good for presentation.\nI remember I gave a talk some years back.\nAnd my buddy later politely said “you were reading your slides.\nIt’s better if you just talk and let the slides be on their own you shouldn’t read them”.\nUnfortunately I’m sure I’ll do some of that tonite.\nEsp. since I’ve never given this talk before.\nI’m sure I’d do better if I gave the talk several times.\n\nThis is I think the 4th time I’ve presented at one of these groups.\nAnd I think the biggest thing I’ve realized is when it comes time to present.\nI need to remind myself to relax and say “WTF” - it doesn’t matter.\nBut that’s not always easy for me.\nWe all have different temperaments and personalities right.\nMy mom for example - no problem for her she can talk to anybody any group no matter how big.\n\nAlso I have no idea how long this presentation I’ve put together would take btw.\nI’m certain it’s going to run long.\nSo at some point near the end I will probably be asking you if you want to see more hands on with Ringo.\nOr if you’d like to hear about this open source project I’ve started.\nWhere selfishly I would like to hear your guys thoughts about what I’m doing and if it’s something you feel is worthwhile.\nBut another option is I volunteer again in 6 months or something to talk about Ethereal.\n\n\n\n
  • \n
  • \n
  • \n
  • When I picked out these pictures\nI didn’t find them all equally funny.\nAnd it struck that depending on each of your backgrounds\nYou guys wouldn’t find them all equally funny either\nI had to pick and choose which I thought you might enjoy\nAnd this reminded me of how unique people’s technology preferences are\nAnd how they often reflect our unique personal experiences\n
  • When I picked out these pictures\nI didn’t find them all equally funny.\nAnd it struck that depending on each of your backgrounds\nYou guys wouldn’t find them all equally funny either\nI had to pick and choose which I thought you might enjoy\nAnd this reminded me of how unique people’s technology preferences are\nAnd how they often reflect our unique personal experiences\n
  • When I picked out these pictures\nI didn’t find them all equally funny.\nAnd it struck that depending on each of your backgrounds\nYou guys wouldn’t find them all equally funny either\nI had to pick and choose which I thought you might enjoy\nAnd this reminded me of how unique people’s technology preferences are\nAnd how they often reflect our unique personal experiences\n
  • When I picked out these pictures\nI didn’t find them all equally funny.\nAnd it struck that depending on each of your backgrounds\nYou guys wouldn’t find them all equally funny either\nI had to pick and choose which I thought you might enjoy\nAnd this reminded me of how unique people’s technology preferences are\nAnd how they often reflect our unique personal experiences\n
  • When I picked out these pictures\nI didn’t find them all equally funny.\nAnd it struck that depending on each of your backgrounds\nYou guys wouldn’t find them all equally funny either\nI had to pick and choose which I thought you might enjoy\nAnd this reminded me of how unique people’s technology preferences are\nAnd how they often reflect our unique personal experiences\n
  • When I picked out these pictures\nI didn’t find them all equally funny.\nAnd it struck that depending on each of your backgrounds\nYou guys wouldn’t find them all equally funny either\nI had to pick and choose which I thought you might enjoy\nAnd this reminded me of how unique people’s technology preferences are\nAnd how they often reflect our unique personal experiences\n
  • When I picked out these pictures\nI didn’t find them all equally funny.\nAnd it struck that depending on each of your backgrounds\nYou guys wouldn’t find them all equally funny either\nI had to pick and choose which I thought you might enjoy\nAnd this reminded me of how unique people’s technology preferences are\nAnd how they often reflect our unique personal experiences\n
  • When I picked out these pictures\nI didn’t find them all equally funny.\nAnd it struck that depending on each of your backgrounds\nYou guys wouldn’t find them all equally funny either\nI had to pick and choose which I thought you might enjoy\nAnd this reminded me of how unique people’s technology preferences are\nAnd how they often reflect our unique personal experiences\n
  • \n
  • \n
  • If we watched your brains in an MRI machine while I showed you those pictures.\nAnd I could see the “pleasure centers” of your brain light up with what you found funny.\nI’d bet that from that information *alone*.\n I could figure out which of you guys were web developers and which of you guys had done SQL versus java etc. etc.\nAnd my point is I wouldn’t just see it in the “higher thinking” part of your brain.\nI would see it in the deep part of your brain.\nThe emotional, animal part of your brain.\nWe all have deep biases because of our unique experiences.\n
  • If we watched your brains in an MRI machine while I showed you those pictures.\nAnd I could see the “pleasure centers” of your brain light up with what you found funny.\nI’d bet that from that information *alone*.\n I could figure out which of you guys were web developers and which of you guys had done SQL versus java etc. etc.\nAnd my point is I wouldn’t just see it in the “higher thinking” part of your brain.\nI would see it in the deep part of your brain.\nThe emotional, animal part of your brain.\nWe all have deep biases because of our unique experiences.\n
  • Brendan Eich\nI’ve turned him into a creep (sorry Brendan)\nOf course I’m referring to this book...\n
  • Of course I’m referring to this book.\n
  • And I couldn’t resist putting in this picture.\nHave you seen this?\nI found both this and the ryangoslingprogrammer site thru the lamdba lounge google group btw.\nI do find this picture funny.\nAnd not to rain on the parade, but I did want to point out that the very title of this popular book.\nBespeaks a certain negativity surrounding the language.\nAnd I’ve been using pretty heavily server side for the last year and a half or so.\nAnd I like it - I feel like most of the negativity comes from it being *different* than what most people are used to.\nNot from it being bad.\nAnd to drive the point home let’s return to those funny ryangosling pictures again...\n\n
  • \n
  • \n
  • Perl is what really flipped the switch for me.\nWhen this guy was hired at this company I worked for.\nAnd started generating database reports in truly about a 5th the time it was taking me with C.\n
  • \n
  • \n
  • It’s annoying because I’m not always the best at explaining things.\nI’m often just intuitive.\nSo it’s a challenge for me to answer this question.\nIt’s asking me to work.\nAnd try and convince someone of something.\nThat they quite possibly won’t be convinced of.\nBecause they’re background, biases, and experiences\nAre different than mine.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • I hope nobody’s offend by my language here btw.\n*I’m* not saying it.\nI’m playing a part here.\nThese two guys are arguing and it’s an expression of their frustration.\nMy mom never liked this argument either.\nThe f word is a taboo word right. It’s scary to break taboos.\nLike using javascript on the server.\nI don’t normally say the f word.\nBut here I’m not saying it I’m playing a part while I’m saying it.\n\n
  • I don’t tweet or do facebook but I do know about like LOL and WTF.\nYou indian guys know about WTF right? Justin?\nThe indian guys are on average very polite btw.\nHere’s the wikipedia page...\nPlus...\n\n
  • I didn’t realize you can find wikipedia pages on anything btw.\nI don’t know why I didn’t realize that. \nI always would look up technical things.\nI never made the connection with it being truly like a real encyclopedia.\nHere’s also the pages for a lot of other things I didn’t expect to be there.\n \nThey’ve got a page for the mother of all curse words the F word.\nThey’ve got a page on farts where you can see the chemical composition of farts.\nAnd from there you can segue to relate fart topics\nIncluding “Fart lighting” also known as “pyro flatulence”.\nWhich many people know from the classic american film “Blazing Saddles”\nBut I digress...\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • So that’s an important question.\nWhat would it mean to say “javascript is the new java”?\nThat might be annoying statement to hard code java-only kinds of people.\nBut here’s my attempt at how one might support such a statement.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • John Kerry reference here.\nCan’t hear “flip-flopper” without thinking of John Kerry now days.\nHe should try and get like royalties or something on the work “flip flopper”.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \nYou indian guys no what Bingo is?\n
  • This was meant to be a punchy ending like in one of those commercials right.\nOf course it’s like one of those weird European commercials. Riccola!\nBut see I yell “Ringo” and now it’s ringing in your head.\nSo subliminally you’re going to want to use Ringo now.\nI’m no idiot.\n\n
  • \n
  • Ringo’s based on Rhino which has always had threads because it’s based on java.\ne.g. There’s a spawn keyword.\nAnd Ringo can deploy in a servlet container.\nWhere servlets have always had this thread per request model.\nWhere as a programmer you mostly write your code without thinking too hard that multiple requests may process in parallel under different threads.\nNode has support for threads now (e.g. threads a go go).\nBut the design of it’s inspired by things like EventMachine and Twisted in Python.\nWhich means non-blocking i/o.\nAnd events with callbacks. Events for everything including I/O.\nSo node has brought the single threaded non-blocking programming style of the browser to the server.\nWhile Ringo is really more comparable to other languages like Ruby or Python that have threads and blocking apis. \nRyan Dahl has said the node approach scales better at the high end because lots of threads that are blocked end up consuming a lot of memory.\nI should confess that I’ve still not written hardly any node code so take this with a grain of salt.\nBut to me it looks like an engineering tradeoff between ease of learning/ease of programming and scalability.\nIn other words, for projects that don’t need the extreme scalability of Twitter or Google, Ringo might provide a lower learning curve and still get the job done just fine.\nBut I guess it all depends on your background and your point of view which you prefer.\nAnd there are a lot of libraries and things in the node world now to simplify working with lots of callbacks.\n\n
  • \n
  • \n
  • This is a pretty standard state of the art java/spring/hibernate architecture.\nOut project is kind of hub that offers up json services to a front end customer facing portal (on the left)\nPlus some admin screens - that also tend to use a lot of ajaxy/web-2.0/json stuff there.\nAnd then talk both JSON and XML services to the back end.\nSo very much a service based SOA type of architecture.\nBut heavily using JSON and RESTful services as it’s data transfer format.\n
  • So by “converters” I’m really highlighting what I see as three kind of “programming models” being used here.\n(next slide) \n
  • JSON is really a javascript object.\nPOJOs are java’s standard object.\nAnd relational tables are the third.\nThese are each kind of independent programming models.\nI mean if we were writing this stuff in LISP maybe LISP S-expression list things would be the primary data strucure.\nIf it was Perl it might have been hashmaps which at least in my Perl days were popular.\nLikewise Relational databases have their ways of thinking about problems.\nAnd certainly Spring popularized the idea that you could organize programs in java using simple objects without a lot of inheritance hierarchies and stuff.\nSo all three of these are in a sense different “programming paradigms” with their own idioms for how you solve problems in them. \n
  • Now the idea of an “object-relational impedance mismatch” is well understood with databases.\nAnd hibernate is definitely seen as a good tool for dealing with that.\nSo no surprises there.\nBut I’m claiming there’s something at least a little similar on the left hand side too.\nAt least from the idealistic point of view that the code is harder to read and get right than it would be if that left arrow weren’t there.\n\n
  • So here’s a flavor of what our java code for working with JSON tended to look like.\nMaps from String to Object are what JSON looks like.\nPlus Lists for arrays.\nThe constants aren’t necessary of course.\nBut I showed them here because our guys were using them.\nAnd of course that is a java idiom that developers are taught to do this\n(like I was too when I first learned C years ago)\n\n
  • Here it is without those constants, and of course it makes the code a bit more readable.\nA bit closer to where you can see what the JSON is that this code is supposed to create.\n
  • But here’s the javascript function for generating the same JSON error payload.\nAnd here you see exactly what you’re generating.\n\n
  • So I feel the javascript version is a more readable and more likely-to-be-correct version.\n
  • \n
  • \n
  • I would call it that.\nIt’s really a syntax-mismatch with groovy.\nGroovy has neat meta programming features where you can give different semantics to things by using for example the “missing method” technique.\nPlus they’ve made a lot of stuff optional like parenthese and stuff.\nSo here e.g. “name” is really a method/”missing method” that’s taking the argument “Colorado”.\nBut there’s limits to this technique.\nIt’s the grammar of the groovy language that would not allow them to truly embed JSON syntax directly in groovy without that breaking other things in the groovy language. \n
  • \n
  • \n
  • so fewer boxes and fewer “conversions”\n\n
  • \n
  • So we didn’t wind up here overnight\nWe did the agile thing of learning a little bit more about Ringo \nIteration after iteration\nAnd ultimately wound up using it more and more.\nTo the extent now that we can do whole admin screens without using any spring mvc controller\ni.e. We do call out and use velocity from ringo\nThough ringo bundles mustache we just already had a standard of using velocity\nWe run ringo as a servlet filter and intercept all the reqests going through to spring\nso we can modify the json requests\nthe responses\nor even just completely take the place of the original spring mvc pipeline alltogether\nso this has a bit of an AOP flavor if you’re familiar - before advice/after advice/around advice\nWe’ve created a little ringo module where we can say “spring.inject” and inject one of our Spring services into a javascript module where we can call into those java “services” from javascript.\nAnd from there take advantage of hibernate as well no different than if we were in java.\nEsp. for a lot of our communication to these backend systems we’ve actually bypassed the original spring stack completely.\nAnd e.g. where those backends use XML SOAP services we’re actually hitting those SOAP endpoints RESTfully and working with the XML directly using Ringo’s E4X support.\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • WebSockets bring a different set of constraints to web programming.\nThe fact that they’re bidirectional is the biggie.\nThat the server can now message the browser without the browser initiating.\nBut also that they’re not tied to the HTTP verbs or status codes.\nThat they’re just basic plumbing for sending messages.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • This explains why right now I’m not *that* interested in Vertex. \nI’m not really embracing the polyglot idea anymore.\nI think there’s leverage gained by not being polyglot.\nThis is in line with the idea of “mobile code”, or “code on demand” in a distributed environment.\nThese things require the same language across the nodes to really make a lot of sense.\n
  • \n
  • \n
  • \n
  • \n
  • RingoJS: Server-Side Javascript When Only Java Will Do

    1. 1. RingoJS: Server-Side Javascript When Only Java Will DoDarren Cruse darren.cruse@gmail.comJune 19, 2012
    2. 2. Agenda✤ Server-Side Javascript? Ringo?✤ The main difference between Ringo and Node✤ Our Project At Elsevier...✤ RingoJS (hands on)✤ EtherealJS
    3. 3. But first
    4. 4. Something funny
    5. 5. Something funny(from http://programmerryangosling.tumblr.com/)
    6. 6. (from http://programmerryangosling.tumblr.com/)
    7. 7. (from http://programmerryangosling.tumblr.com/)
    8. 8. (from http://programmerryangosling.tumblr.com/)
    9. 9. (from http://programmerryangosling.tumblr.com/)
    10. 10. (from http://programmerryangosling.tumblr.com/)
    11. 11. (from http://programmerryangosling.tumblr.com/)
    12. 12. (from http://programmerryangosling.tumblr.com/)
    13. 13. (from http://programmerryangosling.tumblr.com/)
    14. 14. As I picked out those funny pics... I didn’t find them all equally funny.And it struck that depending on each of your backgrounds You guys wouldn’t find them all equally funny eitherI had to pick and choose which I thought you might enjoyAnd this reminded me of how unique people’s technology preferences areAnd how they often reflect our unique personal experiences
    15. 15. Experiences that determine what we like and don’t like.
    16. 16. Would you have gotten this one? (from http://programmerryangosling.tumblr.com/)
    17. 17. How about this? (from http://programmerryangosling.tumblr.com/)
    18. 18. I bet you’d get this... Don’t believe that trash talk girl... all of my parts are good ones. (from: my demented brain)
    19. 19. I remember a “softwareengineering workshop” class. (not unlike this book) Where you had to learn adifferent language every two weeks. I thought it was ridiculous.But I realize now what a good idea it was. (to force an open mind on a young brain)
    20. 20. It’s absolutely understandable that we become attached to our programming languages.Look how hard we work to get good at them.
    21. 21. I myself seem to like “dynamic” languages.Perl, Groovy, Ruby, Python, Javascript kind of languages.
    22. 22. And I find these user groups fun. Sometimes it’s fun to be around people who have similar interests, and backgrounds. You get the same jokes. Programming languages do form “communities”.But like at my company we’ve traditionally been a java shop.So it’s understandable that you meet people who are new to things like server-side javascript and node.
    23. 23. The people who hear I’m doing server side javascript. And ask an annoying question.
    24. 24. Why?
    25. 25. An odd way to answer...✤ In the style of:
    26. 26. The following is a highly embellishedoverheard bathroom conversation.
    27. 27. Server Side Javascript?
    28. 28. Server Side Javascript?Why?!!
    29. 29. Server Side Javascript?Why?!!I mean...
    30. 30. Server Side Javascript?Why?!!I mean...Server Side Javascript?
    31. 31. Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!!
    32. 32. Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!! Why?
    33. 33. Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!! Why? Why Server-Side Javascript?
    34. 34. Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!! Why? Why Server-Side Javascript? What do you mean why?
    35. 35. Server Side Javascript?Why?!!I mean...Server Side Javascript?WTF Dude!! Why? Why Server-Side Javascript? What do you mean why? YTF Not A**h***!!
    36. 36. http://en.wikipedia.org/wiki/WTF
    37. 37. http://en.wikipedia.org/wiki/WTF http://en.wikipedia.org/wiki/F*ck http://en.wikipedia.org/wiki/Fart http://en.wikipedia.org/wiki/Flatulence http://en.wikipedia.org/wiki/Brain_fart http://en.wikipedia.org/wiki/Fart_lighting
    38. 38. No I’m serious.
    39. 39. Why Server Side Javascript?
    40. 40. Because
    41. 41. Javascript is the new Java
    42. 42. Huh?
    43. 43. Is it true?✤ Java was supposed to be the write once run anywhere language.✤ But java applets never got popular in the browser.✤ Java became popular on the server.✤ But now days node.js is bringing javascript to the server.!✤ Plus: the browsers becoming practically an operating system of its own.✤ With threads and sockets and canvas graphics.✤ So java was supposed to be the write once run anywhere language.✤ But if your "anywhere" includes the browser...✤ Its looking like javascript is really becoming the write once anywhere language.✤ Not java.
    44. 44. Back to the bathroom...
    45. 45. Back to the bathroom (conversation).
    46. 46. OK so you’re anti-java now.
    47. 47. OK so you’re anti-java now.So you’re switching to node.js
    48. 48. OK so you’re anti-java now.So you’re switching to node.js Well actually no.
    49. 49. OK so you’re anti-java now.So you’re switching to node.js Well actually no. At least not yet.
    50. 50. OK so you’re anti-java now.So you’re switching to node.js Well actually no. At least not yet. Right now Im using Ringo.
    51. 51. Ringo?
    52. 52. Because javascript ain’t the new java. At least not yet.
    53. 53. Because javascript ain’t the new java. At least not yet.flip-flopper!
    54. 54. Because javascript ain’t the new java. At least not yet.flip-flopper! javascript is becoming a very productive part of the server side tool chain.
    55. 55. How So?
    56. 56. Because...✤ JSON services✤ plus JSON datastores✤ along with Javascripts smooth handling of JSON These all take a weed wacker to unnecessary complexity in server side development.
    57. 57. Unnecessary Complexity?
    58. 58. Unnecessary Complexity?What kind of unnecessary complexity?
    59. 59. Unnecessary Complexity?What kind of unnecessary complexity? Excruciatingly painful unnecessary complexity.
    60. 60. Unnecessary Complexity?What kind of unnecessary complexity? Excruciatingly painful unnecessary complexity. WebSphere Admin Console
    61. 61. Unnecessary Complexity?What kind of unnecessary complexity? Excruciatingly painful unnecessary complexity. WebSphere Admin Console kind of unnecessary complexity.
    62. 62. Unnecessary Complexity?What kind of unnecessary complexity? Excruciatingly painful unnecessary complexity. WebSphere Admin Console kind of unnecessary complexity.
    63. 63. So where does Ringo fit?
    64. 64. Ringo is a gateway drug✤ Ringo is a gateway drug from Java to Javascript.✤ Because its javascript running on top of java.✤ Ringo adds the CommonJS module system to Rhino.✤ Where Rhino is the tried and true been around forever javascript interpreter for the JVM.✤ With Rhino you can call into java code, just like with Groovy or JRuby or Clojure etc.✤ but with javascript - which is something we were doing a lot of anyway.✤ So there’s really not much to learn.
    65. 65. Java and Javascript together in the same program?
    66. 66. Java and Javascript together in the same program?That sounds like this...
    67. 67. Java and Javascript together in the same program?That sounds like this...
    68. 68. No way dude it’s more like this...
    69. 69. No way dude it’s more like this...
    70. 70. I like my Java just the way it is. My grandpa likes Cobol. I mean he liked Cobol. He passed away last year. Like Javas going to someday.Maybe.No time soon though. Bingo!
    71. 71. Bingo?
    72. 72. Ringo!
    73. 73. Ringo! www.ringojs.orghttps://twitter.com/#!/ringojs http://hns.github.com/ Hannes Wallnöfer (lead developer)
    74. 74. The main difference betweennode and ringo Hanne’s drawing stolen from: http://2011.wakanday.org/concurrent-ssjs/
    75. 75. The (other) main differencebetween node and ringo Stolen from Oleg Podsechin’s Common Node talk at: http://www.slideshare.net/olegp
    76. 76. Switching gears:About our project at Elsevier(the one using Ringo)
    77. 77. Before Ringo...
    78. 78. Before Ringo...
    79. 79. Fisher-Price Architecture Diagram
    80. 80. Fisher-Price Architecture Diagram
    81. 81. Is “json/java impedance mismatch” overstatingthings?
    82. 82. Is “json/java impedance mismatch” overstatingthings?
    83. 83. When we switched to ringo the same codelooked like this:
    84. 84. Only in the javascript version do you see one for one between: a. What the JSON service specification indicates b. What the code looks like, and c. What testing with a browser actually returns.
    85. 85. How about this json java style - is it better?
    86. 86. Other languages?(how about groovy?)
    87. 87. Would you call this a “json/groovy impedancemismatch”?
    88. 88. Would you call this a “json/groovy impedancemismatch”?
    89. 89. Javascript has an advantage for clear and readable code for projects making heavy use of JSON
    90. 90. Sidebar: this is what our nextgeneration project will look like:
    91. 91. But for multiple reasons wecouldn’t go there for our project✤ Much legacy code that we did not have time to rewrite✤ Including code that depended on Oracle tables!
    92. 92. But in time, we’ve wound up here:
    93. 93. RingoJS (hands on)
    94. 94. EtherealJS
    95. 95. From last year... http://www.infoq.com/articles/rest-soap
    96. 96. From this year... http://www.infoq.com/news/2012/02/websockets-rest
    97. 97. Nathan Evans asks the realquestion... http://www.infoq.com/news/2012/02/websockets-rest
    98. 98. Nathan Evans asks the realquestion...
    99. 99. Ethereal’s an experiment...
    100. 100. That responds to this question...(about the fate of REST)
    101. 101. With an answer...
    102. 102. That’s consistent
    103. 103. with the lack of hair on my head.
    104. 104. And Ethereal’s answer is... (drum roll please)
    105. 105. Remote Procedure Calls
    106. 106. (disappointed?)
    107. 107. Remote Procedure Calls havegotten a bad name...✤ e.g. CORBA’s approach to distributed objects promised location transparency but didn’t really deliver (network latency anyone?).✤ (normal) procedure calls are synchronous by nature.✤ In a single threaded environment (like the browser!) synchronous calls block the user...
    108. 108. But things are changing... (e.g. the browser’s getting threads in the form of web workers)
    109. 109. But things are changing...(so synchronous calls via xhr can now be done without blocking the user)
    110. 110. And an approach doesn’t have to be right forevery situation... To be right for some.
    111. 111. And considering the tradeoffs, RPCs have one big advantage: They are dead simple to understand.
    112. 112. If we lived in a world where RPCs had notbeen invented... The next 8 year old who learned to program - would!
    113. 113. The main ideas in Ethereal✤ REST is assuming a heterogenous system with different nodes implemented in different languages and using different tools.✤ What if you assumed javascript all around?✤ What if CommonJS modules could be "remote modules"?✤ So machine “A” could do a require and use a module running on machine “B” as easily as if it were on the local machine.
    114. 114. With the idea that CommonJSmodules feel a little like “actors” (but simpler) browserringo node.js smart phone
    115. 115. Important Ringo and Rhino Links✤ Ringo:✤ http://ringojs.org/✤ http://groups.google.com/group/ringojs✤ http://hns.github.com/✤ http://twitter.com/ringojs✤ Rhino:✤ http://www.mozilla.org/rhino/doc.html✤ http://www.mozilla.org/rhino/ScriptingJava.html
    116. 116. Thank You.
    117. 117. My Contact Info✤ Darren Cruse✤ darren.cruse@gmail.com✤ (314)482-9237

    ×