Kernel's Base library like jQuery.

51 views
Skip to first unread message

Greg Baker

unread,
May 8, 2013, 3:47:27 PM5/8/13
to kern...@googlegroups.com
A quick question on the structure Kernel. My understanding is that the modules are "insulated" from any base library or framework by the hub acting as an interface to the core's API.  That the only the core is aware of the underlying libraries, frameworks, addins ... etc.  This makes sense for upgrades and changes that do not "break" the application.

In the Kernel examples I see the jQuery's '$' used directly.  Am I missing something specific to Kernel that makes this mute: like exposing core.base as widow.$ or such. Or is jQuery simply 'required' for Kernel.  

I like the simplicity and clean architecture of Kernel as compared to some others implementations.  But the $ seems out of place to my understanding.  Your comments could help.

Thanks.
greg

alan lindsay

unread,
May 8, 2013, 4:01:56 PM5/8/13
to kern...@googlegroups.com
Greg,

Abstracting the base library is an optional part of the design. I'll leave it up to you to decide if it makes sense for your application. In my case I've elected not to abstract the base library and I use jQuery, underscore, etc. directly in core, the hub and modules. The problem with this is a dependency is created between my app and the base libraries I am using. The advantage is that I don't have to invest in abstractions that I may not need. You'll need to weigh the cost of abstracting the base library, which can be quite high depending on the complexity of widgets your app uses, against the benefit of being able to swap out that base library at any given time. Because the projects I work on are ok with a commitment to jQuery this abstraction represented a much larger cost than benefit.

There is no one right way to go about it, but yes, abstracting the base library is the most flexible approach. If flexibility for switching base libraries is a requirement for your application then you should abstract them.

Alan



greg

--
You received this message because you are subscribed to the Google Groups "Kernel.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kerneljs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Greg Baker

unread,
May 8, 2013, 5:18:27 PM5/8/13
to kern...@googlegroups.com
Thank you for your quick and simple reply.  Yes.  A trade-off for sure; I read much on this subject and agree with your approach when committed to a single base such as jQuery as you have explain.  I appreciate you time.

Thank you.
greg
Reply all
Reply to author
Forward
0 new messages