Skip to Main Content
Mastering Delphi Programming: A Complete Reference Guide
book

Mastering Delphi Programming: A Complete Reference Guide

by Primož Gabrijelčič
November 2019
Beginner to intermediate content levelBeginner to intermediate
674 pages
15h
English
Packt Publishing
Content preview from Mastering Delphi Programming: A Complete Reference Guide

Visitor

The iterator pattern shows us how to separate the internal structure of a data container from the code that operates on it. A visitor pattern is similar in topic, but applies not so much to composite data as to composite objects. It shows how to implement an algorithm/object separation, which allows us to add new operations to existing objects without modifying their structure. As such, it represents a good example of the Open/Closed principle in practice.

In classical object-oriented code, a part of code (an algorithm) would take an object, inspect its internal structure, and operate on its parts. If we use the visitor pattern, this approach is turned on its head. The algorithm merely passes a method to the object and kindly asks ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Delphi GUI Programming with FireMonkey

Delphi GUI Programming with FireMonkey

Andrea Magni
Delphi Cookbook - Third Edition

Delphi Cookbook - Third Edition

Daniele Spinetti, Daniele Teti

Publisher Resources

ISBN: 9781838989118Other