daisy
daisy

Reputation: 23489

Is there any advantage for dynamic website like this rather than pure-AJAX based ones?

I divide dynamic websites into two types:

The first one use e.g PHP , and let PHP concatenate a HTML page , and push back to clients;

And the second one use a HTML template , and all web interfaces provides JSON data only , feed all fields dynamically when HTML page is loaded.

What's the advantage of the former type of websites ? And what about caching ?

Upvotes: 0

Views: 282

Answers (2)

Denys Séguret
Denys Séguret

Reputation: 382092

PHP based sites are easier to make, easier to cache, and better indexed, but much less rich.

Ajax based sites are more dynamic, feel faster if well made as you may receive many small data asynchronously to update what needs to be updated. When they grow, they require more discipline and competence from the coders. The key to make them is really understand the base technologies.

To those categories, I'll add the cases (the ones I use) where the server isn't in a pure passive technology like PHP but support background threads and complex computation. You can use java or Go for example for those sites. It's even more convenient for ajax based sites using websockets to push data from the server to the client.

Contrary to LAMP, Ajax applications don't come in one flavor you just have to implement. You have to choose your tools according to your precise needs (for example for minification, storages, and so on), On the client side, Ajax based sites can be made with "raw" technologies (html+js), I personnaly don't like to use big frameworks, but you'll find that jquery helps make the code cleaner.

Upvotes: 2

Vincenzo Maggio
Vincenzo Maggio

Reputation: 3869

I think the former kind of websites is more useful when your requirements are small because dinamic html with no proper templating could lead to a mess of spaghetti code, but it's surely more agile in prototyping phase and they don't need JS, just a plugin on the web server.

Nonetheless the Ajax (and RIA sites in general) are more dynamic and surely they now are going to have the upper hand in enterprise web development. They are more difficult to start with 'cause many time you have more frameworks and dependencies, but in the long term using common formats (JSON), standard libraries and so on gives a real advantage in terms of manteinance and feature growth.

About caching, I think that rich dynamic sites when organized in a clealy way can also improve caching, because you can use for example a JSON structure to implement the request to the server and a key-value cache to retrieve the already generated HTML file.

Upvotes: 0

Related Questions