Sunday, July 23, 2023

Here's how I will code better in Delphi. How will you?

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". Keeping Fowlers "Refactoring" book on my desk, and referring to it often, is one way I am going to code better in Delphi.

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 another way I'm going to learn 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 or MVVM
  • Overcome my stumbling block of Interfaces

Use the comments below to share how you will code better in Delphi.

Enjoy
Semper Fi
Gunny Mike

Sunday, July 2, 2023

Blueprint for Creating Delphi FMX Apps

 I just discovered an unlisted YouTube video Ray Konopka did in 2018 for Embarcadero's CodeRage called "Mobile View Management with Ray Konopka from RodeRage 2018

Although the demo and source code for this presentation is based on a mobile app, the concept Konopka presents is not just for mobile apps. It's actually a blueprint for creating any type of FMX app using Delphi.

Blueprint for Creating Delphi FMX Apps


I was compelled to write this blog for two reasons. The first stems from the fact that this is not just for mobile app development, it's for any FMX app development. And number two, the concept is simple, powerful, and elegant.

The source code Konopka used is available for download using this link https://delphibydesign.com/downloads/

From the Mind of Konopka

It doesn't matter whether you are brand new to Delphi or a seasoned Delphi veteran, if you get the opportunity to download and study an application built by Konopka, TAKE IT. You will learn so much. It's an opportunity to explore the mind of Konopka.

Konopka embodies the meaning of my favorite quote from Albert Einstein. "Make everything as simple as possible but not simpler."


Enjoy!
Semper Fi
Gunny Mike
https://zilchworks.com