Hacker News new | past | comments | ask | show | jobs | submit login
Amplify: a jQuery component library for solving common web problems. (amplifyjs.com)
70 points by nicksergeant on Feb 17, 2011 | hide | past | favorite | 19 comments



Wow, this is exactly the kind of interface I dislike. It's way too verbose and I'm not sure why one would add this kind of layer on top of jQuery. I don't see where it makes things easier - it's more like it just provides yet another interface.


Amplify is a set of components designed to solve common web application problems with a simplistic API.

Pretty sure the author means 'simple' rather than 'simplistic.' It's an important distinction!


Simplistic means treating complex issues and problems as if they were much simpler, that's exactly what Jquery and its suit of plugins (including Amplify) does well.


'Simplistic' is perjorative: a simplistic solution is one that's too simple to properly address the problem.


So 'simplistic' is right? Would 'simplified' be incorrect here?

EDIT: A spot of googling shows that 'simple' is generally held to be the correct word in this context. I guess 'simplified' implies they've taken something complicated and made it simpler, whilst 'simple' implies they've not made anything more complicated than it needs to be.


i no think you know what that word means


This is not my cup of tea.

1. I don't like magic string names like "AjaxExample1". Why not return an object, and use:

var AjaxExpample1 = amplify.request...

2. It is not clear how you mix get parameters and post data. If I want to POST to "/users/{id}/", how do I separate the post values from the parameter?


For concern #2, If they parameter names are found in the request, they are replaced in the url and removed from the POST form data. Full explaination here: http://amplifyjs.com/api/request/#url_substitution/routing


This is true, but the examples are incomplete. The "RESTful" POST example excludes parameters in the URL. Small mistake, but very confusing.

I'd fix it, but they don't mention how to submit patches.


They do mention it. It's a little bit hidden, but see http://amplifyjs.com/community/#pull_requests


Three mediocre plugins bundled into one? Sorry but this left me underwhelmed.

There are much more powerful plugins for each of these problem spaces.


Can you give some examples?


Sure.

-- The 'request' module --

is mixing concerns (network protocol, caching, serialization, model) that you probably don't want to mix that way in a real app.

It's pretty trivial to roll the polling part yourself (setTimeout), if you really need a plugin then PeriodicalUpdater[1] might be a candidate (although there are many others, and the cool kids use comet/websocket now anyways).

I didn't quite understand the purpose of the caching part; the browser already caches for us after all. It seems like a misnomer for some sort of bridge to the localstorage, but I didn't quite get in what situation storing the verbatim server response would be useful - as opposed to storing the deserialized result (or part thereof).

Anyways for the serialization part JSON2.js[2] is your friend. And for models there are various choices, backbone.js[3] being the most popular recently.

-- The 'store' module --

doesn't seem to provide anything interesting over jq-store[4]. And if you really want your data to stick around then there's evercookie[5]

-- The 'pubsub' module --

was a little hard for me to understand the purpose of. Since it isn't actually about server messaging(?) but rather only a way of passing events inside the browser it seems like what you'd really want is either JavascriptMVC[6], Backbone[3], perhaps knockout[7], or the older chain.js[8], or maybe one of the other two dozen data binding plugins.

Admittedly on this last one I may very well just be missing the point entirely. PubSub inside the browser? Huh?

  [1] https://github.com/RobertFischer/JQuery-PeriodicalUpdater
  [2] https://github.com/douglascrockford/JSON-js
  [3] http://documentcloud.github.com/backbone/
  [4] http://medialize.github.com/jQuery-store/
  [5] http://samy.pl/evercookie/
  [6] http://www.javascriptmvc.com/
  [7] http://knockoutjs.com/
  [8] http://ajaxian.com/archives/chainjs-jquery-data-binding-service


PubSub is useful for implementing interfaces between data and UI layers. Js.io has one that has almost the same interface: https://github.com/mcarter/js.io/blob/master/packages/lib/Pu...


Great response!


Would love to see someone explain what this library does in simpler terms. I can't tell which terms are buzzwords, which are industry standard, and which terms are from their own internal vocabulary. PubSub? PubSub to what? Can you give some real world examples of when to use this library and what problems it solves.


There's a typo in the first example. You're missing a '1' in the first argument when you execute the ajax call.

The pub/sub is all local right? I got really excited, then not so much. I still see the value, but I was hoping it was more like Google's javascript+serverside-component PuSH client. [1]

http://code.google.com/apis/feed/v1/devguide.html#hiworld

(It's really cool, Google runs a PuSH bridge so their server side component subscribes to a Pubsubhubbub hub and receives updates and pushes them to the browser. I want to see an OSS implementation of it since it's really slick and PuSH is a neat protocol).


What is this PuSH client and protocol? Is that just another name for Pubsubhubbub? My google-fu is failing me on the term PuSH protocol.


    PubSubHubbub
    __ _  _
PuSH.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: