Tuesday, October 29, 2013

Delphi Experts and IDE Plugins I Love Part 3: Model Maker Code Explorer

ModelMaker Code Explorer is one of two Delphi add-ons that is commercial that I usually buy, the other is MadExcept.   In part four, I will try Castalia, which has a loyal following as well.  But given the choice between the two, I like ModelMaker Code Explorer.



The main things I like about it are:


  • It has the best Class Browser and navigation and structure-view features of any Delphi IDE plugin.  Some of the features that I came to love in Xcode, which are also in GExperts but in less complete fashion, are built into the class browser and navigation features of MMX.
  • One feature that I use all the time is the Uses Clause formatter.  I like my uses-clauses one-per-line because it decreases the incidence of merge conflicts when people just insert units into the middle of complex uses-clause declarations.  It's also useful for when you group your units into sections, as I often do.    Once I have grouped dependencies, the structure of my system becomes clearer.  This is a precursor to making the design simpler, or easier to test, or otherwise better.  Perhaps if your uses clause takes up 300 lines of code, it might help you realize you're building a big ball of mud and that you should start cleaning it up, instead of making it worse every day you work on the code.
before

after (MMX + some manual work)


  • Another is a feature under "Text Tools", that will take something you paste from the clipboard and format it as a multi line string literal. For example, I often use it to take SQL that I wrote in SQL Management Studio and paste it into a .pas unit, as a multi-line string literal. Because Delphi lacks and easy "here-document" syntax (like the triple-quote syntax of Python), this is a considerable time-saver.
  • It contains a lot of good refactoring features that the base IDE cannot do, but I actually hardly use any of these. Instead, I find the "live metrics" and other "analysis" features, which shows "stuff which needs fixing or attention" is far more useful. I tend to leave a lot of TODO items around, and while Delphi contains a TODO feature, having that panel open is a waste of space. But having one panel with a comprehensive list of areas that need attention is much more useful to me.   "Metrics" is a poor name choice, in my opinion, it's more of a "Lint" feature.  Lint is a term from the C programming world that means "additional style warnings", that can help you find problems.  While nowhere near as comprehensive as the features in Pascal Analyzer, MMX's "Metrics" features are like a second level of live hints and warnings. Since the live hints and warnings in Delphi often misbehave, I often leave "Error Insight" turned off in Delphi and use MMX instead.  The Event Handler Analysis feature has found dead code for me, and event handlers which have become "unhooked" due to accidental editing, which is a bug that RAD tools like Delphi are vulnerable to.   Delphi is far behind Xcode, Visual Studio, and most Java IDEs in its Lint/Hint/Warning features, but tools like MMX really help bring it up to speed.


  • I have learned a lot from reorganizing my large classes. For example, sorting the methods and properties in a mega-class, is often a good precursor to breaking up the class into a series of smaller, much better designed classes.  Having all the methods that start with "open" sorted beside each other, for example, might lead me to consider that having five methods named "openThis", "openThat", and "openTheOther" leads me to wonder why I have another method called "makeViewForSomething".  maybe I should rename that to "openSomething", since it would make more obvious sense than what I had before. What was I thinking when I called that "makeViewForSomething"?  Or if there was some reason why "makeView" was a better name, maybe all the "open" methods should have been "makeView" methods.   Thinking about whether or not the stuff in your method names makes sense, and is consistent or inconsistent is made easier, when you organize your classes and units.
Like many Delphi add-ons and tools, this one also has a free trial.  I highly recommend you download it and try it.  Perhaps the best feature of MMX, is that the guy who makes it, Gerrit Beuze, provides top-tier technical support for his products. If you find a bug, he'll generally fix it pretty fast.  I've been completely impressed with how he handles support and bug fixes.   A wonderful product, something I find it hard to live without now.


5 comments:

  1. I haven't tried out MMX as yet - although I think I will now (have used Castalia, GExperts, and CnPack)

    ReplyDelete
    Replies
    1. Alister, I would not willingly work without MMX at this point. Excellent tool, and a lifesaver when approaching legacy code.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Huge problem, no version for Visual Studio 2013. Is there any addon for VS2013 similar to MMX ?

    ReplyDelete
  4. Having used ModelMaker CodeExplorer, I can only second your recommendation. It is rock stable and during two years of use, it has not once caused any problems with the IDE.

    ReplyDelete