Code Better in Delphi
Minimum price
Suggested price

Code Better in Delphi

The practice of writing maintainable, reliable, and scalable code in Delphi.

About the Book

It’s back, it’s bigger, it’s better, it’s the sequel to Alsiter Christie's previous book, it’s Code Better in Delphi.  

After my last book, you can write code much faster, but without the skills to write code better, you might just end up being a highly efficient spaghetti coding machine.  So stop writing that tightly coupled singleton full of duplicated code, and start reading this book.

This time, rather than looking at how fast and productive you can be, we look at quality and maintainability.

In this book, you’ll be introduced to a variety of ways you can make your code better

  • How DRY is that code you just wrote?
  • Is that class SOLID or crumblier than a very crumbly cookie?
  • Will Refactoring improve the quality of your code?
  • Are you reinventing the wheel, or should you use try Patterns?
  • Will testing drive you mad?
  • Are your bugs buggier than a giraffe stage beetle?
  • Do you have a handle on those dependencies?
  • Are your versions under control?
  • What to do before disaster strikes or the zombie horde arrives?
  • Are you Agile, or are you about to go over a waterfall?
  • How do you calculate the Bus number for your project?

Find out the answer to these and many more questions in this book.

But wait, there’s more…

Plugins and Tools that

  • Find areas of your code that might need improving.
  • Tell you about Complex areas of code you can simplify.
  • Where you are making common coding mistakes.
  • Help remove redundancy and orphaned code.
  • Let you know when code is leaker than a knitted canoe.
  • Automate your testing

About the Author

Alister Christie
Alister Christie

Alister Christie is a Delphi MVP (Most Valued Professional), Consultant, Developer, Trainer, Presenter, and Author. He has presented at ADUG (Australasian Delphi Users Group) Symposia and Code Rage Conferences for many years. Alister holds a degree in Mathematics and Computer Science from Victoria University, Wellington. He lives near Wellington, New Zealand.

On this YouTube Channel, Alister has created many hours of video tutorials to help you learn Delphi Programming in efficient and effective ways. Using his lessons, you will program faster and better, skills applicable for beginners through to experts wanting to expand their programming and coding proficiency.

Video topics by Alister Christie include VCL (Visual Component Library), FireMonkey, FireDAC, Cross-platform, Android, iOS (iPad or iPhone Operating System), Mac OS/X, Windows, IoT (Internet of Things), Algorithms, and more.

If you wish to increase your Delphi programming skills further, Alister has commercial online video courses designed to build your understanding and proficiency. These are available from Embarcadero Academy, Udemy, or from

For more Delphi video content by Alister Christie go to his website where you will find informative Delphi videos ranging from beginner to expert 

Subscribe to this Youtube channel and never miss a video:

Visit the Website:

Contact Alister Christie on LinkedIn:

Follow on Twitter:

Follow on Facebook:

Follow on Instagram:

Buy from Embarcadero Academy:

Buy from Udemy:

Buy from LearnDelphi:

Table of Contents

  • Copyright
  • Table of Contents
  • Dedication
  • Foreword
  • Preface
  • Acknowledgements
  • Introduction
    • Conventions Used in this Book
    • Scope
    • More Information
    • Code Samples
    • Sections in this Book
  • begin
  • Make Code Maintainable
    • The Enterprise Development Merry-Go-Round
    • Write Code for Maintainability
    • Write Code for Scalability
    • Write Code for Reliability
  • Small Coding Tips
    • Evil Comments
      • Don’t Leave Commented-Out Code in Your Application
    • Make Your Code More Stylish
      • Let CTRL+D Be Your Friend
    • Use a Good Naming Convention
      • Stop Prefixing Variables with Their Type
      • Variables are Nouns, Methods Verbs
    • Parameters
      • Parameter Overload
      • Parameter Sets
      • By Reference or By Value
    • Side Effects
    • Method Length - Size Really IS Important
    • Ditch With
    • FreeAndNil
    • Global State
    • Inject Your Dependencies
      • Further Learning
  • DRY Your Code
    • When Not to DRY Your Code
    • WET Code
  • Use SOLID Code
    • Single Responsibility
    • Open-Closed
    • Liskov Substitution
    • Interface Segregation
    • Dependency Inversion
    • Further Learning
  • Use the Law of Demeter
  • Refactoring
    • What is “refactoring”?
    • Malodourous Source
      • Further Learning
    • Specific Refactorings
      • Re-ordering Statements
      • Rename Refactoring
      • Automated Refactorings
      • Extract Method
      • Extract Method Object
      • Split With
      • Introduce Explaining Variable
      • Summary
    • Further Learning
  • Design Patterns
    • The Observer Pattern
    • Anti-Patterns
      • Redundant Code
      • Language Features
      • Bad Exception Blocks
      • Use Guard Clauses Properly
      • Premature Optimisation
      • Architecture
    • Further Learning
  • The Delphi IDE
    • Hints and Warnings
      • Have a Zero Hints and Warnings Policy
      • Further Learning
    • Audits and Metrics
    • Toxicity Metrics
    • Help Insight
  • Third-Party Tools
    • External Tools
      • Source Monitor
      • Pascal Analyzer
    • Libraries
      • FastMM
        • Leak Detection
        • Double Free
        • Using a Freed Object
        • Limit Usage to Debugging
    • IDE Plugins
      • Pascal Expert
      • FixInsight
      • Beyond Compare
      • TestInsight
      • Model Maker Code Explorer
      • Other Plugins
  • Testing Your Application
    • Types of Testing
      • Functional Testing
      • Integration Testing
  • What are Unit Tests?
    • Test-Driven Development
  • What is Test-Driven Development?
    • Bowling Score Kata
    • What’s a Kata?
    • What is a Coding Kata?
    • Bowling Score Kata
    • How to Score Ten-Pin Bowling
    • And the Kata Begins…
      • About the project
      • The unit tests
      • Gui Runner
      • Further Learning
  • Debugging
    • Debugging Basics
      • BreakPoints
      • Baby-Steps
    • Instruction Pointer
    • More Advanced Breakpoints
    • Breakpoint Window
    • Local Variables
    • Call Stack
    • Watch List
    • Debug Inspector
    • Evaluate/Modify
    • Threads
    • Modules
    • CPU Windows
    • Using the Debugger:
      • Simultaneous Debugging
      • Work Out the Pass Count
      • Extreme Side Effects
    • Fantastic Bugs and Where to Find Them
    • Logging
    • Platform Assistant
    • Writing Code to Make Debugging Easier
    • Test Your Bugs
    • Further Learning
  • Removing Dependencies
    • Dependencies Between units.
    • Dependencies Between Classes
  • Dependency Injection
    • Three Types of Dependency Injection
      • Constructor Injection
      • Property Injection
      • Method Injection
      • Interface Injection
      • Further Learning
  • Cleaning Up Uses Clauses
    • cnWizards Uses Cleaner
    • Pascal Analyser Usage Report
    • Orphaned Code
    • Removing Public Methods and Globals
    • Pascal Analyzer Code Reduction Report
  • Logging Example
    • Remove Global Variable by Constructor Injection
    • Create an Interface
    • A New Logger
    • Multiple Loggers - Polymorphism to the Rescue
    • Method Logging Made Simple
    • Final Notes
    • Further Learning
  • Settings Example
    • TVirtualInterface to the Rescue
    • Descending from TVirtualInterface
    • Introducing Attributes
    • Further Learning
  • Working on Legacy Projects
    • Further Learning
  • Version Control
    • What is version control?
    • Repository
      • Update
      • Merge
      • Commit
      • Branch
    • Subversion
    • SVN Tutorial
      • Install a Server
      • Install the Client
      • Using SVN
      • Checking Our Code In
      • Making Our Second Commit
      • Going Back to a Previous Version
      • Diff
      • SVN in Delphi
      • Subversion in the Cloud
      • Further Learning
    • Git
      • Configuring Git
      • Git Tutorial
      • Some Other Handy Hints
      • Further Learning
    • Bug / Issue / Ticket Tracking Systems
  • Working in Teams
    • What’s the Bus Number for Your Project
      • Have a Successor
    • Getting Along in a Team
    • Outsourcing
    • Team Scalability
    • Peer Review
    • Pair Programming
  • Methodology, Process, and Project Management
    • Waterfall
    • Agile
      • Sprints
      • Team Size
      • Stand-Ups
      • Kanban Board
      • Scrum
      • Further Learning
    • Lean
      • Further Learning
    • DevOps
      • Infrastructure as Code
      • Containerisation
      • Continuous Integration
      • Continuous Delivery
      • Further Learning
  • Preparing for Disaster
    • Backups
    • Virtual Machines
    • What if Something Happens to You
    • Other Options
    • Zombie Apocalypse
    • Further Learning
  • finalization
  • end.

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub