I <3 Steve McConnell*
Coding Horror
programming and human factors
by Jeff Atwood

October 31, 2005

Search: If It Isn't Incremental, It's Excremental

After I discovered the CTRL+I incremental search function in Visual Studio, I never used the standard find dialog again. Incremental search is so good that it makes traditional search dialogs completely obsolete. If you think that's hyperbole, consider that Chris Sells calls incremental search "pure sex".

This particular find dialog is from Notepad, but it's the basically the same find dialog that appears in every Windows application:

Standard search in Microsoft Notepad

The delimited search dialog has a lot of problems:

  • It's a dialog. A dialog right smack dab in the middle of the text, potentially obscuring what you're searching for. In some apps it's even modal!
  • It provides very little feedback. There's no indication whether your search term matches anything until you type the complete search term and press return or click Find.
  • It's an all-or-nothing operation. Once you initiate a search, you're committed until the search completes. If you just mistyped a search term in a 5 megabyte text file, have fun waiting for that to complete.
  • It forces you to think about directionality. If your cursor happens to be near the bottom of the file, you may not find any matches even though some exist at the top of the file. And you get nagged with yet another "no matches found" dialog.

Jef Raskin, in his book The Human Interface, has some choice words for the delimited search dialog:

This traditional method is rather punishing to the user, although most computer aficionados have become so accustomed to it that they no longer feel the pain.

Now compare that Notepad search dialog with the incremental search in Firefox:

Incremental search in Firefox

The advantages of incremental search are numerous:

  • There aren't any dialogs in your way. The search interface is blissfully dialog-less. There's nothing getting in the way of you and your search results. You can search, find, and resume working with minimal interruption. This is arguably handled even better in Visual Studio, where the interactive search indicator is a cursor change after you press CTRL+I.
  • It wastes less of your time. The search begins as soon as the first character is typed. You know immediately when you've got a good enough match and you can stop typing.
  • Mistakes are clearly evident. If you mistype something, you'll know that immediately, too. Press backspace to correct the typo and you're back to the previous match.
  • It's interactive. Immediate search feedback alows you to adjust your search strategy in real time. The net result is far better searches than you'd ever get from a traditional OK-then-try-again dialog box cycle.

After you've worked with incremental search for a few hours, you'll probably wonder why incremental search isn't included as a standard feature in every single Windows application. As Jef Raskin notes:

From the point of view of interface engineering, the advantages of incremental searches are so numerous and the advantages of delimited search so few that I can see almost no occasions when a delimited search would be preferred.

Jef also adds an amusing footnote to that sentence: If it isn't incremental, it's excremental. Amen, brother. I can barely stand to use editors without an incremental search mode any more. I'm so glad that (after a little prodding on my part) the latest betas of EditPad Pro 6 include this feature.

Posted by Jeff Atwood    View blog reactions

 

« Improving the Clipboard GotDotNet: still sucking after all these years »

 

Comments

Thanks for the tip for Visual Studio. I recently experimentally switched to Firefox (I was using NetCaptor, one of the pioneer multi-browsers on the market that wraps IE) PRIMARILY because of the excellent search functionality. I didn't know this kind of "modeless" search had a name, but it is by far the coolest way to search.

Drazen Dotlic on November 1, 2005 03:55 AM

Spot on post.

Of course, the default search mode in Emacs is incremental, and has been for some time :-)

Gustaf Erikson on November 1, 2005 05:46 AM

This is a prime case of MS needing to re-visit existing MS user interface standards.

Mind you the MS office team seems to have taken a long hard look at tradtional office interface wisdom.
I hope the Vista core tools folks do the same.

Peter Bridger on November 1, 2005 07:30 AM

For Visual Studio searching, I also like the mztools search (a 3rd party addin), which presents all the search results in a list (broken down by class and method). You can then clcik each one to go to that result in a code window.

Also has a Find Procedure Callers which does exactly what it says and is super useful.

Simon on November 1, 2005 09:10 AM

Conventional search is handy when searching through multiple files; incremental search in VS.NET seems to be limited to the current file. Also, sometimes it is handy to see a complete list of all the matches, not just the first one, and in that case Visual Studio handles it just right: you get a list of all the matches and clicking on one jumps you to that match. But most apps do this brainlessly and just show you the first one and then you have to keep clicking ok to see the next ones.

Josh on November 1, 2005 10:17 AM

For reasons unknown to me, my VS.net 2003 maps 'incremental search' to Ctrl+Alt+I, not Ctrl+I.

Also - little tip for ya - pressing Ctrl+Alt+Shift+I does a 'reverse incremental search' (or should that be a 'decremental search'? ;)

Andy on November 1, 2005 11:04 AM

On the Firefox downside: the previous search facility could find text in textareas, the incremental search cannot. That's a major bummer when you edit wiki pages :/

Consider that the Firefox incremental search isn't even as feature complete as the age-old one in Emacs: when you enter the string in Emacs, not only do you see your current match, you see all other matches highlighted (in a different color) below and above as well.

This is often _very_ useful if it's a variable or somesuch, and you get a kind of a "preview" if the match wasn't exactly what you thought you looked for. Or if you're browsing a log file where all lines look the same.

And, here's another little UI gem from Emacs' incremental search: when you have started the search, press Alt-w to expand the search string to the current word. Alt-w again to expand the search to the next word, etc.


/J

Johan Lindström on November 1, 2005 11:17 AM

The one complaint I have about Firefox's implementation of incremental search is that when I hit CTRL+F5 the first time, I didn't even notice it. I couldn't find the search because it's docked at the bottom in the same color as the status bar. Even now, I get confused as I switch between apps.

I'd prefer it to be on top and in a different color. Perhaps with an option to display a list of matches. But all modeless!

Haacked on November 1, 2005 12:23 PM

> the previous search facility could find text in textareas, the incremental search cannot. That's a major bummer when you edit wiki pages :/

Indeed, I've run into this as well when editing posts for this blog :P

> which presents all the search results in a list (broken down by class and method). You can then clcik each one to go to that result in a code window

Doesn't CTRL+SHIFT+F, then F8 already do this?

Jeff Atwood on November 1, 2005 12:27 PM

Johan,
Firefox will highlight other matching terms if you click the "highlight" button on the search toolbar. It highlights text in edit boxes, too, although the "next" and "previous" buttons won't select text in edit boxes.

For any Delphi users reading this, its incremental search command is Ctrl+E.

Rob Kennedy on November 1, 2005 12:38 PM

> I'd prefer it to be on top and in a different color.

Perhaps you want an IE style "yellow bar"?

http://www.codinghorror.com/blog/archives/000019.html

The IE team gets no love for the one innovation they introduced that Firefox cloned almost instantly.

Jeff Atwood on November 1, 2005 01:09 PM

Interestingly, and typical of its heavyweight, 'belt-and-suspenders' design, the current version of Opera has both a dialog search and and incremental search toolbar. Unfortunately, the default binding for ctrl-F is for the dialog search, but the fact that it has the incremental search is quite appealling. Now if only the browser were more stable under heavy loads...

Joseph Osako on November 1, 2005 01:21 PM

incrememental search has been around for a long time - I'm happy that it's finally found it's way into visual studio.

Vim users have been using it forever. I've been bitching about the standard ctrl+f 'find' dialog for two years - but no one has been willing to venture outside of their IDE for long enough to discover it.

the fact that (as Jef Raskin stated) so many "computer aficionados have become so accustomed to it that they no longer feel the pain" ... is, in my opinion, a contributing factor to the intellectual stalemate faced by the software industry.

brad on November 1, 2005 03:33 PM

oh my. this was built into Progress 4GL as long ago as 1989, when i first started using it.

Buggy Fun Bunny on November 1, 2005 07:17 PM

try F3 !
it works in FF and even in Notepad...

nobody on November 7, 2005 05:35 AM

Joseph Osako: Yes, but since opera isn't editor, you can search instantly by writing .the_word_im_searching_for - i doubt there is any of the applications I use left where I didnt try to use this :)

Keff on May 27, 2006 07:25 AM

"Incremental search is so good that it makes traditional search dialogs completely obsolete."

Sometimes incremental search is NOT what you want. I find it incredibly bothersome when I'm searching for something that turns out to NOT be in the document, that incremental search leaves me at some random place in the document based on the last matching substring. If the search fails, you want your cursor location to be back where you started the search, not at some random place without a full match.

I like incremental search, but to say it makes normal searching completely obsolete is short-sighted.

whm on August 31, 2006 06:52 PM

"After you've worked with incremental search for a few hours, you'll probably wonder why incremental search isn't included as a standard feature in every single Windows application"

Try HandyFind (http://www.handykeys.com). It seemlessly provides incremental search on top of Notepad, Internet Explorer, Word, Excel, and more.

Edwin Evans on October 24, 2006 09:12 PM

Unfortunately, the incremental search in VS does not do regular expressions (or, at least, I can't figure out how to make it do them), so we can't quite retire the dialog box yet.

C. Perkins on May 3, 2007 12:07 PM







(hear it spoken)


(no HTML)




Content (c) 2008 Jeff Atwood. Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved.