Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Hands-On Design Patterns with Delphi
  • Toc
  • feedback
Hands-On Design Patterns with Delphi

Hands-On Design Patterns with Delphi

By : Primož Gabrijelčič
5 (1)
close
Hands-On Design Patterns with Delphi

Hands-On Design Patterns with Delphi

5 (1)
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 (19 chapters)
close
Free Chapter
1
Section 1: Design Pattern Essentials
3
Section 2: Creational Patterns
6
Section 3: Structural Patterns
9
Section 4: Behavioral Patterns
12
Section 5: Concurrency Patterns
15
Section 6: Miscellaneous Patterns

Preface

Design patterns - my friend and enemy!

I learned about design patterns in the formative phase of my life as a programmer. (Yes, that was long ago. I don't even remember, how long ago.) Since then, I've always been a great admirer of the concept. I like structured programming and I like algorithms and methodological approaches to coding, so this design patterns idea has always looked like a potentially very interesting topic to me.

Potentially; that's the word. Almost all of the books explaining design patterns were written with C++ (and later Java) programmers in mind. Well, I could swallow that. I know how to program in C, and I can read C++ and Java, so that was an obstacle that I could surmount with some work. A bigger problem were the UML diagrams explaining the patterns and code examples that had no connection to reality.

Problem one – UML diagrams. I don't do UML. I tried to learn it few times, but it doesn't speak to me, and for the sake of my sanity, I'm unable to remember what all those empty circles, full circles, and other line endings are supposed to mean. Each time I saw a UML diagram in a design patterns book, I lost my patience and walked away.

Finally, the time has come for some payback! This book contains no UML diagrams at all. What's more, this book contains only one diagram describing a state machine, but even this diagram uses no formal notation - it is just my ad hoc sketch. Take that, UML design pattern-lovers! (Not really. I have deep respect for people who fluently use UML.)

Rather than drawing all kinds of diagrams, here, I've tried to explain how each pattern works in simple words. I've also tried to find more-or-less appropriate and analogous examples from the real world. I can only hope you'll like my approach. If not, you can still read this book and use any website describing design patterns to look at pretty diagrams at the same time.

My second problem was with code examples. With some rare exceptions, design pattern books and websites all repeat examples that were cited in the original Gang of Four publication (more on that in Chapter 1, Introduction to patterns). Those examples are all terribly outdated and irrelevant to a Delphi programmer. Which one of you needs to know how to use the Decorator pattern to apply scroll bars to a text view? There are many other uses for this pattern in the modern world – see the Chapter 5, Adapter, Proxy, Decorator, and Facade and consider the Adapter, Proxy, Decorator, and Facade patterns as examples.

Because of my deeply rooted dislike of such examples, I tried to stay away from them as much as possible. There are still examples that draw shapes onscreen in this book – simply because some patterns were designed specifically with such problems in mind – but the big majority of examples try to be closer to the experience of an average Delphi programmer. I also added few standalone sections on Delphi-specific language enhancements that may not be known to a fresh Delphi programmer, or to a Pascal programmer that doesn't speak Delphi. Look for them in headings starting with Delphi idioms.

Did I succeed in writing a easier to understand and more practical design pattern book? Only you can tell. (And please, do tell! I'll be glad to receive any feedback – positive or negative.) I can only say that this book has helped me – now I finally understand what this "design pattern" stuff is all about.

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete