• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Architecture

 
Stijn Janssens
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a back-end developer, been using JEE (web services, ESBs, JEE, ...) for ages but just started playing around with HTML 5, CSS 3 and Javascript....
Could someone give me some inside into best practices for architecting html5-javascript web apps.... What's the best high-level architecture?
Say you want to implement a blog but you don't want to go the Wordpress route... You create a DB and offer some Rest services and then you write your index.html file with the general content (header, body, footer, ...). Now, how do you retrieve the blog articles? Do you use javascript web sockets when the page loads and update the DOM accordingly, adding the HTML code through Javascript at runtime? Or do you use AJAX for that? Or is there some other data binding technique?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing precludes good old JSP for server-side templating. Why do a lot of work on the client if you don't have to?

The only time I use client-side templating is when I cannot use server-side templating because I'm directly accessing a RESTful API that serves JSON. Even then it's sometimes expedient to digest the web service on the server.

I guess it depends on a lot of factors that aren't apparent in your post.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, are you actually trying to figure out how to write exclusively client-side apps give a remote RESTful API?
 
Stijn Janssens
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Or, are you actually trying to figure out how to write exclusively client-side apps give a remote RESTful API?


Exactly, I am just trying to understand what the best practices are for structuring client-side apps that have dynamic content based on data retrieved from RESTful APIs...
I am aware of alternative approaches (like JSP, PHP, rails, ...) but I'm just interested in a HTML5-Javascript only approach so I was wondering if you should use web sockets for this or AJAX or ???


Thanks!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's one app I am working on where an embedded server is too wimpy to be able to run server-side templating. So I'm getting data from that server's RESTful API via Ajax, and using jQuery and its .tmpl() plugin to do client-side templating.

Given a choice, I prefer to do as much work on the server as possible -- but where that's not possible, client-side templating can do the trick.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic