Skip to content

Commit 46e461c

Browse files
author
Rebecca Murphey
committed
cleanup, adding missing link
1 parent b38da66 commit 46e461c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

content/code-organization/concepts.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

3335
The concept of loose coupling can be especially troublesome to developers
3436
making 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
177179
application, 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

191190
For non-trivial features, object literals are a clear improvement over a long
192191
stretch of code stuffed in a $(document).ready() block, as they get us thinking

0 commit comments

Comments
 (0)