Bitter Java.pdf
(
3969 KB
)
Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Bitter Java
BRUCE TATE
MANNING
Greenwich
(74° w. long.)
For Maggie
For electronic information and ordering of this and other Manning books,
go to www.manning.com. The publisher offers discounts on this book
when ordered in quantity. For more information, please contact:
Special Sales Department
Manning Publications Co.
209 Bruce Park Avenue
Fax: (203) 661-9018
Greenwich, CT 06830
email: orders@manning.com
©2002 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by means electronic, mechanical, photocopying, or otherwise, without
prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial
caps or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books they publish printed on acid-free paper, and we exert our best efforts to that end.
Manning Publications Co.
Copyeditor: Liz Welch
209 Bruce Park Avenue
Typesetter: Tony Roberts
Greenwich, CT 06830
Cover designer: Leslie Haimes
ISBN 1-930110-43-X
Printed in the United States of America
12345678910– VHG – 05 04 03 02
contents
foreword xv
preface xvii
acknowledgments xxi
about this book xxiii
about the cover illustration
xxvii
P
ART
1T
HE
BASICS
..................................................
1
1
Bitter tales
3
1.1
A Java development free fall
4
Antipatterns in life
6
1.2
Using design patterns accentuates the positive
7
Design patterns online 8
UML provides a language for patterns
9
1.3
Antipatterns teach from the negative
9
Some well-known antipatterns
10
Antipatterns in
practice
11
Antipattern resources
12
1.4
Antipattern ideas are not new
13
Learning from the industry
14
Detective work
15
Refactoring antipatterns
17
v
vi
CONTENTS
1.5
Why Bitter Java?
17
The Bitter Java approach
18
Bitter Java tools
18
The Bitter Java organization
19
The Bitter Java
audience 21
1.6 Looking ahead
21
2
The bitter landscape
23
2.1
Fertile grounds for antipatterns
24
The benefits of layering 24
Layering can work against us
26
2.2
Internet technologies
28
Internet topologies affect our applications
28
Enterprise layers add security and overhead
29
Standards enable the Internet and add layers
31
TCP and IP provide low-level communications
32
HTTP provides application-level transport
33
HTML and XML 34
Mini-antipattern: Too Many Web Page Items
35
2.3
Object technologies and antipatterns
37
Encapsulation helps to isolate change 38
Inheritance
enables packaging of common behavior
38
Polymorphism enables flexible reuse 39
Mini-antipatterns: Excessive Layering
39
Setting the stage for Java
42
2.4
Java technologies solve antipatterns
42
2.5
Major problems with the waterfall
44
Iterative methodologies 45
Mini-antipatterns: Incomplete Process Transitions
45
Programming horizons: Extreme programming
46
2.6
A quick survey of the bitter landscape
48
2.7
Antipatterns in this chapter
48
vii
CONTENTS
P
ART
2S
ERVER
-
SIDE
J
AVA
ANTIPATTERNS
...........
51
3
Bitter servlets
53
3.1
Getting off on the wrong foot
54
An early antipattern: The Magic Pushbutton
54
Building with Model-View-Controller
56
Failing to
separate model and view
56
Breaking out
the model
58
3.2
Antipattern: The Magic Servlet
59
Can we use servlets as the model?
60
Stumbling into
the Magic Servlet trap
62
Causes of the Magic
Servlet
66
3.3
Solution: Refactor using commands
67
Break out the model
67
Wrapping the model with
command objects
68
Separating the model logic
69
Separating the return trip
74
Using a JSP for the
return trip
77
3.4
Summary
79
3.5
Antipattern in this chapter
79
4
Bitter JSPs
81
4.1
Getting only halfway home
82
Recognizing the danger signs
82
4.2
Antipattern: Monolithic JSPs
84
This program lacks model-view separation 84
Solution: Refactor to Model-View-Controller
86
4.3
Antipattern: Compound JSPs
88
Should we combine multiple JSPs? 88
An example
combining two interfaces 89
Solution: Split
the JSP 94
Making decisions in the
controller servlet
94
Plik z chomika:
LukasChomik29
Inne pliki z tego folderu:
Java Reference Library 1.3(1).pdf
(21592 KB)
Java Distributed Computing(1).pdf
(1128 KB)
Java Enterprise In a Nutshell(1).pdf
(2601 KB)
Java Management Extensions(1).pdf
(2762 KB)
Java NIO(1).pdf
(3005 KB)
Inne foldery tego chomika:
ActionScript
Active Directory
Apache
ASP
BSD
Zgłoś jeśli
naruszono regulamin