0

I just got done watching an informative Box tech talk by Nicholas Zakas on a javascript architecture for web development:

https://www.youtube.com/watch?v=mKouqShWI4o&feature=youtu.be

This image, which I acquired from http://alanlindsay.me/kerneljs/index.html#nav-what , will give you an overview of the architecture:

enter image description here

However, to give you a brief summary and help you avoid mundane stuff, the Kernel is basically an Application Controller which makes up the C in the MVC.

Now I obviously have to take care of the possibility of an environment where Javascript is disabled. I was wondering if that effectively meant developing an application controller in a language such as PHP and maintaining it in parallel to the one written in Javascript along with the ensuing commands/modules? There's something smelly about that, is there a better way to do this?

1

If you have to account for browsers with JavaScript disabled, then you don't want a Web Application. Instead, you want a classic client-server web site with some JavaScript usability enhancements. Forget MVC on the client, and go with the normal GET/POST HTTP life cycle. After that, use some unobtrusive JavaScript to AJAX-ify portions of the page that just POST back to the server, which returns some HTML that JavaScript plunks into a <div>.

If business really wants something so complex in the browser it requires an MVC architecture on the front end, then you need to tell them that JavaScript is required.

If your main reason for having a server side fallback is because of accessibility concerns, check out the Accessible Rich Internet Applications Spec at the W3C. A List Apart has a recent article with a good introduction to this.

| improve this answer | |
  • I should have mentioned that I was speaking in regards to web-sites with a moderate-to-large scale. While plugging in JavaScript here and there in different views is not a bad idea for smaller projects, doing so for larger ones is setting yourself up for doom in terms of maintainability. Server Sided Code is easy to structure with an MVC + a controller pattern of your choice. The best way to complement it with structured JavaScript has me at sixes though. – SPI May 20 '14 at 7:30
  • There are many JavaScript frameworks out there: en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks and sporto.github.io/blog/2013/04/12/… – Greg Burghardt May 20 '14 at 13:16
  • Thanks for the list. From what I gather, the best way to go about this is to extend the backend to allow callbacks from a JavaScript based restful API. With a little tweaking of the configuration file that controls the back-ends application controller, I will be able to make it respond to the API calls with responses encoded in JSON. – SPI May 20 '14 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.