Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We've found that the additional overhead of sending HTML vs JSON is negligible in most cases. The additional speed gained by just sending JSON across is not worth the programming enjoyment hit of doing everything client-side.

When you get below 50-100ms per action, things are generally fast enough that this is not a key problem any more. The user cares greatly if you can go from 800ms to 100ms, but not so much if you can go from 100ms to 70ms.



I have to agree here. A major problem with client-side json is the need for additional documentation and likelihood of things breaking because of simple html edits.

For example, if you are populating a bunch of divs inside a parent div with the data returned using json, you would describe this using something like jquery selectors. Now if someone else comes and moves around the div during a redesign, he must go through whole bunch of js to make sure his shuffling of the divs around won't break the jquery selectors populating the data from json.

Now think about having a parent div that is simply populated with returned HTML from server-side and it seems way easier than using json to populate the data.


That's nonsense, the same issue would apply on the server side templates. If you go around messing with DIVs without an idea of the consequences, you will get in trouble regardless of your templates being on the server or client. If you try to have the designer do a redesign without testing the application afterwards, you're always in for trouble.


you will get in trouble regardless of your templates being on the server or client

My view is that you will get in significantly less trouble because manipulating an HTML template that is rendered on server side is much easier to manage and adapt to a new design than finding nitpick jquery selectors across the app that depend on a specific div structure.

Btw, my post doesn't imply anywhere that a designer should redesign an app without testing. Therefore, your argument about testing is garbage.


Rather than "finding nitpick jquery selectors" I use a client side framework (backbone.js) with a lot of Views which makes my development faster vs using server side templating, so I cannot share your opinion.


Programming enjoyment is, of course, subjective, but for your team the enjoyment is ruby, understood :)

What browsers are you getting the 50-100ms numbers? Similar results on mobile (with a 3G connection)?


50-100ms is the time it takes to generate the response on the server. On top of that you have to add the ping time between you and server and whatever other network overhead there is.

That's why it's great to be closer to 50ms so you'll stay under 100ms even with the network overhead.


How does this impact if you are aiming to build a JSON API too?


Double work.


Not with Rails, afaik. Assuming the routes are consistent, you simply add a 'respond' for JSON and send the relevant chunk of the model. Easy as pie.


That assumes, of course, that the viewmodel used to render the server-side view is identical to the model you'd return serialized into JSON. That's mostly true, but not always.


How about HTML versus MessagePack ( http://msgpack.org/ )?




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

Search: