Inhaltsverzeichnis

Alle Kapitel aufklappen
Alle Kapitel zuklappen
Preface
17
Design Pattern Categories
19
How to Learn
20
Pattern-Based Learning
20
Category-Based Learning
21
Quick and Dirty Learning
23
Ad-Hoc Learning
23
PART I Architectural Design Patterns
25
1 MVC
27
1.1 Case Study: Read, Process, Display, and Post
28
1.2 Passing Select Options
33
1.3 Distributing Application Logic
34
1.4 Related Patterns
34
1.5 Summary
35
PART II Creational Design Patterns
37
2 Abstract Factory
39
2.1 Case Study: Log Analysis
40
2.2 Related Patterns
47
2.3 Summary
47
3 Builder
49
3.1 Case Study: Jobs for Text Files
49
3.2 When to Use
66
3.3 Privacy
66
3.4 Summary
67
4 Factory
69
4.1 Case Study: FI Documents for Parties
69
4.2 Advantages
75
4.3 Related Patterns
75
4.4 Summary
76
5 Lazy Initialization
77
5.1 Case Study: Logging Errors
77
5.2 Advantages
81
5.3 Related Patterns
81
5.4 Summary
82
6 Multiton
83
6.1 Case Study: Vendor Balance
84
6.2 When to Use
88
6.3 When to Avoid
88
6.4 State Modification
89
6.5 Summary
89
7 Prototype
91
7.1 Case Study: Item Clone
91
7.2 Changing Class Properties
95
7.3 Clone Operations
96
7.4 Related Patterns
96
7.5 Summary
97
8 Singleton
99
8.1 Case Study: Subcomponents
99
8.2 Advantages and Disadvantages
106
8.3 Related Patterns
106
8.4 Summary
106
PART III Structural Design Patterns
107
9 Adapter
109
9.1 Case Study: Project Management Tools
109
9.2 Glue Code
118
9.3 Two-Way Adapters
118
9.4 Legacy Classes
122
9.5 Summary
122
10 Bridge
123
10.1 Case Study: Messaging Framework
123
10.2 Advantages
131
10.3 Summary
131
11 Composite
133
11.1 Recursive Programming: A Refresher
133
11.2 Case Study: HR Positions
137
11.3 Advantages
144
11.4 Disadvantages
144
11.5 When to Use
145
11.6 Related Patterns
145
11.7 Summary
146
12 Data Access Object
147
12.1 Case Study: Potential Customers
147
12.2 Redundant Code Prevention
152
12.3 Related Patterns
153
12.4 Summary
153
13 Decorator
155
13.1 Case Study: User Exit
155
13.2 Advantages and Challenges
161
13.3 Related Patterns
162
13.4 Summary
162
14 Façade
165
14.1 Case Study: Bonus Calculation
166
14.2 When and Where to Use
168
14.3 Related Patterns
170
14.4 Summary
170
15 Flyweight
171
15.1 Case Study: Negative Stock Forecast
171
15.2 Disadvantages
181
15.3 When to Use
181
15.4 Related Patterns
182
15.5 Summary
182
16 Property Container
185
16.1 Case Study: Enhancing an SAP Program
185
16.2 Static vs. Instance Containers
194
16.3 Sharing Variables
195
16.4 Variable Uniqueness
196
16.5 Related Patterns
196
16.6 Summary
198
17 Proxy
199
17.1 Case Study: Sensitive Salary Information
199
17.2 When to Use
206
17.3 Related Patterns
207
17.4 Summary
207
18 Chain of Responsibility
209
18.1 Case Study: Purchase Order Approver Determination
209
18.2 Risks
217
18.3 Related Patterns
217
18.4 Summary
218
PART IV Behavioral Design Patterns
219
19 Command
221
19.1 Case Study: SD Documents
221
19.2 When to Use or Avoid
229
19.3 Related Patterns
229
19.4 Summary
230
20 Mediator
231
20.1 Case Study: Stock Movement Simulation
232
20.2 When to Use
241
20.3 Disadvantages
241
20.4 Summary
241
21 Memento
243
21.1 Case Study: Budget Planning
243
21.2 Risks
252
21.3 Redo
253
21.4 Summary
254
22 Observer
255
22.1 Case Study: Target Sales Values
256
22.2 Advantages
261
22.3 Disadvantages
261
22.4 Multiple Subjects
262
22.5 Related Patterns
263
22.6 Summary
264
23 Servant
265
23.1 Case Study: Address Builder
266
23.2 Extensions
274
23.3 Related Patterns
275
23.4 Summary
275
24 State
277
24.1 Case Study: Authorization-Based Class Behavior
277
24.2 Advantages
283
24.3 Related Patterns
284
24.4 Summary
284
25 Strategy
285
25.1 Case Study: Sending Material Master Data
286
25.2 Advantages
291
25.3 Passing Data to the Strategy Object
291
25.4 Optional Strategies
293
25.5 Intermediate Abstract Classes
297
25.6 Related Patterns
302
25.7 Summary
302
26 Template Method
305
26.1 Case Study: Average Transaction Volume
306
26.2 When to Use
318
26.3 Advantages and Risks
319
26.4 Degree of Abstraction
320
26.5 The “Hollywood Principle”
320
26.6 Summary
321
27 Visitor
323
27.1 Case Study: Incoming Invoice Processing
323
27.2 When to Use
333
27.3 Related Patterns
334
27.4 Summary
335
Appendices
337
A Object-Oriented Programming
339
A.1 Object-Oriented ABAP Development Environment
339
A.2 Class
341
A.3 Superclass
343
A.4 Abstract Class
345
A.5 Interface
351
A.6 UML
355
A.7 Summary
359
B Subclass Determination
361
B.1 Hardcoding
361
B.2 Convention over Configuration
361
B.3 SAP Class Tables
363
B.4 Custom Table
368
C Principles
371
C.1 Object-Oriented Principles
371
C.2 Design Principles
373
C.3 Anti-Patterns
375
D The Author
383
Index
385