Book Store Referral Applet

Book Store Referral Applet


This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project, and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

This is one of the amanuensis projects. The intent of this Applet is to allow you to automatically specify and keep up to date several sources for a book you mention in a web page. If you buy a book I recommend via a link to Amazon on my website, I will get a 15% commission. If you buy something else I will get 5%.

However, Amazon is not necessarily the best place for you to buy the book. If you look in the Java & Internet Glossary under Book Stores you will find a list of quite a few online book stores. One may have the book more cheaply. One may be located closer to you. You may have a special discount arrangement with one. Another may be able to deliver it more quickly. You may have had a particularly bad or good experience with some store. Some stores may not accept the credit cards you use.

On my side, I may make even more lucrative arrangements with other bookstores, that carry a smaller selection of books. I don’t have the time to keep track of which bookstores carry which books and which stores have the best prices on each book. I don’t know from day to day which is the best place to buy each book. Further, there is no best place. It depends on too many factors. It would be better if clicking gave you a choice of vendors, like this:

book cover recommend book⇒Handbook to Higher Consciousnessto book home
by Ken Keyes Jr. 978-0-9600688-8-3 paperback
birth 1921-01-19 died: 1995-12-20 at age: 74 978-0-9600688-9-0 hardcover
publisher Love Line 978-0-940687-13-4 audio
published 1984-08
Ken’s classic. This is by far his best selling book. You can read part of it online.
Australian flag abe books anz abe books.co.uk UK flag
Chinese flag amazon.cn amazon.co.uk UK flag
German flag abe books.de abe books.ca Canadian flag
German flag amazon.de amazon.ca Canadian flag
Spanish flag amazon.es Chapters Indigo Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Google play American flag
Italian flag amazon.it O’Reilly Safari American flag
India flag junglee.com Powells American flag
UN flag Kobo other stores UN flag
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.

I hope it is coming clear ideally what this Applet does. You click on the book, and it shows you just the bookstores that carry the book, their price (including shipping, duty and taxes), delivery time, sorted in descending order either by price or estimated delivery time. It also tells you how fresh/reliable the information is (perhaps using icons) for each bookstore. It may further automatically filter out stores that don’t handle one of your available cards, or use icons to show which ones are accepted.

I have already done a crude version of this that just builds links to three bookstores without checking prices or availability.

Instead of embedding a reference to Amazon in my HTML (Hypertext Markup Language), I would embed a reference to the comparison shopper Applet/servlet, along with the book’s ISBN (International Standard Book Number) as a parameter.

The scheme would let you go visit any of the book stores and then do your shopping and browsing there directly. The Applet’s job is simply to direct the people to the most promising online bookstores for each book.

If you want to get even more clever, you can hook into the search engines of the various stores to determine the ISBN when the user does not know that, then use the ISBN to go comparison shopping.

Your little engine can work given any ISBN. It need not be one you have on file. The comparison shopper on the server goes out looking while the customer waits. It might even provide estimated prices and availability when it can’t get through right away to all the bookstores.

After you have all this working, you might do a thin client version as well, that does not require an Applet. It works by generating pure HTML at the server.

You can write a very simple version of this program that just directs the user to a generated page that takes you to several bookstores. A CGI (Common Gateway Interface) Java Servlet generates HTML code. This is valuable even without the comparison shopper feature because:

  1. It can generate revenues even when the customer does not buy from your official associate. You get money no matter what store he buys from, so long as you have a refer deal set up either directly or indirectly with the store.
  2. You get the full specific ISBN commission, even if you don’t list the book in your webstore. Stores give higher referral fees when you mention the ISBN number than if the user finds the book by browsing.

How to Make Money

You can make money with this if you make commission arrangements with most or all the bookstores you refer to. Further, you can rent out your Applet and possibly database server service as well to owners of other websites containing referrals to books. They would then get the referral commissions. They may simply use your Applet free, and you get the commissions or split them 50/50. The benefit to them is pleasing people browsing their website.

Most commonly you would offer to share the proceeds of the referral fees with anyone who puts the Applet up on their site. That way people who use your Applet need not sign up themselves with 50+ bookstores as affiliates. They use your accounts, and you track internally to figure out where various referral fees came from. They get one quarterly cheque from you, if the amount is above some minimum. Be aware that bookstores won’t necessarily provide you with detailed, timely accurate statements. The statements won’t track which site generated the sale either. Reconciliation is a major headache.

ISBN

The ISBN consists of 9 digits plus one check digit (0..9 or X). To calculate the check digit you must multiply the last digit of the true number by 2, the last but 1 by 3 etc. and add these results. The number needed to fill this sum to the next multiple of 11 is the check digit. If it is 10, the check digit is replaced by the letter 'X' (historically correct of course). In case the user mistypes an ISBN, (e.g. by transposing two digits) you want to explain that to him, rather than misleading him by telling him no one has the book in stock.

Here is an example valid ISBN 0201479508. Here is how you ensure that it is valid.

ISBNs (International Standard Book Numbers) are sometimes written with dashes, breaking them up into variable length fields, much like class A, B, C IP (Internet Protocol) addresses. For all practical purposes, you can ignore dashes and just remove them. However, if you are a perfectionist and want to display them properly you can read up on the rules. For code you can cannibalise to verify checkdigits and insert dashes, see the ISBN Amanuensis..

How does this work under the covers?

Unsigned Applets are not allowed to go shopping, because the sandbox security mechanism stops them from talking to any server except the one they were loaded from. A signed Applet, however could. Alternatively, unsigned Applets could could ask the server for the book pricing information. A servlet or application on the server is allowed to go comparison shopping. It can keep this information reasonably up to date. It need not comparison shop more than once per day per book. It need not comparison shop about a book no one has asked about recently. So you probably would implement this without any Java in the client, just using a servlet, though you might experiment with an Applet since it requires no co-operation from your ISP (Internet Service Provider) to let it run.

You need a very simple database of book information, possibly a Hashtable, BTree or SQL (Standard Query Language) lookup by ISBN. This database is kept on the server. You can access it via JDBC (Java Data Base Connectivity), CGI or a servlet talking HTTP (Hypertext Transfer Protocol) or raw sockets. At night the server goes shopping, getting fresh prices on the most popular items first, making sure to hop from store to store so as not to put an undue load on any one store. Eventually there may be a protocol for stores to notify you of price or availability changes so you don’t need to pester them with nightly polls.

You want to avoid polling any more frequently than absolutely necessary to remain on good terms with the book stores. Reduce polling frequency if the store does not carry the book. Reduce polling frequency if the price has not changed in a long time. Reduce the polling frequency if no other books at the store have recently changed prices. Reduce polling frequency if the book is not popular.

If you want to get fancy, you can use cookies to track your customers, mainly so you know what country/state/province they live into compute shipping charges and taxes accurately. See the list of country codes. For a simple version, you might leave taxes and shipping out. However, you need that information to properly comparison shop. It can be hard to worm it out of a book store owner before committing to purchase.

The hardest part of this project is gathering the price information in many formats from many stores. The interfaces you are dealing with were designed for humans, not computers. They may change at any time. Before you get heavily into that, prototype the idea with fake or hand calculated data. Smooth the rough edges off your user interface, simulate the delays and see if the idea is acceptably quick, and whether end users love or hate it. It may be a licence to print money or a black hole for it. Perhaps some bookstores offer computer friendly price and availability lookup interfaces.

Invoking HTML

To recommend a book, you just need add three lines of standard HTML to your webpage giving the ISBN, formatted or unformatted of the book. You don’t need to provide title, author or book cover GIF/JPG. The Applet automatically deals with finding and displaying a book cover image, the title, the author and the formatted ISBN. A link to a book using Javascript might look like this:

<!--Esperanto Dictionary-->
<script type=text/javascript language=javascript src=http://bookdirect.com/price?cust=canadianmindprod&isbn=9780960068883> </script>
or using Java, like this:

The book cover *.gifs/jpgs could be automatically plucked from bookstores, cached on a central server, cached on the local server, cached on local hard disk or cached in the browser. A simpler version would just look on the local server for the GIF (Graphic Interchange Format), and provide a dummy one if none were available, e.g. just giving the title of the book in large type, on a coloured background.

Because it is so little work to recommend a book, people might be much more willing to add such links. They are easier to set up than a traditional link, which requires custom gobbledegook like this:

<!-- macro Insert cited/9780960068883.html Book -->
You could use such an Applet to raise money for your favourite charity. All you need do is provide for a variable *.jpg to be displayed that explains how the generated revenue is spent.

Book Animator

Now lets take that one step further. Instead of providing just one ISBN, provide a list, either embedded in the HTML on in a file you upload to your website. Now the Applet can do a number of things:
  1. Randomly display a different book each time it is loaded.
  2. Change the displayed book every 10 seconds.
  3. Allow the user to scroll through the suggested books, along with your comments about them.
  4. Display the books 4 at a time, and allow scrolling.
  5. Display banner ads from Amazon about specials etc.
  6. It could provide direct links to the search engines or other popular parts of Amazon.
Now it takes only 10 keystrokes to add one more book to your list of recommendations. This should greatly encourage you to add lots of recommended books to your website.

You Don’t Need To Start From Scratch

I use a crude version of this amanuensis right now to generate the links on the CMP (Canadian Mind Products) site. You are welcome to the source code. I will release it as a shareware product once I add the following features:

  1. Ability to lay out several books in a grid. Doing this by hand is very tedious and error-prone.
  2. Ability to get the images, titles and authors automatically from the bookstore websites. You can use the ImageInfo class part of the CMP business classes to automatically find out the width and height.

The Competition

There are some comparison shoppers out there already, such as mySimon, but this would be quicker since normally it would have recent prices already on file on a given narrow class of books e.g. Java.

Since I wrote up this project many book pricers have sprung up and faded away. See the list. None of them have been willing to share the proceeds with people who link to them which gives no incentive to link to them.

You also need a way to bulk refresh any generated HTML by extracting the variable data and rerunning the generator. See the HTML macros project Which could be used to generate or regenerate complex HTML.

Bowker ISBN FAQ
ISBN.org: issues ISBNs in the USA

This page is posted
on the web at:

http://mindprod.com/project/bookrefer.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\project\bookrefer.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Blog
IP:[65.110.21.43]
Your face IP:[54.227.12.219]
You are visitor number