@@ -25,10 +25,12 @@ some concepts that are common to all good code organization patterns.
2525- Despite jQuery's DOM-centric nature, JavaScript applications are not all
2626 about the DOM. Remember that not all pieces of functionality need to — or
2727 should — have a DOM representation.
28- - Units of functionality should be loosely coupled — a unit of functionality
29- should be able to exist on its own, and communication between units should be
30- handled via a messaging system such as custom events or pub/sub. Stay away
31- from direct communication between units of functionality whenever possible.
28+ - Units of functionality should be [ loosely
29+ coupled] ( http://en.wikipedia.org/wiki/Loose_coupling ) -- a unit of
30+ functionality should be able to exist on its own, and communication between
31+ units should be handled via a messaging system such as custom events or
32+ pub/sub. Stay away from direct communication between units of functionality
33+ whenever possible.
3234
3335The concept of loose coupling can be especially troublesome to developers
3436making their first foray into complex applications, so be mindful of this as
@@ -177,16 +179,13 @@ object literal would likely be overkill. Assuming it's not the extent of our
177179application, though, we've gained several things:
178180
179181- We've broken our feature up into tiny methods. In the future, if we want to
180- change how content is shown, it's clear where to change it. In the original
181- code, this step is much harder to locate.
182-
182+ change how content is shown, it's clear where to change it. In the original
183+ code, this step is much harder to locate.
183184- We've eliminated the use of anonymous functions.
184-
185- - We've moved configuration options out of the body of the code and put them in a
186- central location.
187-
185+ - We've moved configuration options out of the body of the code and put them in
186+ a central location.
188187- We've eliminated the constraints of the chain, making the code easier to
189- refactor, remix, and rearrange.
188+ refactor, remix, and rearrange.
190189
191190For non-trivial features, object literals are a clear improvement over a long
192191stretch of code stuffed in a $(document).ready() block, as they get us thinking
0 commit comments