Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm going to start a side project to build a "single page" web application. The application needs to be real-time, sending updates to the clients as changes happen.

Are there any good resources for best-practice approaches wrt the architecture for these kinds of applications. The best resource I've found so far is the trello architecture article here: http://blog.fogcreek.com/the-trello-tech-stack/

To me, this architecture, although very sexy, is probably over-engineered for my specific needs - although I do have similar requirements. I'm wondering if I need to bother with a sub/pub at the server side, could I not just push updates from the server when something happens (e.g. when the client sends an update to the server, write the update to the db, and then send an update to the clients).

Tech-wise, I'm probably looking to build this out in Node.JS or maybe Ruby, although the architecture guidelines should to some extent apply to any underlying server technologies.

share|improve this question
add comment

3 Answers

I would definetly look towards client side MVC for this such as Backbone.js. It's very lightweight but will give your application some much needed structure. I highly recommend the Peepcode screencast as the fastest way of learning more about Backbone.

A nice architectural benefit of client side MVC like this is the fact that you can more easily move towards exchanging data with your server side e.g. structured JSON over REST.

Backbone.js supports this out of the box - you can serialise your models between the client and server as JSON, which can free us from thinking in terms of request/response.

Something like Node.js on the server side appeals under this model where you will possibly have a lot of short lived potentially asynchronous requests to push and pull data.

One alternative.... A model like Comet can be a simple way to achieve web pub/sub and there are some server side frameworks that support this.

share|improve this answer
    
Cheers, I was definately thinking of using an MV* FW for the client side, and have been learning about Backbone.. Good tips. –  Matt Roberts Apr 26 '12 at 12:10
add comment

I would probably go with a MV* javascript framework for the front end. I myself am building a single page web application and after investigating a number of solutions, I ended up going with Backbone.js. I found while this solution did not provide the most out of the box functionality, it did provide me with a core foundation to start with and is a lot more flexible than other solutions I looked at (which was important to me).

Other popular solutions are Ember.js and Knockout.js which do provide more out of the box functionality however you have to follow their conventions to make use of thT functionality (which may or may not work for you).

share|improve this answer
add comment

Sounds like what you're looking at is Apache 2.2 with PHP or Tomcat application server with a simple servlet which handles requests. It's the carpenter's equivalent of hammer and nails. Nothing complicated but it gets the job done. If you ever needed to expand functionality, you could always do so since Tomcat can support jsp and jsf if you ever needed it to.

For what concerns the front end, I'd be comfortable simply using jQuery ($.post, $.load, $.ajax) since it's quite handy doubling as a means to add functionality to your page in combination with jQuery UI

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.