Eliminating Friction

Want to write better code?  Eliminate friction around best practices.


Best Practice: Error Logging

DON'T write custom error logging on an as-needed basis.

DO use a global error handler and vbWatchdog to centralize error logging.


Best Practice: Throwing Custom Errors

DON'T maintain some huge master list of custom error numbers.

DO automatically generate unique custom error numbers on the fly.


Best Practice: Version Control

DON'T manually export and import VBA code to text files.

DO use a script or add-in to convert all Access objects to text files.


Best Practice: Don't Repeat Yourself

DON'T copy and paste code snippets from one application to another.

DO maintain a library of code that never breaks backward compatibility.


Best Practice: Professional Installers

DON'T use a wizard-based product with lots of manual steps.

DO use a text/script-based installer creator like Inno Setup.


Investing in the Future

What do all of these things have in common?

In almost all cases, there is a relatively significant upfront investment of time to accomplish the task for the first time.  For example, it probably took me a dozen or more hours to create my first installer in Inno Setup.  Now, though, I can create an extremely professional installer for a new application in under five minutes.

A professional installer in less than five minutes? Now that is low-friction.

Before I switched to using Inno Setup, I used a wizard-based Microsoft product.  It was impossible to recreate installers.  Every installer was a little different than the last one, and there was no easy way to tell how one installer was different from another (do I need Setup-v3.exe or Setup-Final.exe or Setup-Final-New.exe?).

The Microsoft installer was faster the first time.  

But Inno Setup was faster over time.

Moral of the Story

If you want to do things The Right Way™, then invest time upfront to develop a low-friction approach that you can use forever.  

Make it so The Right Way is also The Easy Way.


Referenced articles

Error Handling Evolution
How you handle errors says a lot about you as a programmer. Most people evolve with experience in how they handle errors. From the most naïve to the most advanced, here is what that evolution looks like.
Throwing Errors in VBA
Introducing a frictionless alternative to Err.Raise.
Putting It All Together
I expanded on the original decompose.vbs script. The code below is the culmination of more than 50 individual changes and tweaks over 10+ years.
A Quick, Free Way to Try Version Control with Microsoft Access
Curious about getting started with version control in Microsoft Access, but don’t want to commit a lot of time or money? This could be just the solution for you.
Building Your Library
Thirteen years ago, I chose to maintain a folder of text files rather than a single Access database library. I’ve never once regretted that decision.
Installing and Updating Access Applications
Want to be a professional Access developer? Then you can’t ask your clients to copy and paste .accdb files to their computers. What do you do instead?

Image by Marie Sjödin from Pixabay