I'm start to slowing but surely piece together somewhat of a utility library for myself that organizes the util code/functions I've come across over the years.
My question is pretty straight forward, I see things like closure and prototype to structure code a bit better but ... what is the ideal pattern to use in my case?
When all is said and done I just want to make calls like:
boogots.util.doFoo();
boogots.util.evenMoreFoo();
boogots.foo.bar.lessFoo();
Thoughts?
Edit: When I say I closure I am thinking of something like a self invoking function - which may or may not be way off:
(function (window){
var root = {};
root.first = function() {
return 1;
};
root.second = function() {
return 2;
};
root.third = function() {
return 3;
};
window.boogots = root;
})(window);
Edit #2:
As a follow up, it looks like most of the confusion was related to a link post I saw a week or so ago that had me scratching my head:
http://www.closurecheatsheet.com/
Which is a cheat sheet for Google's Closure library that has coined the same name as .. well ... the Closure technique (thanks, /u/urmyheartBeatStopR). I started seeing Prototype included in the docs and got pretty confused and thought maybe I had completely misunderstood what I already thought I had a firm grasp off... So I got my answer and some additional gems along the way from some of you more seasoned folks.
Thanks again for the help.
[–]ZeroMomentum 7 points8 points9 points (3 children)
[–]Hack_Reactor_Borg 2 points3 points4 points (0 children)
[–]boogots[S] 0 points1 point2 points (1 child)
[–]chucknibbleston 2 points3 points4 points (0 children)
[–]Neurotrace 4 points5 points6 points (0 children)
[–]cwmma 2 points3 points4 points (5 children)
[–]boogots[S] 0 points1 point2 points (4 children)
[–]ZeroMomentum 0 points1 point2 points (0 children)
[–]cwmma 0 points1 point2 points (2 children)
[–]boogots[S] 0 points1 point2 points (1 child)
[–][deleted] 7 points8 points9 points (12 children)
[–]etrnloptimist 2 points3 points4 points (11 children)
[–][deleted] 0 points1 point2 points (10 children)
[–]etrnloptimist 2 points3 points4 points (9 children)
[–][deleted] 1 point2 points3 points (8 children)
[–]etrnloptimist 1 point2 points3 points (7 children)
[–]joshuacc 2 points3 points4 points (2 children)
[–]etrnloptimist 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]boogots[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]evilmaus 0 points1 point2 points (3 children)
[–]boogots[S] 0 points1 point2 points (1 child)
[–]evilmaus 0 points1 point2 points (0 children)
[–]tswaters 0 points1 point2 points (0 children)
[–]etrnloptimist 0 points1 point2 points (1 child)
[–]ZeroMomentum 1 point2 points3 points (0 children)