This week's book giveaway is in the Design forum.
We're giving away four copies of Experimentation for Engineers: From A/B testing to Bayesian optimization and have David Sweet on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Architecture

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Sheriff
Posts: 67699
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67699
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67699
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I'm full of tinier men! And a tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic