It might be a little silly of me to say so, but I have experience with my 
approach. 

You’re not too far off with your assessment. One minor point of clarification: 
it’s the Core that acts as a pubsub manager (really the Mediator pattern) and 
the sandbox is just an abstraction to keep the modules from directly touching 
the Core.

I take it from your comments that you’ve seen the slides but not the video, 
which is here:
http://developer.yahoo.com/yui/theater/video.php?v=zakas-architecture

In it, I mention the issue of JS libraries. I’ll repeat what I said there: if 
you’re comfortable betting your application on a single JS library, then go 
ahead and let it leak through the abstraction. For instance at Yahoo, we know 
we’re going to use YUI, so it’s okay for the modules to access YUI directly. If 
I were working for another company, I might choose to abstract away some common 
pieces just in case I decided to swap JS libraries. The main goal is, of 
course, so you never have to rewrite the modules regardless of what changes 
occur in the rest of the stack. But once again, if you are comfortable tying 
your application to jQuery, then by all means, use it directly in the modules.

I kick off JS execution as soon as my modules are loaded. That might occur 
before DOMContentLoaded, before load, or after load, depending on how the 
resources are being loaded. The important thing is that the order of module 
initialization shouldn’t matter (that’s the purpose of loose coupling). You 
should, in theory, be able to start one module now and one two minutes from 
now, and have nothing of consequence occur. 

I’ve used this on two major projects (My Yahoo! and the Yahoo! homepage), so 
I’m fairly comfortable recommending it for any single-page site. I’ve not tried 
it on a multi-page site, so I can’t really speak to that.

-Nicholas

_____________________________________________________
Nicholas C. Zakas
Twitter: @slicknet
Blog: http://www.nczonline.net/





From: James Morrin 
Sent: Thursday, January 27, 2011 10:00 AM
To: [email protected] 
Subject: [JSMentors] Re: Javascript Architecture for Large Sites

This is a great site too.  

http://enterprisejquery.com/



-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/
 
To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/
 
To unsubscribe from this group, send email to
[email protected]

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

<<wlEmoticon-smile[1].png>>

Reply via email to