Code Better in Delphi

Buy Code Better in Delphi From LeanPub.com or from Amazon.com

Make your Delphi code better by reading this book! You will find numerous tips, tricks, techniques and tools to enhance and improve code. How does your code stack up? Are you writing code that will be usable for years, or are you heading towards a dystopian maintenance apocalypse?

CodeBetterMockup small

Read the Reviews

Back Cover Text

It’s back, it’s bigger, it’s better, it’s the sequel to Alister 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 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

 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
  • PART ONE - CODE
  • 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
  • PART TWO - THE RIGHT TOOL
  • 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
      • FastMM4
        • 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
  • PART THREE - WORKING WITH CODE
  • 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
    • Heisenbugs
    • 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
  • PART FOUR - BEYOND DELPHI
  • 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.