Maybe every Delphi Developer in the world already knows about GExperts. Maybe there are a few that don't. I'd like to point out a few things that I find make GExperts worth having around. Most Delphi users probably know it exists, and know it's open source, and that it's awesome. Oh you didn't know that? Well then, you're the person that I wrote this blog post for.
But first, I must tell a side-story.
A job or two back in my long and glorious employment history, I worked beside a very smart Delphi guy which we'll call Dave. He had his own cool plugin for Delphi that had its own special File Open mode. After working with it for about 2 days, I was hooked on one feature. I had the keyboard shortcut Ctrl+Shift+O hard wired in my brain to a dialog box in his expert that would open a search window that let me search for any unit in the library path, current project, or current project's search folders. Dave was a smart guy, and a really highly effective Delphi developer. He had become quite used to a now defunct IDE add-on for Delphi called CodeRush. There is still a Visual Studio plugin by that name, but the Delphi version of CodeRush is now only a fond memory for those of us who left behind Delphi 7 for good. Delphi 7 was the last version of Delphi that could accept CodeRush. Anyways, Dave learned enough about the open tools api (OTAPI) and got busy building the productivity enhancements he needed. Kudos to Dave.
Anyways, there were a million things in that plugin but there was only one thing in it that I got so addicted to that I couldn't live without it, once I got used to working that way. It was an efficient file-find and open dialog.
If I knew a unit's name, or the first few characters of it, I would simply do the following:
Muscle Memory and Keyboard Shortcuts
One of Dave's mantras, and it was a good mantra, was that learning keyboard shortcuts increased your productivity. Most of his wizard's features were designed to be used by keyboard shortcut. I have found that this principle has been true for me too; If I learn a keyboard shortcut well enough to use it without thinking, it will increase my productivity. Any menial task that could be done by an Expert (an IDE plugin) when I hit a hotkey, can save me minutes, or even hours of time, that I should be spending solving problems, or making new features on the products I'm paid to work on.
GExperts has the ability to uncheck features you don't want, so disable every feature except the Open Dialog feature, or unmap all the other hotkeys anyways, and then add one hotkey at a time. I think that opening files is something you are always going to be doing, every day you work with delphi, and unless you are already happy with the F6 feature (IDE Insight) in Delphi XE or later, you need GExperts, even for just this feature. Note that if you still have to support projects in Delphi 7 or 2007, GExperts works in those old versions, as well as in the latest versions, all the way up to Delphi XE5.
If you write code in Delphi for a significant portion of your day, then I urge you to experiment with the available options for fast finding and opening of units in your project. At least start using F6 (IDE INSIGHT) if you're not using it, on Delphi versions that support it. If you find it isn't just right, then try GExperts.
Note to XE5 users: XE5 binaries have NOT been relerased, but a pre-release Alpha (unstable) build by Yours Truly is available to download here. If it has bugs, I suggest you fix them yourself, and contribute back to the GExperts project.
But first, I must tell a side-story.
A job or two back in my long and glorious employment history, I worked beside a very smart Delphi guy which we'll call Dave. He had his own cool plugin for Delphi that had its own special File Open mode. After working with it for about 2 days, I was hooked on one feature. I had the keyboard shortcut Ctrl+Shift+O hard wired in my brain to a dialog box in his expert that would open a search window that let me search for any unit in the library path, current project, or current project's search folders. Dave was a smart guy, and a really highly effective Delphi developer. He had become quite used to a now defunct IDE add-on for Delphi called CodeRush. There is still a Visual Studio plugin by that name, but the Delphi version of CodeRush is now only a fond memory for those of us who left behind Delphi 7 for good. Delphi 7 was the last version of Delphi that could accept CodeRush. Anyways, Dave learned enough about the open tools api (OTAPI) and got busy building the productivity enhancements he needed. Kudos to Dave.
Anyways, there were a million things in that plugin but there was only one thing in it that I got so addicted to that I couldn't live without it, once I got used to working that way. It was an efficient file-find and open dialog.
If I knew a unit's name, or the first few characters of it, I would simply do the following:
- Hit Ctrl+Shift+O
- Type the beginning of the unit name, like uWarehouse, and press enter.
- If there was a uWarehouseObjects.pas in my project or somewhere in the search paths (library or project settings), it would now be open and I would already be editing it, instead of thinking about it.
After I no longer worked there, I was bereft. So I downloaded CNPack (which will be the focus of Part 2 of the Experts and IDE Plugins I love) and tried its Open dialog boxes. It has a few wizards that have overlapping and slightly different takes on this concept, but none of them worked as well as the in-house one I was used to. Then I download GExperts, which is open source, figuring that if it wasn't QUITE what I wanted, I could always quickly hack a bit on it, and make it what I wanted.
Why don't I just use the IDE Insight feature? Three reasons. One, I still do a lot of work in Delphi 2007, which lacks IDE Insight. Two, IDE Insight finds things that are not files, and this throws off the Emperor's Groove. Do not -- I repeat do not -- throw off the Emperor's Groove. Three, because the Ctrl+Shift+O pattern is hard-wired into my brain now.
Why don't I just use the IDE Insight feature? Three reasons. One, I still do a lot of work in Delphi 2007, which lacks IDE Insight. Two, IDE Insight finds things that are not files, and this throws off the Emperor's Groove. Do not -- I repeat do not -- throw off the Emperor's Groove. Three, because the Ctrl+Shift+O pattern is hard-wired into my brain now.
These days, I can not live without GExperts installed in Delphi, and Ctrl+Shift+O mapped to the GExperts open window which has a search box at the top and a series of tabs: (click to see a larger image)
Now Dave's in-house file-open wizard was actually easier to use at first, in my opinion because it didn't split the Project units and the units found in the search path or the VCL source folder out into their own tabs. However, once I got used to this divided approach, I decided NOT to hack GExperts to merge the tabs above. If I do hack it, I think I would actually populate a VirtualTreeView with categories I could expand and contract and then have some registry preferences to remember which sections are expanded or collapsed. I chose the above examples because the word MAIN is not even the beginning of the unit name, it just appears somewhere in the unit name.
Since for 99% of my use, I only want files from the project, I just work in the Project tab 99% of the time these days, and the odd time or two I may flip over to the Search Path. I also use the Favorite tab to bookmark units, and then return to those bookmarked units. Imagine you're fixing Bug # 1234, and it's involving a set of units that you have to flip between a lot. With all the other tabs that get open in the Delphi editor tabs, sometimes it helps to just Close All Tabs after you save all, and then, when you need a tab again, just use Ctrl+Alt+O (or whatever keyboard shortcut you choose) and go to the favorites tab, which is only a few clicks. I use this as an alternative to what Java/Eclipse or XCode programmers would achieve using the project-manager views in their IDEs, which let you move and organize "virtual folders" freely in your project or workspace, folders that have NO relationship to the real physical source code organization on the disk.
One feature that I probably will hack into the GExperts open dialog is the ability to open a form by its Caption instead of by its unit name. Many units in the code I work in may have started out in TurboPascal for DOS with its cryptic 8 character limits on filenames. If you can't remember that ECL.pas is the Accounts Receivable main form, because some guy decided to call it ECL, for no reason you can figure out, you'd probably like such a feature too.
One feature that I probably will hack into the GExperts open dialog is the ability to open a form by its Caption instead of by its unit name. Many units in the code I work in may have started out in TurboPascal for DOS with its cryptic 8 character limits on filenames. If you can't remember that ECL.pas is the Accounts Receivable main form, because some guy decided to call it ECL, for no reason you can figure out, you'd probably like such a feature too.
Muscle Memory and Keyboard Shortcuts
One of Dave's mantras, and it was a good mantra, was that learning keyboard shortcuts increased your productivity. Most of his wizard's features were designed to be used by keyboard shortcut. I have found that this principle has been true for me too; If I learn a keyboard shortcut well enough to use it without thinking, it will increase my productivity. Any menial task that could be done by an Expert (an IDE plugin) when I hit a hotkey, can save me minutes, or even hours of time, that I should be spending solving problems, or making new features on the products I'm paid to work on.
Other stuff I use in GExperts:
i. Components to Code. Copy a complete component or selected set of components, and have GExperts write the code you would need to instantiate these components from a .pas unit without any .dfm. This can be a fantastic way to start out the job of creating a Composite Control which takes several VCL Controls and makes a nice reusable new control that groups several individual controls, such as your own Date Time Picker or something like that.
ii. If you ever spent time manually aligning elements in your code, like assignments on multiple lines,
because you hate leaving them ragged, then GExperts will get you back on your way and writing the code your Boss is really paying you to write, and not wasting your time on Whitespace. Ctrl-Alt-Z is the
alignment editor feature in GExperts, here's one of the many little jobs it does for you. In this example, two lines of text, you would hardly need this feature, but imagine you wanted to do this in a 30 line or 50 line
block of record field assignments.
There are literally thousands of little features, and twenty or thirty major features in GExperts, but I would like to advance the idea that if you try to use all of them, you'll go crazy. Just find one that you need, and use it, and if it improves your productivity, add another tool from GExperts, when you need it.
GExperts has the ability to uncheck features you don't want, so disable every feature except the Open Dialog feature, or unmap all the other hotkeys anyways, and then add one hotkey at a time. I think that opening files is something you are always going to be doing, every day you work with delphi, and unless you are already happy with the F6 feature (IDE Insight) in Delphi XE or later, you need GExperts, even for just this feature. Note that if you still have to support projects in Delphi 7 or 2007, GExperts works in those old versions, as well as in the latest versions, all the way up to Delphi XE5.
In part 2 and 3 of this series I plan to cover the other wizards that I can't live without, and in part 4, I will briefly mention some of the IDE Plugins that I do not use, but which are out there, and you should know about, in case you need the features they provide.
Part 2: CNPack, the Chinese Delphi Developer's Wizard project. (Open Source), which I also only use less than 10% of.
Part 3: Model Maker Code Explorer (Commercial) , a commercial plugin I absolutely adore. I will discuss why I think most, if not all Delphi developers would benefit from using it.
Part 4: A brief overview of Castalia, which I do not use, and do not own, but which I have tried a few times. Many many Delphi developers seem to like it, so I'll cover it.
If there is any interest in the matter, I'll write a Part 5, which is a brief tutorial on starting your own tiny IDE wizard, and how to get started either modifying the GExperts wizards, or writing your own wizard, including an introduction to the OpenToolsApi (OTAPI). I'm nowhere near as good at that as "Dave" the guy I used to work with, but then, few people are.
If you write code in Delphi for a significant portion of your day, then I urge you to experiment with the available options for fast finding and opening of units in your project. At least start using F6 (IDE INSIGHT) if you're not using it, on Delphi versions that support it. If you find it isn't just right, then try GExperts.
Note to XE5 users: XE5 binaries have NOT been relerased, but a pre-release Alpha (unstable) build by Yours Truly is available to download here. If it has bugs, I suggest you fix them yourself, and contribute back to the GExperts project.