Java Reference
In-Depth Information
Table A.1
Cross-reference of antipatterns by name (continued)
Name
Description
Solution
Symptoms
Location
12. Lapsed
Listeners
Leak
The publish/subscribe design pat-
tern requires applications or
classes with an interest in an
event to register. The Lapsed Lis-
tener is one form of memory leak
where an event listener is regis-
tered without being removed. If the
life cycle of the listener registry is
long, then a memory leak will
occur.
Weak refer-
ences, or pairing
register with
remove .
Some objects are
not garbage-col-
lected, causing
the system to
slow over time,
until the app is
terminated or
eventually dies.
Chapter 6,
Section 6.3
13. Leak
Collection
If a collection has a long life cycle,
it can have long-lived references
that are never removed. These will
prevent large blocks of memory
from being freed.
Weak refer-
ences, or pairing
add with
remove .
Some objects are
not garbage-col-
lected, causing
the system to
slow over time,
until the app is
terminated or
eventually dies.
Chapter 6,
Section 6.4
14. Magic Servlet
The Magic Servlet is a Java servlet
that does all of the work itself. The
servlet has elements of model,
view, and controller. Servlets cre-
ated in this form should be
approached with extreme preju-
dice: they are simply evil.
Model 2, the Tri-
angle, Model-
View-Controller
Poor readability,
rippling impact of
minor changes
Chapter 3,
all sections
15. Monolithic
JSPs
Like the Magic Servlet, the mono-
lithic JSPs show a complete
absence of any trace of model-
view-controller separation. In this
case, all of the code is in a tag
language.
Model 2, the Tri-
angle, Model-
View-Controller
Poor readability,
rippling impact of
minor changes
Chapter 4
Section 4.2
Search WWH ::




Custom Search