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.
Great post. Hadn't appreciated how clever the Components to Code is.
ReplyDeleteI've never used the Alignment feature either.
But the three I'd be lost without:
Ctrl-G to get a list of methods in the current unit
Rename Components - when you drop a new component down, it prefixes it with an appropriate label and allows you to set properties, eg. a blank caption for a panel
Ctrl-Alt-Up and Ctrl-Alt-Down to find the next instance of an identifier in a unit or method
Great post, thank you. My experience with plugins is similar, and I see keyboard shortcuts the same way, and the only feature I miss badly is a "shortcut central" where I could define in a centralized manner which shortcut is assigned to what item, no matter if IDE, GExperts, MMX, or CnPack.
ReplyDeleteI've been meaning to cover cnPack in a video for quite some time, I find it really handy in so many ways. I also have GExperts installed, but can survive without it.
ReplyDeleteI use the Grep Search a lot in GExperts.
ReplyDeleteI've tried a lot of IDE experts, however I still miss the following a feature:
A Search feature with an incremental search (inside words, not only at word start) of all members of all classes in all units in the RTL/Search Path. Does anybody know one?
Have used GExperts since at least D7. I routinely use the experimental code formatter. I know I do not scratch the surface of what GExperts can do, but for the things I do use, it is among the first add-ins I install in a new setup.
ReplyDeleteCnPack is another I cannot live without. Originally attracted to it for the code structure highlighting. Also routinely use the jump to interface declaration.
MMX is also on my list of essential plug-ins. I use it for refactoring, and for sorting classes which I have inherited out of order.
If I had to rank in order of need:
1: CnPack
2: MMX
3: GExperts
4: Documentation Insight (yeah, this should also be on your list)
I'll cover DocInsight when I cover Castalia, which are two I don't use much. I like the IDEA of DocInsight, I just haven't really started using it at all.
ReplyDeleteI used to use Castalia, but it was a few years ago, and there were issues which I no longer remember clearly. One of the great features it had was code structure highlighting, which as I recall, was tangled up in the issues I had with it. It does look interesting, but I'm not sure I would buy it again, given the feature overlap in some of these packages.
DeleteI'm a user of all the items on your intended list, save for Documentation Insight. Big Modelmaker Code Explorer fan too, but skipped the last two versions since I am still in a D7 universe and most of the stuff being added today seems Rad-centric. That said, the support I got from Gerrit Beuze in the Modelmaker newsgroup was (and still is) first-rate. A pleasure to work with. The same goes with Jacob Thurman over at Castalia's head offices at TwoDesk Software. In both cases, I did at least one upgrade simply because I wanted to continue to support the cause. As far as hotkeys are concerned, I spent most of the the SHIFT-CTRL-ALT set on Modelmaker CEX functions and CTRL-ALT's on Castalia. The GExperts and CNPack stuff is mostly from the menus or from buttons added to my IDE. And fussing around with the IDE spread across three monitors now occupies more time than the NFL season does. But it's my equivalent of worry beads. Fun AND productive.
ReplyDeleteAnd despite my positive statements about Castalia, I also weep for what was CodeRush. I got started that in its Archaeopteryx(sp?) origins and the slide of Delphi into niche status started the day when CodeRush development for Delphi was no more.
But enough whining. Between GExperts, CNWizards, ModelMaker Code Explorer and Castalia, even I can turn out passable code in decent enough time to keep my customers happy.
I use Unit Expert from http://www.epocalipse.com/downloads.htm. It is free and faster than GExpert Open file dialog. I am hooked to it's shortcut - CTRL + U for "Find unit" and ALT + F11 for "Add unit".
ReplyDeleteSimeon: It's free but it is not open source, and there is no up to date version for Delphi 2010, through XE5. It looks like that product is dead.
ReplyDelete