PDA

View Full Version : Rich AJAX Website - Help Needed


conwaypm
03-17-2009, 01:58 AM
Hello all. I've currently got a project due in (in about 6 weeks) whereby I have to create an online shop that utilises AJAX in a big way (Ie, should feel like a desktop application). The nature of the project is to explore the 'limits' of AJAX.

I've had this assignment for some time and have been extremely indecisive about the best (and quickest!) way to go about it. Currently I have;


SQL database on the back-end
Java servlets which handle requests/responses
Data transferred to and from client in JSON
Dojo javascript library used on the client for constructing UI etc..


As I have developed the project, I can't help but think that my lack of experience with web-programming in general is slowing me down considerably. So I'm turning towards some knowledgable people in the hope they can point me in the right direction.

I have been rethinking almost every aspect of my current design;


The database only has about 100 records that I have input manually. It needs to require thousands and it has been recommended I use Amazon Web Services. Do I cut out the products from my own SQL database and use this webservice instead? I can see no other way of populating my SQL database with that amount of data (and I'm not particularly experienced with SQL).
JSON seemed like a nice, simple method for transporting data but if I introduce AWS into my project, does it make more sense to use XML as my choice of data-representation? I can see nothing inherently wrong with JSON at the moment but with my limited experience, I'm not sure if choosing XML would just be a cleaner, less-hassle approach when I get further into development?
Are Java servlets appropriate? Again, I can see no major reason why not other than I am not _that_ familiar with the alternatives available and so I feel quite comfortable using these.


These are just a few of the points I am confused on. Really I'm just looking for people who have developed a similar web-app (or are in the process) and would like to hear their advice on what worked/didn't work for them. The site is one-person programming task so does not have to be absolutely massive/complex however it must implement standard AJAXian features in a seamless manner, and so requires some planning on how to achieve this efficiently.

If anyone can point me to some good articles/guides/examples then I would also be very appreciative. I've read a great deal about AJAX but unfortunately I have yet to convert that into concrete ideas I can go ahead with and just implement.

I'll be happy to answer questions and get more specific with certain things if anyone wants but at the moment I'd appreciate any responses that can get the wheels turning on this. Thanks :thumbsup:

ohgod
03-17-2009, 06:11 PM
if you are open to things other than what you listed, i've built to web pages that act like the desktop with prototype and this:

http://prototype-window.xilinus.com/PWC-OS/

prototype has all sorts of ajax built in (and json handling), and that between the library i've linked to and scriptaculous there are a lot of possibilities. i code in php though.

conwaypm
03-18-2009, 02:53 PM
Thanks for your reply ohgod. Prototype does seem like a good javascript library which I may make use of. However, dojo seems to contain a lot of similar functions to prototype so I think I can probably use dojo and achieve the same end-result (I am not too familiar with prototype so excuse me if I've made any wrong assumptions about it).

Unfortunately I'm not familiar with PHP (I wish I had time to learn it) and am fairly set on using Java and servlets to handle my client-requests at this late stage.

I have been reading up on dojo and am intending to implement a data-store on the client that will continually request (via my rest interface, Ie; /Product/id=01) new data as and when I need it. I intend to register widgets to this (and other) data stores so they may access the data to display and refresh the UI when needed.

As far as client goes, I am fairly confident that dojo can provide me with everything I need. I am also set on using Servlets and a REST interface by which I can access the resources I need, which if anyone is interested, are;


/Product/id=01
(GET returns product with given ID)
/Products
(POST sends search parameters and a list of Product items are returned.
/ShoppingCart/cartID=01
(GET returns list of CartItems in cart with given cartID/ POST adds a Product with given ID to the cart/ DELETE deletes an Product with given ID from the cart).

*I may add more resources, but this gives you an idea of what I'm doing.

I am using JSON to send lists of products/cartItems from the server to the client, which dojo can eval, put into my datastore etc...Does this seem like a sensible approach? Has anyone implemented (or know of examples online) a similar architecture for their web-app?

One problem I am having is populating my SQL database with 'Products'. In my case, products are CDs (albums, singles etc). I have a simple table structure at the moment which may need adding to, but the basics are there. Does anyone know where I can obtain a lot of records for CD releases which I can put into my SQL database in an automated way? Or an external, online database that I can send requests to? At the moment it looks like I will have to input (manually) about 2000 records myself, which given my limited time available is something I'd rather avoid (but I'm not totally against it if there's no _simple, quick_ solution to my problem).

Any and all comments are appreciated :)