Tuesday, May 31, 2011

Find Text in Delphi - Evolution of a Feature

Every application goes through evolution, where a feature is completely rewritten to be better.

Understanding how a given Feature is used is important before undertaking the rewrite, to know how your going to impact your user base.  

The case I am going to point out today is the difference between the Delphi 2007 and XE find text mechanism.    The XE version changes are frustrating at best.    Do see what I am talking about
do the following in both IDE's.
  • File| New VCL Application
  • File| New Form  (So you have two blank forms open)
  • Navigate to the code of one of the forms
  • Ctrl-Home (Move to top of unit)
  • Ctrl-F  (Delphi 2007 Dialog - Delphi XE it's at the bottom)
  • Enter "Form" as the search word 
  • Press Enter (First Match is found in uses)
  • Press F3 (Second Match Found)
  • Press Ctrl-Home (Go back to top of document)
  • Steps change from here on out....
  • Delphi 2007
    • Press F3 (Finds First Match Again)
    • Change to second unit's source code
    • Ctrl-Home
    • Press F3 (Finds First Match in 2nd Unit)
  • Delphi XE
    • Press F3 (Nothing happens, Argh the search window says "Form" nothing is found. QC: 80696)
    • Ctrl-F  ( Text changes to "Unit" QC: 92388)
    • Retype : "Form" 
    • Press Enter
    • Change to second unit's source code
    • Ctrl-Home
    • Press F3 (Nothing happens , Argh.   Note: The search window at bottom is not visible)
    • Ctrl-F ( Text shows "Unit" )
    • Retype : "Form" 
    • Press Enter (Finds First Match in 2nd Unit)
Update:  If I restart Delphi and the Press F3 and nothing happens step works.    Something is causing it to break just don't know what it is.

It's also bad if you search on a term don't find it and want to use the Find in Files functionality.   But, I think  I made my point with the steps above.

I have heard the arguments about the new find method being better.    Personally I could care less if it's a dialog or at the bottom of the form.    The new method is even entered it as bug in QC: 80695

What I do care about, is that the functionality works for me and not against me.    

So as evolution occurs in your application, take a moment to realize the use case scenario of the existing functionality.   That way you impact your users for the better and not for the worse.


8 comments:

  1. When I first tried the new-style find bar in the D2010 trial, I hated it, but the main bugs for me were fixed in XE - in particular, your 'Press F3 (Nothing happens, Argh)' doesn't happen for me at either of the points it does for you (i.e., I get the D2007 behaviour). I run Delphi using an 'undocked' layout, if that makes any difference.

    ReplyDelete
  2. Actually I very much like the new search bar but I hate find dialogs popping right into your face.
    Also like Chris I cannot reproduce your behaviour (SP1, GExperts, DDevExtensions, IDEFixPack4.1)

    ReplyDelete
  3. I can reproduce at will. XE -Update 1, GExperts, and CnPack.

    ReplyDelete
  4. Restarted Delphi and it works... Something is causing F3 to break.

    ReplyDelete
  5. This happened to me often until I found a solution. My guess is that Delphi's internal search conflicts with CnPack. Try to uncheck "F3/Shift+F3 to search select text" and "Let IDE remember F3/Shift+F3 search text" options in CnPack which can be found under Editor Enhancements group -> Others tab. That worked for me.

    ReplyDelete
  6. @liquidspehere: Thanks, I had that checked. I could see this being the cause of this. Since, I see the problem almost every day. I will code for few days to see if it comes back.

    ReplyDelete
  7. I removed cnPack long ago because it always caused trouble and I don't miss anything from it. Either GExperts, DDevExtensions or Delphi itself (open file in explorer for example finally!) have it. Personally I don't recommend it. Same with Castalia. Just my 2cc.

    ReplyDelete