After adding gzip support the next thing I wanted to add was support for etags (entity tags) as they were the caching method supported by the server.
Amongst the other developers on the team there was some scepticism about the value of this. They'd not used etags before and so some assumed it wouldn't be worth doing.
It turns out this scepticism was due to ignorance. As they'd not used them before they didn't know how they worked.
With so much of software development involving data retrieved over HTTP I'm still surprised when developers aren't familiar with some of the more common HTTP Headers.
While working on this, my son (age 8) asked what I was doing at work. Here's how I explained it to him and how I've since explained it to other developers who have found the simplicity helpful.
Imagine I wanted to know a list of your friends.
You tell me that they are Archie, Bob and Charlie. Additionally you tell me that these are represented by special code 1.
The next time I ask you for a list of friends I can say that if they can still be represented by special code 1 then you can just tell me that they haven't changed.
That time you respond that they haven't changed.
Some time passes and I ask again. Still stating that I know what they are if special code 1 applies.
This time you reply that they are now Archie, Bob and Dan and these are represented by special code 2.
Some more time passes again and I can ask the question again this time stating I know the answer if it can be represented by special code 2.
So, in the above example the "special code" is an etag.
In the HTTP world the server responds with the content requested and an etag value in the header.
On subsequent requests I include the previously returned etag in the If-None-Match header.
If the content doesn't match that tag then a new response is returned like the first one. If the content hasn't changed (and does still have the same tag) then the server responds with a 304 (Not Modified) status.
The value of all this is that you can be spared the network overhead of the server returning data that is the same as what you've already received. This saves the time and cost (if on a mobile network or other connection where you pay for data) of the data transfer. You also avoid having to process data that matches what you already have.
There are downsides though too. You have to track the different etags for different requests. You may have to store the previous responses. (Especially if you want to use etgs beyond the single use of an app.) You also have to write your code such that it can handle a 304 response. This may mean that you can't treat a response with no body as an error. (Something I see a lot of people do.)
In the above mentioned team there was concern about the impact on the total amount of data sent by adding the extra request header. In reality this was much smaller than the several kilobytes of data we were saving on each not modified response. By adding support for etags we were able to substantially reduce the amount of data the app consumed.
This isn't the only way to not get data that hasn't changed from the server on subsequent requests and there are situations where it isn't appropriate or even possible but I think it's probably the simplest and definitely one to be aware of.
The complaints came to Louis Vuitton Replica Handbags a head two days ago, when at least 30 black football players announced that they would not play until the president left.
ReplyDeleteThe state is Swiss Replica Watches about 83 percent white and nearly 12 percent black.
ReplyDeleteThe Columbia campus is about 120 miles west of Replica Watches Uk Ferguson, Missouri.
ReplyDeleteninest123 11.24
ReplyDeletelouboutin uk, nike outlet, louis vuitton handbags, michael kors outlet online, nike air max, ralph lauren polo, longchamp bags, replica watches, christian louboutin, uggs outlet, burberry factory outlet, tiffany jewelry, uggs on sale, louis vuitton outlet, michael kors handbags, burberry outlet, tory burch outlet, ray ban sunglasses, oakley sunglasses, louis vuitton outlet, longchamp outlet, oakley sunglasses, ray ban sunglasses, ray ban sunglasses, oakley sunglasses, gucci handbags, oakley sunglasses, cheap jordans, ralph lauren outlet, tiffany jewelry, louis vuitton, uggs outlet, replica watches, michael kors outlet, prada handbags, michael kors, prada outlet, uggs on sale, christian louboutin, nike air max, louis vuitton outlet online, louboutin shoes, uggs on sale, nike free, michael kors outlet online, michael kors outlet store, longchamp outlet, cheap oakley sunglasses
north face pas cher, ray ban uk, polo lacoste pas cher, nike air max, nike air max uk, vanessa bruno pas cher, nike roshe uk, nike roshe run pas cher, abercrombie and fitch UK, nike air force, michael kors, michael kors outlet online, polo ralph lauren uk, true religion outlet, lululemon outlet, new balance, timberland pas cher, louboutin pas cher, michael kors uk, nike tn pas cher, hogan sito ufficiale, hermes pas cher, nike blazer pas cher, nike free pas cher, vans pas cher, nike air max pas cher, ralph lauren pas cher, nike air max uk, abercrombie and fitch, lunette oakley pas cher, true religion outlet, true religion jeans, coach outlet, burberry pas cher, sac guess pas cher, converse, north face uk, nike trainers uk, nike free, true religion outlet, hollister uk, mulberry uk, coach outlet store online, coach purses, michael kors, lunette ray ban pas cher, longchamp pas cher, longchamp soldes, jordan pas cher
ReplyDeletesupra shoes, coach outlet, bottes ugg pas cher, moncler, converse shoes outlet, canada goose pas cher, canada goose uk, juicy couture outlet, juicy couture outlet, moncler pas cher, sac louis vuitton, links of london uk, swarovski jewelry, sac louis vuitton, ugg,uggs,uggs canada, toms shoes, canada goose jackets, karen millen uk, montre pas cher, lancel, canada goose, moncler, uggs outlet, michael kors outlet, moncler uk, ugg uk, barbour, thomas sabo uk, wedding dresses uk, ugg,ugg australia,ugg italia, canada goose outlet, doke & gabbana, barbour jackets uk, replica watches, ugg pas cher, louis vuitton uk, moncler outlet, pandora charms, swarovski uk, marc jacobs, louis vuitton, canada goose outlet, pandora jewelry, louis vuitton, canada goose jackets, moncler, pandora uk, moncler jackets, moncler, hollister, pandora jewelry, canada goose
ReplyDeleteabercrombie and fitch, nike roshe run, soccer shoes, oakley, wedding dresses, polo ralph lauren, nike air max, nike air max, vans scarpe, valentino shoes, vans outlet, herve leger, p90x workout, beats by dre, iphone 5s cases, soccer jerseys, hollister, ray ban, instyler ionic styler, iphone cases, bottega veneta, insanity workout, s6 cases, timberland boots, giuseppe zanotti, jimmy choo outlet, iphone 6s plus cases, iphone 6 cases, mcm handbags, converse, reebok outlet, babyliss pro, louboutin, lululemon outlet, chi flat iron, mont blanc, new balance shoes, iphone 6 plus cases, north face outlet, salvatore ferragamo, mac cosmetics, asics running shoes, ghd hair, north face outlet, hollister clothing, softball bats, nfl jerseys, hermes handbags, ipad cases, celine handbags, gucci, iphone 6s cases
ReplyDeleteninest123 11.24
jianbin1208
ReplyDeletemichael kors uk outlet
fred perry shirts
lebron james shoes,lebron 12,lebron 12 shoes,lebron sneakers,lebron iv,lebron 11,lebron 10
nike air max 2014
timberland outlet
adidas jeremy scott
adidas outlet store
canada goose jackets
nike air huarache,nike huarache,nike huarache sneakers,nike huarache shoes
uggs outlet
north face jackets
football shirts uk,soccer jerseys uk,cheap soccer jerseys uk
coach outlet
winter coats outlet
ray ban sale
chanel handbags
michael kors usa
louis vuitton outlet online
lebron 12
michael kors outlet online
uggs outlet
ray ban sunglasses outlet,ray ban sunglasses,ray ban,rayban,ray bans,ray ban outlet,ray-ban,raybans,ray ban wayfarer,ray-ban sunglasses,raybans.com,rayban sunglasses,cheap ray ban
canada goose jackets
cheap mlb jerseys
uggs outlet
cheap ugg boots
winter jackets outlet
los angeles clippers
dallas cowboys