Bitter Java

個数:

Bitter Java

  • 提携先の海外書籍取次会社に在庫がございます。通常2週間で発送いたします。
    重要ご説明事項
    1. 納期遅延や、ご入手不能となる場合が若干ございます。
    2. 複数冊ご注文の場合、分割発送となる場合がございます。
    3. 美品のご指定は承りかねます。
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 339 p.
  • 言語 ENG,ENG
  • 商品コード 9781930110434
  • DDC分類 005.133

Full Description


Bitter Java is a book about common Java programming traps (called anti-patterns), their causes and resolutions. Anti-patterns for server side Java programming and architecture are the focus. It is intended for intermediate Java programmers, analysts and architects. The book covers anti-patterns for J2EE concepts such as servlets, JSPs, EJBs, enterprise connection models, and scalability. There is a popular movement to capture positive design patterns, and an extensive library of design pattern books. Negative designs, sometimes called anti-patterns, are harder to find, but illustrate good programming practices much more graphically than design patterns. Anti-patterns have another benefit: they are fun. Bitter Java will explore some basic anti-patterns and introduce intermediate to advanced techniques in clear and entertaining language. The book will feature code samples sprinkled throughout the book, and real-life metaphors that are unrelated to programming. The examples are refactored into solutions that work, and are available on a web site for immediate download and use.

Table of Contents

foreword                                           xv
preface xvii
acknowledgments xxi
about this book xxiii
about the cover illustration xxvii
Part 1 The Basics 1 (50)
Bitter tales 3 (20)
A Java development free fall 4 (3)
Antipatterns in life 6 (1)
Using design patterns accentuates the 7 (2)
positive
Design patterns online 8 (1)
UML provides a language for patterns 9 (1)
Antipatterns teach from the negative 9 (4)
Some well-known antipatterns 10 (1)
Antipatterns in practice 11 (1)
Antipatterns resources 12 (1)
Antipattern ideas are not new 13 (4)
Learning from the industry 14 (1)
Detective work 15 (2)
Refactoring antipatterns 17 (1)
Why Bitter Java? 17 (4)
The Bitter Java approach 18 (1)
Bitter Java tools 18 (1)
The Bitter Java organization 19 (2)
The Bitter Java audience 21 (1)
Looking ahead 21 (2)
The bitter landscape 23 (28)
Fertile grounds for antipatterns 24 (4)
The benefits of layering 24 (2)
Layering can work against us 26 (2)
Internet technologies 28 (9)
Internet topologies affect our 28 (1)
applications
Enterprise layers add security and 29 (2)
overhead
Standards enable the Internet and add 31 (1)
layers
TCP and IP provide low-level 32 (1)
communications
HTTP provides application-level transport 33 (1)
HTML and XML 34 (1)
Mini-antipattern: Too Many Web Page Items 35 (2)
Object technologies and antipatterns 37 (5)
Encapsulation helps to isolate change 38 (1)
Inheritance enables packaging of common 38 (1)
behavior
Polymorphism enables flexible reuse 39 (1)
Mini-antipatterns: Excessive Layering 39 (3)
Setting the stage for Java 42 (1)
Java technologies solve antipatterns 42 (2)
Major problems with the waterfall 44 (4)
Iterative methodologies 45 (1)
Mini-antipatterns: Incomplete Process 45 (1)
Transitions
Programming horizons: Extreme programming 46 (2)
A quick survey of the bitter landscape 48 (1)
Antipatterns in this chapter 48 (3)
Part 2 Server-Side Java Antipatterns 51 (198)
Bitter servlets 53 (28)
Getting off on the wrong foot 54 (5)
An early antipattern: The Magic Pushbutton 54 (2)
Building with Model-View-Controller 56 (1)
Failing to separate model and view 56 (2)
Breaking out the model 58 (1)
Antipattern: The Magic Servlet 59 (8)
Can we use servlets as the model? 60 (2)
Stumbling into the Magic Servlet trap 62 (4)
Causes of the Magic Servlet 66 (1)
Solution: Refactor using commands 67 (12)
Break out the model 67 (1)
Wrapping the model with command objects 68 (1)
Separating the model logic 69 (5)
Separating the return trip 74 (3)
Using a JSP for the return trip 77 (2)
Summary 79 (1)
Antipattern in this chapter 79 (2)
Bitter JSPs 81 (26)
Getting only halfway home 82 (2)
Recognizing the danger signs 82 (2)
Antipattern: Monolithic JSPs 84 (4)
This program lacks model-view separation 84 (2)
Solution: Refactor to 86 (2)
Model-View-Controller
Antipattern: Compound JSPs 88 (10)
Should we combine multiple JSPs? 88 (1)
An example combining two interfaces 89 (5)
Solution: Split the JSP 94 (1)
Making decisions in the controller servlet 94 (4)
Mini-antipatterns: Coarse and Fine Commands 98 (4)
Too many commands in a group 99 (1)
Solution: Refactor to appropriate 99 (2)
granularity
Tips for granularity 101 (1)
Mini-antipattern: Fat Commands 102 (1)
Reviewing the JSP antipatterns 102 (1)
Antipatterns in this chapter 103 (4)
Bitter cache management 107 (36)
We need caches! 108 (1)
Antipattern: The Cacheless Cow 109 (16)
Bitter BBS with no cache 110 (2)
Building the model, view, and controller 112 (3)
for ShowBoard
Building the model, view and controller 115 (4)
for ShowThread
Building the model, view and controller 119 (6)
for AddPost
Performance problems 125 (1)
Solution: Cache 125 (10)
Solution 1: Use a hardware cache 126 (1)
Solution 2: Cache commands 126 (2)
Adding a cache to our BBS 128 (5)
Possible enhancements to cached commands 133 (2)
Cache-related mini-antipatterns 135 (1)
Concurrent access to static cache 135 (1)
The ever-growing cache 136 (1)
Antipattern: Synchronized Read/Write 136 (4)
Bottlenecks
Collisions between readers can hurt 137 (1)
performance
Read/write locks allow correct shared 138 (2)
access
Cooking the Cacheless Cow 140 (1)
Antipatterns in this chapter 140 (3)
Bitter memories 143 (28)
Understanding memory leaks and antipatterns 144 (5)
Managing memory 145 (1)
Understanding garbage collection 146 (1)
Reference counting 146 (2)
Reachable objects 148 (1)
Trading C++ for Java 149 (2)
Circumstances that cause Java memory leaks 149 (1)
Finding Java leaks 150 (1)
Antipattern: Lapsed Listeners Leak 151 (6)
Examining some dangerous practices 152 (3)
Solution 1: Explicitly remove the 155 (1)
listeners
Solution 2: Shorten the life cycle of the 155 (1)
anchor
Solution 3: Weaken the reference 156 (1)
Reference objects simplify memory 156 (1)
management
Antipattern: The Leak Collection 157 (4)
Causing trouble with caches and session 158 (1)
state
Solution 1: Search for common warning 159 (1)
signs
Solution 2: Aggressively pair adds with 160 (1)
removes
Solution 3: Use soft references for caches 160 (1)
Solution 4: Use collections with weak 161 (1)
references
Solution 5: Use finally 161 (1)
Shooting memory leaks 161 (5)
Make sure there is a leak 161 (1)
Determine that the leak should be fixed 162 (1)
Isolate the problem 163 (1)
Determine the source and fix the problem 164 (1)
Protect against the problem for the future 165 (1)
Mini-Antipatterns: Little Hogs 166 (2)
String manipulation 166 (1)
Collections 167 (1)
Inheritance chains 168 (1)
Summary 168 (1)
Antipatterns in this chapter 169 (2)
Bitter connections and coupling 171 (36)
Making connections 172 (1)
Antipattern: Connection Thrashing 172 (9)
Creating and terminating with every access 174 (1)
Solution: Reuse connections with a pool 174 (3)
Refactoring our BBS to add pooled 177 (2)
connections
Using get PooledConnection 179 (1)
Using the J2EE connector architecture 180 (1)
Antipattern: Split Cleaners 181 (4)
Exceptions can lead to Split Cleaners 183 (1)
Solution: Pair connection with cleanup, 184 (1)
in finally
Antipattern: Hardwired Connections 185 (7)
The communications buffer 186 (3)
Premature binding 189 (1)
Solution 1: Decouple with XML messages 189 (2)
Solution 2: Delay binding with web 191 (1)
services
Mini-antipatterns for XML misuse 192 (2)
XML's Golden Hammers 193 (1)
XML's bitter transitions 193 (1)
Mini-antipatterns: Rigid XML 194 (8)
Name collisions 195 (2)
Rigid constructs 197 (2)
Restrictive variable-content containers 199 (2)
XML versioning 201 (1)
Summary: Sweetening bitter connections 202 (1)
Antipatterns in this chapter 203 (4)
Bitter beans 207 (42)
A brief Enterprise JavaBeans review 208 (2)
The component-based distributed 208 (1)
architecture
Types of EJBs 209 (1)
Bitter BBS with EJBs 210 (15)
Elements of an EJB application 211 (2)
Building the remote interface 213 (2)
Creating the home interface 215 (1)
Implementing the bean class 216 (5)
Defining the primary key 221 (1)
Creating a deployment descriptor 222 (2)
Using the model 224 (1)
Antipattern: Round-tripping 225 (12)
Computing the cost of a distributed 226 (1)
deployment
Chatty interfaces 227 (1)
Solution: Group together round-trips with 228 (1)
a facade
Roots of round-tripping 229 (1)
Refactoring the BBS with a facade 230 (7)
Antipattern: Square Bean in a Round Hole 237 (5)
Mini-antipattern: Bean-Managed Joins 237 (1)
Solution: Views, mappers, bean-managed 238 (1)
joins
Mini-antipattern: Entity Beans for 238 (2)
Lightweight Functions
Mini-antipattern: Entities for Read Only 240 (1)
Mini-antipattern: Entity Beans for Write 240 (1)
but Not Read
Troublesome scrollable lists 240 (1)
Overall solution: Pick the right bean for 241 (1)
the job
Mini-antipattern: Everything Is an EJB 242 (1)
EJBs and caching 243 (1)
Implementing a cache with a facade 243 (1)
Smoothing out the bitter beans 244 (1)
Antipatterns in this chapter 245 (4)
Part 3 The Big Picture 249 (70)
Bitter hygiene 251 (32)
Why study programming hygiene? 252 (3)
Extreme programming requires good hygiene 252 (1)
Coding standards protect against 253 (2)
antipatterns
Mini-antipatterns: Unreadable code 255 (11)
Names matter 255 (1)
Standards for names 256 (4)
Braces and indentation 260 (1)
Comments 261 (3)
Tabs vs. spaces 264 (1)
Editors 265 (1)
Mini-antipatterns: Organization and 266 (3)
visibility
Mini-antipatterns: Structure 269 (4)
Basic object-oriented philosophy 270 (1)
Low-level design considerations 270 (2)
Exceptions 272 (1)
Mini-antipatterns: Leaks and performance 273 (1)
Conventions for testing 274 (2)
Building a good style guide 276 (4)
Buy, borrow, or steal? 276 (1)
A sample style guide from Contextual, Inc. 277 (3)
Summary of coding standards 280 (3)
Bitter scalability 283 (28)
Good topologies for performance 284 (5)
Layering hardware in homogeneous groups 286 (3)
Other topology variations 289 (1)
Antipattern: Performance Afterthoughts 289 (6)
Developing without performance planning 290 (1)
Some real-world examples 291 (1)
Solution: Plan for performance! 292 (3)
Antipattern: Round-tripping 295 (3)
Solution: Cache and Facade 295 (3)
Antipattern: Bad Workload Management 298 (4)
Solution: Workload Management 299 (2)
True load balancing 301 (1)
Antipattern: Chaotic Session Management 302 (2)
Solution 1: Dispatching with session 302 (1)
affinity
Solution 2: Using a distributed state 303 (1)
management service
Using custom session bean solutions 303 (1)
Using custom entity bean solutions 304 (1)
Antipattern: Thrash-tuning 304 (3)
Solution: Use sound performance 305 (2)
methodologies
Taming the performance beast 307 (1)
Antipatterns in this chapter 307 (4)
Sweet parting thoughts 311 (8)
Antipatterns help us on many levels 312 (3)
Antipatterns ignite careers 313 (1)
Understanding antipatterns improves 313 (1)
programs
Understanding antipatterns makes you a 314 (1)
better programmer
Integrating antipatterns with process 315 (2)
Next steps, last steps 317 (2)
A Cross-references of antipatterns 319 (10)
bibliography 329 (4)
index 333