售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright and Credits
Hands-On Design Patterns with Delphi
About Packt
Why subscribe?
Packt.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Section 1: Design Pattern Essentials
Introduction to patterns
Patterns in programming
Patterns are useful
Delphi idioms – Creating and destroying an object
Gang of Four started it all
Don't inherit – compose!
Pattern taxonomy
Creational patterns
Structural patterns
Behavioral patterns
Concurrency patterns
Criticism
Anti-patterns
Design principles
SOLID
Don't repeat yourself
KISS and YAGNI
Summary
Section 2: Creational Patterns
Singleton, Dependency Injection, Lazy Initialization, and Object Pool
Singleton
NewInstance
Lateral thinking
Dependency injection
From classes to interfaces
Using a factory method
Wrapping up
Lazy initialization
Using Spring
Object pool
Stock quote connection pool
Summary
Factory Method, Abstract Factory, Prototype, and Builder
Factory method
Painter
Modernizing the factory method pattern
Abstract factory
Prototype
Cloning records
Cloning objects
Delphi idioms – Assign and AssignTo
Serialization
Builder
Idioms – Fluent interfaces
Summary
Section 3: Structural Patterns
Composite, Flyweight, Marker Interface, and Bridge
Composite
Child management
Flyweight
String interning
A practical example
Delphi idioms – comparers and hashers
Marker interface
Delphi idioms – attributes
Markers and attributes
Bridge
Bridged painting
Summary
Adapter, Proxy, Decorator, and Facade
Selecting an appropriate structural pattern
Adapter
Wrapping a class
Wrapping an interface
Implementing a queue with a list
Proxy
Delphi idioms – replacing components in runtime
Smart pointers
Unit testing with mock objects
Decorator
Decorating streams
Delphi idioms – helpers
Facade
Summary
Section 4: Behavioral Patterns
Nullable Value, Template Method, Command, and State
Null object
Template method
Calculating the average value
Inversion of control
Command
Command-based editor
Creating commands
Commands
Invoker
Client
Macros
Cloning
State
Unquoting a string
Summary
Iterator, Visitor, Observer, and Memento
Iterator
Delphi idioms – iterating with for..in
Implementing custom enumerators
Using an iterator interface
Visitor
Observer
Observing with Spring
Memento
Summary
Section 5: Concurrency Patterns
Locking patterns
Delphi idioms – parallel programming
Lock
Custom locking mechanism
Lock striping
Single bit locks
Delphi idioms – bitwise operators
Double-checked locking
Optimistic locking
Readers-writer lock
Comparing reader-writer implementations
Summary
Thread pool, Messaging, Future and Pipeline
Thread pool
Idiosyncrasies of Delphi's TThreadPool
Messaging
Windows messages
Queue and Synchronize
Polling
Future
Pipeline
Web spider
Filter stage
Downloader stage
Parser stage
Summary
Section 6: Miscellaneous Patterns
Designing Delphi Programs
Event-driven programming
Actions
LiveBindings
Form inheritance
Frames
Data modules
Summary
Other Kinds of Patterns
Exceptions
Reserving exceptions for abnormal conditions
Name the problem, not the thrower
Don't raise exceptions in destructors
Exceptions should not cross API boundaries
Exceptions should not cross thread boundaries
Catching exceptions selectively
Don't ignore exceptions
Using an exception logger
Simplifying try..finally
Debugging
Functional programming
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜