Book Image

Hands-On Design Patterns with Delphi

By : Primož Gabrijelčič
Book Image

Hands-On Design Patterns with Delphi

By: Primož Gabrijelčič

Overview of this book

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.
Table of Contents (18 chapters)
Title Page
Copyright and Credits
About Packt

Marker interface

The marker interface pattern has its origin in the Java world. It is used to provide metadata capabilities in a language that doesn't have explicit support for that. The marker interface concept was largely replaced with the use of attributes or a similar code annotation tool in modern languages.

In programming, metadata provides a way of adding code-describing tags to the program. Unlike normal data variables and fields, which store information required to run the program and to process user data, metadata provides data about classes (and variables and fields) themselves.


Metadata is a label attached to a product. It is a note on a car dashboard saying, "Change oil at150.000 km," or a message on a sandwich in a communal kitchen stating, "This belongs to me!"

A marker interface pattern provides a way of adding metadata descriptions to a class without changing its layout. For example, let's say that we have a customer information class, such as TCustomer, from the project...