Showing posts with label books. Show all posts
Showing posts with label books. Show all posts

Sunday, July 23, 2023

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

Disclaimer: This post contains affiliate links, which means I may earn a small commission if you click through and make a purchase, at no extra cost to you. Your support helps keep this blog running – thank 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.


https://amzn.to/4dE8oOq (Paperback)

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

Note: Some links in this post are affiliate links, meaning I may receive a small commission if you make a purchase. This helps support my work – thank you for your understanding.

Monday, December 5, 2022

The Kinetic Technique by H. A. Overstreet (1925)

Influencing Human Behavior by H. A. Overstreet was published in 1925. I purchased an old hardcover copy of his book over a year ago because, some other book I was reading referred to it as a master work. Overstreet's book has been sitting on my oak book shelf, which was built by a very nice Mennonite man in Maryland, ever since it arrived.

I spent the weekend of November 26th and 27th entering all my "print books" into a software program called Calibre (https://calibre-ebook.com) which by the way, is mainly for managing E-books.

After saving the information from an ISBN import, I began reading. I stopped on page 12 after reading what Overstreet wrote about capturing one's attention using "The Kinetic Technique".

I stopped reading because this piece of wisdom so grabbed ahold of me, I wanted to let it seep into my mind.

Two days later on Tuesday morning at 1:45 AM I woke to a racing mind. "What book talked about a dot on the wall?" I kept searching, and searching my thoughts. Nothing.

"Ah, the influencing human behavior book."

Why was this so important that it woke me up? My website (read that as I) totally violated the principle of movement. Every page on my website has the same big-ass banner. I was making all my visitors (read that as potential customers) stare at a dot on the wall. How boring is that.

I jumped out of bed right then and there and started working on removing the dot from my website. It took me a few days, but I managed to get rid of that dot. But more importantly, I learned a valuable lesson from some ink that was printed nearly 100 years ago.

Thank you Mr. H. A. Overstreet. I can't wait to see what else of yours seeps into my mind.

Influencing Human Behavior - H. A. Overstreet (page 12)

Enjoy,
Gunny Mike
https://zilchworks.com

Monday, February 21, 2022

Book Review: The Hungry Brain

The Hungry Brain points out how the brain works. The brain (your brain) is conditioned by past food choices and conditions you to make future choices. There are strong cues at play and the stronger ones win. Most of what happens is nonconscious. The author credits Daniel Kahneman, author of "Thinking, Fast and Slow" for the two brain systems. System 1 which is fast, effortless, intuitive, and nonconscious. System 2 which is slow, effortful, rational, and conscious. System 1 usually wins when it comes to food choices.


I was surprised by how food decisions are made in the brain and how the brain continuously reinforces those decisions. I was also stunned to discover how irrational our/my thinking can be. This supports the two systems Kahneman describes. For example; "The 1970 Stanford Marshmallow Experiment" gave children the option of one marshmallow now (which sat on a table right in front of them) or two marshmallows in 15 minutes. The kids were basically given a choice of a small reward now or a larger reward in the future. Most kids ate the one marshmallow right away. We/I tend to value the now more and the future not so much. This is a psychological trait called "delay discounting".

This book is a very technical read

I know I am one of those people who do/did not value my future self. I started smoking cigarettes when I was twelve. As an adult I smoked two and one-half packs of cigarettes a day. One day, after 32 years of smoking, I finally quite "cold turkey". As a smoker I totally discounted my future health. I've been smoke-free for 20+ years. For me, it's time to refocus on my future self and lose the weight. While a brown sugar cinnamon pop tart will definitely give me a 10 minute pleasure high it does not help my future self one bit. 

This book is a very technical read. You could probably get away with reading only chapters 10 and 11. However, you would miss out on some of the little stories sprinkled throughout the other chapters. 


This book has caused me to want to read two other books. The first book, which I purchased, is "Thinking, Fast and Slow" by Daniel Kahneman. I was originally introduced to Kahneman a few years back. I'm very much interested in storytelling and Kahneman links effective storytelling to emotions not rationale. So I am very interested in learning more about the two brain systems. 


The second, which I checked out from the library is "Salt Sugar Fat" by Michael Moss. I've had a tacit understanding that processed foods are the new crack cocaine. I figure by reading this book two things will happen: 

  1. I will change my perspective on processed food and see them for what they truly are. 
  2.  By learning exactly how food scientists tweak the salt, sugar, fat ratios every so slightly to keep their food irresistible, I will view these foods as traps, and see myself for what I really am... nothing more than a commodity (a tick mark on the balance sheet).



Please use the comments to give your recommendations for other, related books worth reading.

Enjoy
Semper Fi
Gunny Mike 

Sunday, January 16, 2022

Book Review: Delphi GUI Programming with FireMonkey (Part 1)

I purchased the book Delphi GUI Programming with FireMonkey by Andrea Magni on November 7, 2020. I dove in head first with great enthusiasm only to get derailed early on. It happened when I tried to follow the topic Understanding the Style Designer in chapter 2.


As someone who knows almost nothing about FireMonkey these four and one-half pages soured my learning and turned me against this book and it's author. I tried reaching out to the author directly and received a curt response basically telling me that the examples in his book were not meant to be step-by-step. From that moment on I let this book sit on the shelf and collect dust.

That was a foolish mistake on my part. 

The Style Designer is a central part of FireMonkey and FMX. It is my opinion, that the author introduced this complex topic much too early in the book. It was presented with just a small smattering of knowledge and guidance. Leading me to three days of frustration because I could not make the Style Designer match what I saw in the book. The style designer is much too complex a topic to simply be glossed over in this fashion. A more fitting title for this topic would be First Glance at the Style Designer.

Don't Judge a Book by Only 4 Pages

If you are new to FMX and FireMonkey, and you want to get the most out of this book, I highly recommend you skip the topic Understanding the Style Designer in Chapter 2 (print: 34-38, pdf: 31-35). No understanding will happen. Instead, I recommend you watch this 50 minute YouTube video by Ray Konopka called Customizing Controls with FMX Styles.


After you have a better understanding of the FMX Style Designer, you may want to come back to the topic Understanding the Style Designer in this book.

You can best sum up my attitude about this book (and it's author) by the phrase "Don't judge a book by only 4 pages". I owe Magni an apology for holding a grudge against him because of 4 stinkin pages (and one email) in a book. 

"Andrea, I'm sorry."

I finally picked up Magni's book (again) last week. Actually I did a search for "Live Bindings" of my digital Delphi books which lead me to pick up Magni's book of the shelf. I opened up to Chapter 4, Discovering Lists and Advanced Components to a huge surprise. The printed copy of my book went from page 104 to page 157. Pages 105 through 156 are missing.

I contacted Packt Publishing to let them know of the misprint. All is good, a new printed copy is on the way.

At this point I was committed and had to fall back on reading the PDF version of Magni's book. I recently had cataract surgery on both eyes so I was very hesitant. Reading PDF books and manuals always leads to eyestrain at best or headaches at worst. That's when I discovered you can customize the background and font colors of a PDF document. See my post "Tip of the Day - How to change the text color of a PDF document" for instructions on how to do this.

I'm only part way through Chapter 4: Discovering Lists and Advanced Components and so far, Magni had done a fairly descent job. I have downloaded the source code for this book. I find it very helpful to have Delphi up and running along side reading the customized PDF. I open the example projects and play along with the reading to get a better understanding. 

Magni has done a a great job organizing the source code for this book. There is a separate chapter containing projects for each chapter. Each project within a given chapter has it's own folder. It is very well organized. The folders seem to be named intuitively. However, I find it very helpful to rename each folder and preface each folder name with the page number. That way I can quickly associate which project goes with with page or section of the book. As a plus, any un-numbered folders means I haven't opened that project and most likely haven't read that section of the book in detail.


I'm not sure when or if I will get finished with Magni's book. I'm just glad I overcame my stubbornness and opened his book back up again. I do know I have a need to and look forward to learning the following:

  • Chapter 4 Discovering Lists and Advanced Components
    •  ListBox
    •  ListViews
    •  Treeviews
    •  Grids
  • Chapter 5 Using FireDAC in FMX Applications
  • Chapter 6 Implementing Data Binding
  • Chapter 7 Understanding FMX Style Concept
  • Chapter 8 Divide and Conquer with TFrameStand (Maybe)

Bottom Line: Buy this book. Skip pages 34-38 (print), 31-35 (pdf).

Semper Fi,
Gunny Mike
zilchworks.com

Sunday, February 24, 2019

Expert Delphi - Code Errata

For the past month I have been making my way through Pawel Gloawcki's book Expert Delphi. I love this book. I am having fun and learning so much. I completed the "Game of Memory" application from Chapter 4, and it works pretty good.


I initially ran into an issue running The Game of Memory on my Galaxy S9+. In portrait mode, if I selected "6 Pairs" it rendered two columns of six. However, only the top portion of the bottom two tiles displayed. I changed the TILE_MARGIN constant from 2 to 4 and it fixed the render problem.

I moved onto Chapter 5 - Firemonkey in 3D. I discovered an error from page 162 that took me over an hour to track down. I finally figured it out. The program is supposed to display a red 3D Pyramid. However, I was only getting a blank screen. I discoverd one of the private properties was not getting set.

  TWireframe = class(TControl3d)
  private
    FDrawColor: TAlphaColor;
    FEdges: TEdges;
    FPoints3D: TPoints3D;
    FDisplayed: Boolean;
  public
    constructor Create(AOwner: TComponent) ; override;
    destructor Destroy; override;
    procedure Render; override;
    property DrawColor: TAlphaColor read FDrawColor write FDrawColor;
    property Points3D: TPoints3D read FPoints3D;
    property Edges: TEdges read FEdges;
    property Displayed: Boolean read FDisplayed write FDisplayed;
  end;

It is the code for the constructor where the error is:

The private boolean field FDisplayed was not getting set to true.

constructor TWireframe.Create(AOwner: TComponent);
begin
  inherited;
  FPoints3D := TPoints3D.Create;
  FEdges := TEdges.Create;
  FDrawColor := TAlphaColorRec.Red;
end;



As soon as I added this code to the constructor it worked like it was supposed to.

constructor TWireframe.Create(AOwner: TComponent);
begin
  inherited;
  FPoints3D := TPoints3D.Create;
  FEdges := TEdges.Create;
  FDrawColor := TAlphaColorRec.Red;
  FDisplayed := True; // This is missing on page 162 of the book
end;


It probably wouldn't have taken me so long to figure this out if I was a more seasoned Delphi programmer. Oh well, it is what it is. So, for any of you who are reading or plan to read "Expert Delphi" keep this little tidbit in mind when you get to Chapter 5.

I have submitted an errata to the folks at https://packtpub.com

Enjoy,
Gunny Mike
https://zilchworks.com


Sunday, August 12, 2018

Delphi Book Collection

One week after I wrote about Warren Buffet's 25-5 rule I created my own "Top 5" list. However, this time I put a little twist on it. Instead of creating a to-do list of things I wanted to accomplish in the next six months, I created a list of the top 5 things I have accomplished within my lifetime. It took me about five or six days but I finally came up with my list.

#4 on my list: "Creating a software product back in 1991 that still generates sales today."

If you check the list of Delphi releases you'll notice that Delphi didn't exist in 1991. Turbo Pascal was the tool I used to create that first version of my software. Here is a picture of Zilch v1.11. Unfortunately, I do not have a copy of my very first version 1.0.

Zilch Version 1.11 (Version 1.0 not available)

Learning Turbo Pascal was fun. I owe my passion and desire for computer programming to Jeff Duntemann. He wrote a book called "Complete Turbo Pascal". It was that book that taught me everything I needed to know about computer programming, and the Pascal language. In fact, the reports within my software are pulled using the double-linked list example in his book. Duntemann does a brilliant job of explaining this concept.

That book is by far my absolute favorite programming book. I used several snippets of code, and in some cases entire routines from the examples in his book. Like the linked list routines. I remember getting close to being done. My software was about a month away from being released as shareware. And it dawned on me, "Holy crap. I've used a bunch of code from this book and it's copyrighted. Can I do this?" So I called Jeff and the conversation went something similar to this...

Me: Mr. Duntemann.

Jeff: Yes.

Me: You don't know me. My name is Michael Riley. I'm a US Marine developing software in my spare time.

Jeff: That's good. I like Marines.

Me: Mr. Duntemann, I've...

Jeff: Please call me Jeff not Mr. Duntemann.

Me: Okay. I've been using your book "Complete Turbo Pascal" to learn how to write my software. And I've embedded several of the code snippets into my software. The're all over the place. I've even used the complete linked-list code routines. Am I allowed to do this? Can I use your code in my own software?

Jeff: Of course. That's why I wrote the damn book.

Me: Whew, that's a relief. You have no idea how worried I was. I really like how you explained double linked lists.

Jeff: I get quite a few calls from people telling me they have my book and asking to explain something. I remember the phone ringing at 1 in the morning one time and I was explaining linked lists to this guy. I remember using a kite metaphor. You see it's like a kite with a tail, and attached to that tail is another kite with a tail. And attached to that tail is another kite. Kites and tails with attached kites keep going on and on and on.

I love this guy. That was 1991 and Jeff and I have been friends ever since. One of these days I'm going to have to get Jeff to sign this book. I've completely destroyed the spine. I even had to use clear shipping tape to hold the spine together.

Complete Turbo Pascal Third Edition - Jeff Duntemann

My books have been scattered all over my basement office. When I want one I go searching from pile to pile. Moving stuff, looking around. It's frustrating and not very productive. Arrrgh!

It's been like this for a long time. It's not just books that are unorganized. It's me. It's everything. Besides, the older I get the harder it is to keep track of stuff. Stuff I need to do. When it needs to get done. Who I owe it to. Who owes me stuff. All that stuff.

So, I dusted off my old Franklin Planner that I haven't used since 2010. Inserted the new planner pages on Wednesday night and started using it the next day. Life is so much better now. I set a task for organizing my basement home office on Saturday. Then I decided to gather up all my Delphi books and put them on one single bookshelf. Wow, I have quite the collection.

Click to enlarge image

And guess what? All those books are tied to my #4 lifetime accomplishment: "Creating a software product back in 1991 that still generates sales today".

However, it not about what I did. It's about people. The people who helped me while I was in the midst of doing the thing I did. Like I said, I owe my #4 to Jeff Duntemann. Without him this never would have happened. Look what it's lead to. It's because of Jeff that I stayed enthused, and stayed passionate. Passionate enough to buy 32 Delphi books over the past 28 years. Not to mention the eBooks sitting on my computer. Thank you Jeff.

Don't worry I've told this to Jeff already. He's not hearing this for the first time reading it here. What kind of guy do you think I am.

I have a challenge for you! I want you to create your own "Top 5" list of lifetime achievements.

It doesn't matter if it takes you a week, or two weeks, or longer. Just do it. Then sit and think about your accomplishments. Think long enough about them until you discover who helped you get there. And then, reach out to them and let them know.

Enjoy,
Gunny Mike
zilchworks.com



Sunday, May 20, 2018

Don't Just Code in Delphi, Think in Delphi

I have always struggled with fully understanding the object oriented nature of Delphi. I still struggle with it today. For example, I have tried to read Nick Hodge's book "Coding in Delphi" three times and can't get past page 23. I'm currently on page 96 of Pawel Glowaki's book "Expert Delphi" and had to stop because he talks about using the TTextWriter class which is a class with virtual abstract methods. Virtual Abstract Methods, are you kidding me. What the hell are Virtual Abstract Methods.

(Expert Delphi page 96) "Notice that the TTextWriter class is a class with virtual abstract methods that just define the interface to the text writing functionality so we need to use one of the text writer descendants such as TStringWriter."

Okay, so I get a small glimpse into what Pawel's talking about. These VAM's are just interface definitions. They don't really exist. The real functions exist somewhere else. In this case the TStringWriter class. I'm just barely hanging on here, but I'm hanging on.

I blame my Delphi ignorance on my lack of going back to square one and learning Delphi's OOP think from the beginning. At the time I started using Delphi I just plowed ahead and made the code work. I wanted a Windows program and that is all I cared about. Looking back at it, I'd say I forced Delphi to work like my top-down procedural thinking. I never fully embraced the Delphi OOP think.

Hodges, Glowaki, Cantu, and all the other Delphi authors out there think in Delphi. And if I want to understand them and be proficient in Delphi I need to think in Delphi too.

So, how do you think in Delphi?

You find a resource that explains Delphi in a simple straight-forward manner. Perhaps a resource that teaches you how Delphi came into being. Does such a resource exist? Yes. And I just so happened to have a copy on my bookshelf.


Here are three paragraphs from page 7 and 8. If these paragraphs speak to you like they did me, then I highly recommend you read the entire Turbo Pascal 5.5 Object Oriented Programming Guide.

The challenge of object-oriented programming (OOP) is that it sometimes requires you to set aside habits and ways of thinking about programming that have been considered standard for many years. Once that is done, however, OOP is simple, straight- forward, and superior for solving many of the problems that plague traditional software programs. 

A note to you who have done object-oriented programming in other languages: Put aside your previous impressions of OOP and learn Turbo Pascal 5.5's object-oriented features on their own terms. OOP is not one single way; it is a continuum of ideas. In its object philosophy, Turbo Pascal 5.5 is more like C++ than Smalltalk. Smalltalk is an interpreter, while from the beginning, Turbo Pascal has been a pure native code compiler. Native code compilers do things differently (and far more quickly) than interpreters. Turbo Pascal was designed to be a production development tool, not a research tool. 

And a note to you who haven't any notion at all what OOP is about: That's just as well. Too much hype, too much confusion, and too many people talking about something they don't understand have greatly muddied the waters in the last year or so. Strive to forget what people have told you about OOP. The best way (in fact, the only way) to learn anything useful about OOP is to do what you're about to do: Sit down and try it yourself.

I'm convinced this little 124 page resource will give me the solid foundation of Delphi think that I've  been missing. I was so excited to find this little gem and what it offers, I had to stop reading and tell you guys about it.

A copy is available on archive.org

Enjoy!

Semper Fi
Gunny Mike
zilchworks.com


Saturday, January 13, 2018

Playing With Fire(Monkey)

If you are like me and have been apprehensive about using FireMonkey let me offer you a renewed sense of hope. It's unfortunate that this hopefulness comes as the Delphi community morns the loss of Pawel Glowacki. However, Pawel will continue to influence at least this Delphi programmer, perhaps you, and undoubtedly many, many more.

I discovered the existence of Pawel's "Expert Delphi" book while reading one of the many R.I.P. blog posts. I sent myself a reminder to go purchase his book. And, this weekend I did purchase his book. I'm glad I did. I look forward to "Playing with Fire(Monkey)"!

In August I blogged "Why My Next Software Product Will Be Windows VCL Only". Well, this book is not about the VCL. Makes my VCL statement kind of ironic, don't you think. This book is about using Delphi FireMonkey to create cross-platform Mobile Apps from one code base. I did not know this about his book when I wrote that post. Taking on a new coding platform is a daunting task. I'm stepping up to the plate and taking on this task with the help of Pawel's book. I welcome you to join me in discovering how to "Play with Fire(Monkey)".

Expert Delphi - Preface


The world of a mobile app developer is getting more and more complicated. The technology is not standing still. Every day, new versions of mobile operating systems are released to the market. Mobile devices are getting new capabilities. User expectations are constantly growing, and it is becoming increasingly harder to meet them.

The only way to meet and exceed all challenges in the contemporary world of mobile development is to become a developer superhero! Super heroes have super tools. In this book, we are going to embark on the journey of mastering Delphi development. We will learn how to gain amazing productivity powers and rapidly build stunning cross-platform mobile apps from one codebase.

We will start with getting comfortable with using the Delphi IDE. Then, we will review the key constructs of the Object Pascal language and everyday programmer tasks, so you can easily understand and write solid and maintainable source code. Over the course of this book, the fun levels are only going to increase. We will start our adventure with mobile development with Delphi from building small projects that will make you feel like a real Delphi developer. Having mastered simple things, you will be ready for doing more serious stuff. We will go deep into understanding the concept of FireMonkey styles, which is the cornerstone of building stunning cross-platform user interfaces that will make the difference in the end user experience of your apps. The rest of the journey is all about gaining practical knowledge of using more complex Delphi frameworks. We will get down to the metal and harness the full power of mobile hardware and operating systems. We will be working with sensors, extending to the Internet of Things, building data-driven user interfaces, embedding mobile databases, integrating with REST web services, architecting scalable, multiuser backends, and more.

This book is packed with practical code examples and best practices for you to become an excellent mobile developer!

Expert- Delphi - Table of Contents


1: FASTEN YOUR SEAT BELTS

  • Delphi installation
  • Delphi compilers and toolchains
  • Hello World app
  • Deploying to mobile devices
  • Summary

2: MIND YOUR LANGUAGE

  • Do you speak Object Pascal?
  • Object Pascal Phrase Book
  • Summary

3: PACKING UP YOUR TOOLBOX

  • Parallel Programming Library
  • Working with files
  • JSON
  • XML
  • Summary

4: PLAYING WITH FIREMONKEY

  • Drawing in code
  • Get moving with timers
  • The power of parenting
  • Touch me
  • Game of Memory
  • Summary

5: FIREMONKEY IN 3D

  • Cross-platform 3D rendering
  • Using Context3D
  • Custom Wireframe component
  • Objects 3D
  • Moving Earth
  • Building an interactive 3D scene
  • Using 3D models
  • Starfield simulation
  • Mixing 3D and 2D
  • Summary

6: BUILDING USER INTERFACES WITH STYLE

  • Working with built-in styles
  • Using custom styles
  • Embedding styles as resources
  • Customizing styles
  • Using frames
  • Working with inherited views
  • Previewing forms on devices
  • Summary

7: WORKING WITH MOBILE OPERATING SYSTEM

  • James Bond's toy
  • What I'm running on?
  • The life of an app
  • Sensing the world
  • Taking photos
  • Using share sheets
  • Camera, light, action!
  • Working with address book
  • Notify me!
  • Navigating the web
  • Working with maps
  • Creating and consuming Android services
  • Delphi language bridges
  • Summary

8: EXTENDING TO THE INTERNET OF THINGS

  • Communication protocols
  • Understanding BLE
  • Connecting to things with ThingConnect
  • Getting close with beacons
  • Proximity solutions with BeaconFence
  • App tethering
  • Summary

9: EMBEDDING DATABASES

  • Architecting data-driven apps
  • Modeling data
  • Choosing a database
  • Accessing databases with FireDAC
  • Building data-driven user interface
  • Using visual live bindings
  • Fast user interface prototyping
  • Summary

10: INTEGRATING WITH WEB SERVICES

  • Understanding web services
  • Native HTTP client
  • Consuming XML SOAP web services
  • Integrating with REST services
  • Backend as a service client
  • Integrating with the cloud
  • Summary

11: BUILDING MOBILE BACKENDS

  • Delphi and multi-tier architectures
  • Getting low-level with WebBroker
  • Do it yourself with DataSnap
  • Easy REST API publishing with RAD Server
  • Summary

12: APP DEPLOYMENT

  • Deploying to App Stores
  • Enhancing your apps
  • Summary

13: THE ROAD AHEAD

  • What we have learned
  • Staying on top of everything
  • Your next Delphi mobile app
  • Summary

Expert Delphi - Prerequisites

You are expected to have a basic knowledge of Delphi and an interest in building crossplatform mobile apps for Android and iOS.

The Delphi IDE is a Windows program, so you will need a physical or virtual Windows installation. In order to develop for iOS, you will need a Mac computer. You will also need an Enterprise or Architect license for Delphi itself. In the beginning of the first chapter of this book, we cover the installation process of Delphi in a great detail.

Purchase Link:

https://www.packtpub.com/application-development/expert-delphi

Semper Fi,
Gunny Mike
zilchworks.com

Sunday, December 10, 2017

The Lazarus Effect

I haven't been focused on much software development lately, I've been working on some marketing material which I hope to have completed soon. Then I will get back to software development.

Last night I was prodded by my friend Jeff Duntemann's post on Facebook regarding the release of Lazarus 1.8 (with FPC 3.0.4). He mentioned this stuff to me a few years back and said I should check it out. I have always been a die-hard Delphi fan so I gave it a casual, glancing thought and moved on.

Well, now may be the time to give Lazarus a throrough going-over. I downloaded Jeff's book this morning and read through the first 30 pages and then skipped ahead to the "Installation" chapter. I'm always leery of installing freeware stuff, it's never as simple as point, click, and install.

I had no idea that FreePascal was the compiler and Lazarus was the IDE. had always thought these were two competing products.

Hopefully before the end of the year I will get Lazarus and FreePascal installed and give it a whirl. I'll let you know what I think.





Lazarus
https://www.lazarus-ide.org/
http://wiki.lazarus.freepascal.org/

FreePascal
https://www.freepascal.org/
http://wiki.freepascal.org/

FreePascal From Square One by Jeff Duntemann (free book)
http://www.copperwood.com/pub/FreePascalFromSquareOne.pdf


Semper Fi,
Gunny Mike
zilchworks.com


Saturday, May 13, 2017

Program to an Interface and not an Implementation

I have been struggling with trying to understand what it means to "Program to an interface and not an implementation." Nick Hodges said if he could teach new developers one thing it would be "program to an abstraction, not an implementation". This is the same thing. (wayback machine link)

So I asked Hodges to explain this to me. Instead of trying to regurgitate some sort of answer that might come up short of what I was looking for, he sent me a link to a fascinating thread on StackOverflow (https://goo.gl/PNq7bY). This really is a great read. After reading it I was close to understanding but still not getting all of it.

I have recently started reading Head First Design Patterns by Eric Freeman & Elisabeth Robson. This book does an absolutely fantastic job of describing the GoF design Patterns that Uncle Bob so bluntly told me I need to understand. To be quite honest, I never would have bought this book solely based on the cover. (Not buying this book would have been a mistake.)



Amazon: https://goo.gl/MVybeZ

On page 11 of Head First Design Patterns they point out Design Principal #2: "Program to an interface and not an implementation." They do an excellent job of explaining what this means. My ability to understand what they mean... "Not so much". This is even after reading page 11 three times and reading the entire SO link Hodges sent me.

Why am I so dim?
How come everyone else gets it but me?

Ah ha, it hits me.

Each Delphi Unit has an Interface section and an Implementation section. In Delphi these sections are like Public Scratch Paper and Private Scratch Paper. (https://goo.gl/B7U5RR) All Delphi noobs are taught to stick stuff in the Interface section that you want to share with other units and stick stuff in the Implementation section that you don't want other units to have access to.

That is NOT what it means to "Program to an Interface and not an Implementation."

I had to unlearn what I had known about Interface and Implementation because of my 25+ years of Turbo Pascal/Delphi. And relearn that there are different meanings associated with Interface and Implementation. Sometimes it takes the light bulb a long time to go on

My end goal in all of this "new learning" is to understand Dependency Injection and how to put DI to use when I design/redesign software. I'm slowly getting there. Delphi's Interface and Implementation sections have different usage and meaning than the OOP Design Principle: Program to an interface not an implementation.

So, what does it mean to "Program to an interface and not an implementation"?

You have to figure this out on your own. I'm not trying to be a smart ass here. Once you get it, you'll get it. Asking someone for a quick 5 minute explanation won't do it. You'll have to dig and keep trying until it makes sense for you. In learning this concept some people use widgets. Some use sprockets. Some use ducks. I like chess.

Think about the simplest piece in a chess game. The Pawn.

What's the same about every pawn?
What's different about each pawn?
If you forget about color, how many different pawns are there? 8, 1, 3, 4 ?
What about the pawn to the far-left?
What about the pawn to the far-right?
What about the pawn that reaches the last row?
How many different moves does a pawn have?
Do all pawns have the same moves?

Trying to understand what it means to "Program to an interface and not an implementation" requires a different way of thinking.

Here is my completely oversimplified chess example:
+--------------------------------+
| PawnMovement (Interface)       |
+--------------------------------+

+--------------------------------+
| PawnMovementImplementations    |
+--------------------------------+
ForwardOne 
ForwardTwo
AttackLeft
AttackRight
EnPassant

So to me learning how to "Program to an interface and not an implementation" means making sure your pawn has movement not what the pawn's movement is.

Think this:
Pawn1.PawnMovement.ForwardOne
Pawn1.PawnMovement.ForwardTwo
Pawn1.PawnMovement.AttackRight
Pawn1.PawnMovement.EnPassant

Don't Think this:
Pawn1.ForwardOne
Pawn1.ForwardTwo
Pawn1.AttackRight
Pawn1.EnPassant

Enjoy!

Semper Fi,
Gunny Mike

Thursday, April 20, 2017

Gunny Meets Uncle Bob - Part 1

The last few days have been very interesting. It started when my friend Jon Aasenden posted a link to a you tube video called "SOLID Principles of Object Oriented & Agile Design" by some guy named Uncle Bob. This wasn't the first time I heard about Uncle Bob. Nick Hodges made a reference to something called SOLID in his book which is supposedly Uncle Bob's principles of object oriented design.

I bought Nick Hodges book "Coding in Delphi" over two years ago. I actually bought two copies. My first purchase was the printed edition. I went back and purchased the pdf version a couple months later after I decided I didn't want to type the examples if I could cut and paste them.

Anyway, I made it to page 28 and no further. I had a mental block about something and never worked through it. It's been sitting on my bookshelf unopened for over two years. It's amazing how fast time goes by. I have since learned that Nick has two more books. "More Coding in Delphi" and "dependency injection in delphi".

So after watching the Uncle Bob's video I decided to buy three of his books; "Clean Code", "The Clean Coder" and the yet to be released "The Clean Architecture".

I came home from work yesterday and "The Clean Coder" had been delivered. I was so excited. I couldn't wait to read Chapter 1.

BOOM!

I haven't felt this inadequate in a long time. Thank you Robert "Uncle Bob" Martin. In less than twenty pages you humbled this US Marine.

I went on Facebook and whined about how inadequate Martin made me feel. To my surprise a couple of highly respected friends mentioned they too had felt the same way after reading his stuff.  That was a little comforting but I still felt like crap.

According to Martin I'm supposed to give my employer 40 hours a week and then spend another 20 hours a week on my career. Learning, reading, practicing.

I'm also supposed to understand and describe the 24 patterns in the Gang of Four (GOF) book plus have a working knowledge of many of the patterns in the POSA books.

I scrambled around and googled for the 24 GOF patterns. Found a clean, concise 8-10 page pdf. Read it real quick. Check - That's done. I'll do the POSA stuff tomorrow. It's late. I'm tired. I'm going to bed.

Day Two:

I woke up this morning a little early because I had to pee. I came back to bed and tried to fall back to sleep. But I couldn't get Martin and what he said out of my head. I kept thinking, "I haven't got time for all this crap, I need to learn Dependency Injection. That's what started this whole thing anyway."

Then it hit me.

I started thinking about chess, and how Jimmy O'hara used to kick my ass every time we played chess back when we were both twelve years old. That was forty-six years ago. He'd take my queen within the first four to five minutes. Oh did I get pissed when that happened. I now had to play without my strongest piece.

Then I thought. Wow, chess was a really complicated game. It took a long time to learn how to move them 16 different pieces around. Wait a minute there aren't really 16 different pieces there are only 6 different pieces. I spent a lot of time learning how those 6 pieces moved.

Then it dawned on me.

If I want to be good at my craft I have to identify the chess pieces of my craft and learn how to move them. Wait a minute. Didn't Martin just tell me last night that I need to understand the 24 GOF patterns. He did. Aren't those the chess pieces of my craft? They are.

How can I expect to be good at my craft if I only give a casual glance at the chess pieces I need to use in my craft. I can't. Bingo.

Then it hit me again.

What about the POSA books and those designs?

I like to play golf. I started playing golf when I was twelve. Yup forty-six years ago. Learning golf was hard and it took a long time to get good at it and to learn how to use of each club. Hey wait a minute. I see a pattern here. Why can't I treat the patterns in the POSA books like golf clubs. If I want to be good at my craft I have to learn what each club does and how and when to use each one of them.

But wait there more. What about SOLID? Hey Gunny, how do you reconcile SOLID like you did using chess for GOF and golf for POSA?

JJDIDTIEBUCKLE The twelve leadership traits.

I spent twenty years in the Marine Corps. It's all about leadership and leadership traits. I lived, breathed, taught, and honed those twelve traits. I need to do the same thing with SOLID.

This works for me. You need to find a way to make it work for you.

Gang of Four Patterns = Chess
POSA Patterns = Golf
SOLID = JJDIDTIEBUCKLE

This journey I'm taking with Uncle Bob is not in the least a passive journey. If I want to fully embrace my craft (software development) I need to dedicate myself to it the same way I did for chess, golf, and leadership within the Marine Corps.

Time to strap it on.

Enjoy!

Semper Fi,
Gunny Mike








Saturday, August 24, 2013

The One Manual Every Delphi Programmer Should Have!


I have always stayed away from using Delphi's DBGrid because it gave me the feeling of being in the cockpit of an airplane without a clue, as to what all the controls are, or even where to look first. I've decided to roll up my sleeves and get over my fear and anxiety of Delphi's DBGrid.

I'm currently using XE4 and I've been struggling with data validation within a DBGrid as you can see from a recent SO post How to get the value that caused the TDBGridInplaceEdit error?

After reading the answer I got from @bummi, I started googling related topics. Then I remembered I have a copy of Borland's Delphi 7 Developer's Guide.


Delphi 7 Developer's Guide

I quickly turned to Chapter 25 and found all the information I need to know, written in a friendly and very informative way. It's perfect. Each topic builds upon the previous topic giving a full treatment of the subject matter. Here is the table of contents for Chapter 25 of Borland's Delphi 7 Developer Guide:

Chapter 25Page
Working with field components 25-1
Dynamic field components 25-2
Persistent field components 25-3
    Creating persistent fields 25-4
    Arranging persistent fields 25-5
    Defining new persistent fields 25-5
        Defining a data field 25-6
        Defining a calculated field 25-7
        Programming a calculated field 25-8
        Defining a lookup field 25-9
        Defining an aggregate field 25-10
    Deleting persistent field components 25-11
    Setting persistent field properties and events 25-11
        Setting display and edit properties at design time 25-11
        Setting field component properties at runtime 25-13
        Creating attribute sets for field components 25-13
        Associating attribute sets with field components 25-14
        Removing attribute associations 25-14
        Controlling and masking user input 25-15
        Using default formatting for numeric, date, and time fields 25-15
        Handling events 25-16
Working with field component methods at runtime 25-17
Displaying, converting, and accessing field values 25-18
    Displaying field component values in standard controls 25-18
    Converting field values 25-19
    Accessing field values with the default dataset property 25-20
    Accessing field values with a dataset’s Fields property 25-21
    Accessing field values with a dataset’s FieldByName method 25-21
Setting a default value for a field 25-22
Working with constraints 25-22
    Creating a custom constraint 25-22
    Using server constraints 25-23
Using object fields 25-23
    Displaying ADT and array fields 25-24
    Working with ADT fields 25-25
        Using persistent field components 25-25
        Using the dataset’s FieldByName method 25-25
        Using the dateset’s FieldValues property 25-25
        Using the ADT field’s FieldValues property 25-26
        Using the ADT field’s Fields property 25-26
    Working with array fields 25-26
        Using persistent fields 25-26
        Using the array field’s FieldValues property 25-27
        Using the array field’s Fields property 25-27
    Working with dataset fields 25-27
        Displaying dataset fields 25-27
        Accessing data in a nested dataset 25-28
    Working with reference fields 25-28
        Displaying reference fields 25-28
        Accessing data in a reference field 25-29

I've already printed out Chapter 25 and plan to study it this weekend. The manual is 1,106 pages long. I plan on printing the chapters I need as I go. And yes I did buy paper that's already punched with 3-holes.

I don't care what version of Delphi you are using this manual is relevant and will make your life easier. Download your copy of Borland's Delphi 7 Developer Guide now!

If we could only get EMBT to create an updated version of this Delphi classic!

Semper Fi,
Gunny Mike
end.