Hacker News new | ask | show | jobs
Are javascript frameworks suitable for content websites
1 points by bladedev 4799 days ago
MV* JavaScript frameworks are the latest craze in website development but are they really more suited to app development rather than content heavy websites such as bbc.co.uk or guardian.co.uk? Is that approach plain wrong for that type of project, if so which approach is better suited?
3 comments

It depends on what you're trying to do. The server-side breaks down into MVC readily: you have a database or set of files or some more exotic data store as a model, the HTML/CSS/JS/whatever that gets sent to the client as a view, and your middleware as the controller.

When you do this, then by the time you get to the browser, you're already working in the view. But does it make sense to break the view down into its own model, view, and controller? If you're dealing with a page as a monolithic blob of text, then probably not, and there are cases where it makes sense to do that.

But not all content can be treated as monolithic blobs of text. You mention journalism, but it is not at all uncommon in journalism to have to present some form of raw data to the user -charts, tables, and such- even if that data is just a summary of some other data. MVC is well-suited to that task, perhaps as a series of data presentation widgets within the site. But even blobs of text are not always monolithic. One example that comes readily to mind is also pertinent to news sites: comments. If you need to manipulate comments on a page, then that's another case where MVC could come in handy.

The bottom line is that it depends on what you want to do to the site. Monolithic blobs of text don't require MVC, if that's really all you're handling, but is that all you're handling? Maybe, but maybe not.

I think that is exactly it, content heavy websites are no longer just pulling blobs of text out of the database and dumping them on a static page. Even traditional content websites are becoming 'applications'. The lines are blurring and therefore choosing the right tool for the job becomes more challenging.
I think you might be asking a question that is not relevant to the subject matter. IMHO the answer to your question is yes, because the technologies can be used to create content heavy sites. What is also needed however, is some form of content creation/management system which can be created with a JavaScript framework as a component. So yes, you can, but it won't be quite that simple.

For example, sammy.js can be used for navigation, and knockout.js for data binding, but this sort of system would need to be carefully thought out and structured. There are many content management features that would need to be added that wouldn't come from the class of frameworks that I mentioned. Hopefully this answer is helpful and I would be glad to answer any further questions.

I'm not sure what you mean by "I think you might be asking a question that is not relevant to the subject matter", could you clarify?
I actually use Backbone.js for content websites. Not because I'm doing a ton of ajax or passing data back and forth, I just find that Backbone helps me keep things more organized.

I'd rather set up a Backbone view for the entire page, register my event handlers, and do all the callbacks and stuff from there than end up with a big soup of javascript.

Of course, when I'm doing these content websites, I rarely use models, collections, templates, or the router.