
Hands-On Design Patterns with Delphi
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
Get up to speed with creational, structural, behavioral and concurrent patterns in Delphi to write clear, concise and effective code
Key Features
- Delve into the core patterns and components of Delphi in order to master your application's design
- Brush up on tricks, techniques, and best practices to solve common design and architectural challenges
- Choose the right patterns to improve your program's efficiency and productivity
Book Description
Design patterns have proven to be the go-to solution for many common programming scenarios. This book focuses on design patterns applied to the Delphi language. The book will provide you with insights into the language and its capabilities of a runtime library.
You'll start by exploring a variety of design patterns and understanding them through real-world examples. This will entail a short explanation of the concept of design patterns and the original set of the 'Gang of Four' patterns, which will help you in structuring your designs efficiently. Next, you'll cover the most important 'anti-patterns' (essentially bad software development practices) to aid you in steering clear of problems during programming. You'll then learn about the eight most important patterns for each creational, structural, and behavioral type. After this, you'll be introduced to the concept of 'concurrency' patterns, which are design patterns specifically related to multithreading and parallel computation. These will enable you to develop and improve an interface between items and harmonize shared memories within threads. Toward the concluding chapters, you'll explore design patterns specific to program design and other categories of patterns that do not fall under the 'design' umbrella.
By the end of this book, you'll be able to address common design problems encountered while developing applications and feel confident while building scalable projects.
What you will learn
- Gain insights into the concept of design patterns
- Study modern programming techniques with Delphi
- Keep up to date with the latest additions and program design techniques in Delphi
- Get to grips with various modern multithreading approaches
- Discover creational, structural, behavioral, and concurrent patterns
- Determine how to break a design problem down into its component parts
Who this book is for
Hands-On Design Patterns with Delphi is aimed at beginner-level Delphi developers who want to build scalable and robust applications. Basic knowledge of Delphi is a must.
More details
Other editions
Additional editions

Content
- Cover
- Title Page
- Copyright and Credits
- About Packt
- Contributors
- Table of Contents
- Preface
- Section 1: Design Pattern Essentials
- Chapter 1: 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
- Chapter 2: 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
- Chapter 3: 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
- Chapter 4: 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
- Chapter 5: 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
- Chapter 6: 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
- Chapter 7: 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
- Chapter 8: 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
- Chapter 9: 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
- Chapter 10: Designing Delphi Programs
- Event-driven programming
- Actions
- LiveBindings
- Form inheritance
- Frames
- Data modules
- Summary
- Chapter 11: 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
- Index
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.