When it comes to Delphi, it's amazing how much I don't know, once knew but forgot, or just plain skipped over because it was too mind-boggling at the time. I took a break from reading Alister Christie's new book "
Code Better in Delphi", which I purchased last night, to write this blog post.
While reading the bit on "refactoring", I realized how little refactoring I actually put into practice. Yes, I have Fowler's book, the second edition. And no, I haven't read it. I've thumbed through it a little in the past. I even tried looking for the "Introduce Explaining Variable" refactor Christie discusses on page 53 of his book. It turns out Fowler now calls it "
Extract Variable".
It's amazing how much I don't know or once knew but forgot
I just started reading "The Observer Pattern" in Christie's book and had to stop. I bought "Head First Design Patterns" by O'Reilly, quite a few years ago. I have the 10th Anniversary edition with code examples in Java 8. My intent was to install Java on my machine and force myself to learn these patterns by following the code in the book. It didn't go so well. The authors do a great job using story to make learning fun. I just couldn't wrap my head around Java.
Christie has managed to reignite my desire to learn these patterns. I downloaded the Java source code. I plan to work my way through "Head First Design Patterns" pasting the Java source code into ChatGPT, and asking Chat to convert it to Delphi.
I will navigate through each pattern using this method. I will then revisit the same pattern in Primoz Gabrijelcic's book "Hand-On Design Patterns with Delphi". This is one of the ways I'm going to learn to code better in Delphi.
Keeping Fowlers "Refactoring" book on my desk, and referring to it often will be another way I am going to code better in Delphi.
Another way is to revisit the Model-View-Controller method of code separation. Here is a the MVC song from 2007 I just learned about today.
And I also want to implement "Interfaces".
Here's my list of how I will code better in Delphi:
- Finish reading Christie's book
- Practice refactoring often
- Learn and implement design patterns
- Discover and utilize ways to separate code concerns such as MVC
- Overcome my stumbling block of Interfaces
Use the comments below to share how you will code better in Delphi.
Enjoy
Semper Fi
Gunny Mike
https://zilchworks.com
Weiterlesen...