Category
The author of Code Faster in Delphi has just released his second book, Code Better in Delphi--and it is just as packed with useful coding techniques that will improve the way you write software as the first. The book is an easy read with short, clear examples that illustrate the concepts presented. It covers coding, analysis, design paradigms, instructs on the use of both Delphi IDE capabilities and external tools, offers advise on working with teams and provides many resources throughout for deeper research and learning.
His writing is based on experience that many of us have witnessed first-hand: inheriting a set of code fraught with nested with
statements, extremely long procedures, obtuse identifier names, and unreachable code left to confuse the next coder. I found myself nodding in agreement at times and shuddering with recent memory at others while reading; but every tale of horror was followed with hints on how to improve the code without breaking it.
Part 1 - Coding Basics
I read the first of the four parts (about a quarter of the 224-page book) in about an hour. In addition to code improvement tips are instructions on how to put these techniques to use immediately using the Delphi IDE's code formatting options, refactoring features, and included tools.
I believe the professional programmer would do well to heed his advice on coding style, learn the SOLID principles, and study the design patterns he reviews. Software teams that implement standard policies based on these guidelines would produce more maintainable code, new programmers joining the team would get up to speed quickly, and debugging time would be decreased. I found his explanations on why these principles are important to be a fresh, new perspective I appreciated very much.
Part 2 - Tools
The second part of the book gets into utilizing Delphi and related tools, libraries, and plug-ins to provide valuable insights to your code. I was glad to see this as writing good code is only the start--analyzing what you've written and using aids to improve are great motivators for betterment. Alister thoroughly covers the add-ons every serious Delphi programmer should have in their toolkit.
Part 3 - Working with Code
Part three is the largest section--and covers topics often ignored or shoved down the priority list so far, it never happens: testing, debugging, and cleaning your code! After explaining the different types of testing (functional, integration, unit, and TDD), he takes a deep dive into debugging tips and some intricacies of the Delphi debugger that elude many programmers. Debugging threads, setting up watch groups, and using the Modules, Events, and CPU windows effectively are all covered in simple terms.
Also discussed here is larger coverage of the topic of dependency injection, introduced in the first part of the book. In addition to describing what it is and how it works, he contrasts what it isn't and where it shouldn't be used. This helps clarify it's true purpose instead of leading to the presumption that every object needs to be interfaced. Again, his clear and simple examples inspire the reader to dig deeper--and he provides external resources for doing just that.
The advise on cleaning your code was not only explained with clear examples and an explanation of tools to help, but also nicely ties in with the previous sections of this part of the book by describing a common function of many applications, logging, and how to use dependency injection to remove global objects and make your code more testable in the process.
Part 4 - Beyond Delphi
If you have never used version control, you should read Alister's introduction of the subject which briefly describes the concepts and highlights a couple of the popular systems in use today and how they can be used to enhance collaboration. The discussion broadens from there to cover software development methods and processes beyond managing your code to managing projects and teams, discussing Waterfall, Agile, and Kanban methodologies. But he doesn't stop there; the book finishes by touching on continuous integration, working remotely, and backups, giving the Delphi programmer many things to consider when pursuing the goal of better coding.
Conclusion
This book starts off doing exactly what the title proposes: showing you how to Code Better in Delphi. But the author realizes that a programmer is more than just the what is written between begin
and end
. Design and analysis are important to understand what you are supposed to do (design) and how well you did it (analysis); and if there's a error, how to quickly find it (debugging). These parts, I expected. But I was delighted to find the additional coverage of how your code and your team are managed--all affecting how to code better overall.
Software development is a continual learning process; there are always new tools and techniques, languages and libraries, designs and demands. Keeping up with it all is a challenge. Fortunately, there are authors like Alister Christie who provide readable books and helpful videos that pack a lot of useful information in a compact and approachable manner to help. I learned something in every section (and I've been using Delphi since it first came out!).
I highly recommend this book to every Delphi programmer--new and experienced!
Add new comment