This is actually a really interesting question, because it offers some interesting design solutions.
I prefer rendering partial templates because it gives my applications the ability to change over time. If I need to change from <table> to <div> using a chart, it is easy to encapsulate this in a template. With that in mind, I see almost every page as a collection of many small templates that can change. Grails 2.0 graphical scaffolding is a good fit for this type of approach, and that's a good idea.
The question of whether they should be client templates or server ones is a major issue.
Server-side templates retain markup cleanup on page load. Even if you use something like Mustache ICanHazJS , you just need to have an empty element on the page (something with your template), properly configure it and work with it in Javascript to update your information.
disadvantages
- "chatty" applications
- large envelopes over the wire (responses include HTML that can be considered static)
- slow user interface response time
Benefits
- Good for people with lots of server side experience.
- It may be easier to manipulate or modify in a server environment (for example, returning a page embedded in several templates that are programmatically loaded and included)
- Saves most of the material in one place
However, client templates can actually reduce server load. They make the application "less -chatty" because you can potentially minimize the number of server calls by sending larger JSON collections back (in the same number of bytes or less that HTML will process to the server-side server schema). They also make the user interface very fast for users, as clicking on the update link does not have to do AJAX round-trip. Some said:
Anthony Eden @aeden 10 Dec Reply Retweets Favorites · The future of web applications is open: requests are processed by functions, logic is always asynchronous, and HTML is never generated on the server.
disadvantages
- Not very suitable for SEO (non-semantic extraneous user interface elements when loading the page)
- Requires Javascript foo (for managing items)
Benefits - Responsive - Smaller Envelopes
Trends seem to move toward client-side patterns, especially with the power provided by HTML5 add-ons (like <canvas> ) ... but if you need to use them, you must rely on technologies that you are not very familiar with, and you Feel more comfortable with Grails particles, it might be worth starting with them and exploring refactoring towards client templates depending on performance and other issues later.
source share