Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript: How to make sense of all the frameworks and design philosophies?
    primarykey
    data
    text
    <p>I have been a user of <a href="http://jquery.com/">jQuery</a> (and some of its minor plugins) for a while. The Javascript code I've developed over the years could be described best as... messy. It used a ton of global variables and functions here and there, didn't use standard ways of organizing the code, nor any design patterns whatsoever.</p> <p>I am currently building the new version of a website, and I have completed doing the backend with <a href="http://pear.php.net/package/MDB2/redirected">PEAR::MDB2</a> and <a href="http://www.smarty.net/">Smarty</a> templates. The rest is just homebrew PHP with some classes.</p> <p>Now I am at the point where I'll add the Javascript layer on top of the website to improve the user-friendliness of some features. (while making sure everything degrades gracefully) I want to write better, cleaner, more organized Javascript than I used to, so I did a little research. I read Stefanov's <a href="http://rads.stackoverflow.com/amzn/click/1847194141">Object-Oriented Javascript</a> to have a better grasp on some concepts I knew only loosely about (prototypes, constructors, etc.) as well. Now I'm stuck at a point where I wonder which Javascript frameworks I should use, and how to organize it all. </p> <p>After conducting my research, I understood <a href="http://cappuccino.org/">Cappuccino &amp; Objective-J</a>, and <a href="http://www.sproutcore.com/">Sproutcore</a> were not what I was looking for. To quote Cappucino's about page: </p> <blockquote> <p>Cappuccino is not designed for building web sites, or making existing sites more "dynamic". We think these goals are too far removed from those of application development to be served well by a single framework. Projects like Prototype and jQuery are excellent at those tasks</p> </blockquote> <p>So there's that. Then I found out about <a href="http://jashkenas.github.com/coffee-script/">Coffee Script</a>, which is more of a one-to-one "compiler" and wouldn't help me with the actual organization of my code. </p> <p>I also stumbled on some articles that give guidelines:</p> <ul> <li><a href="http://alexsexton.com/?p=51">Using Inheritance Patterns to Organize Large jQuery Applications</a></li> <li><a href="http://yuiblog.com/blog/2007/06/12/module-pattern/">A JavaScript Module Pattern</a></li> </ul> <p>I also found out about <a href="http://documentcloud.github.com/backbone/">Backbone.js</a>, <a href="http://a-laughlin.com/">Shoestring</a>, <a href="http://www.javascriptmvc.com">JavaScriptMVC</a>, <a href="http://code.google.com/apis/loader/">Google Loader</a>, <a href="http://flowplayer.org/tools/">jQuery Tools</a>, <a href="http://jqueryui.com/">jQuery UI</a>. I don't really know what to do of all this... The things I know:</p> <ul> <li>I don't want to invest too much time in learning something too complex, I want to keep things simple and flexible as much as possible (that is why I don't use <a href="http://symfony.com/">Symfony</a> on the backend, for example), yet clean and organized.</li> <li>I want to use jQuery, the question is, what should I use with it? (that is compatible too)</li> </ul> <p>Right now, I'd use jQuery and jQuery Tools and "organize" all that in a simple namespace/object literal with simple properties and methods and also, since the site is localized, I just plan on using the simple <a href="http://phpjs.org/functions/vsprintf:580">vsprintf</a> (as I do on the backend) with key:value pairs loaded from an object literal provided by the backend. JavaScriptMVC seems interesting, but I fear it would bring way too much complexity for a project that is fairly small sized. That is where I need your advice! Thank you very much in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload