For large projects, new developers can take weeks or even months to become productive contributors. To acclimate them to their new project, team leads often start developers off with bug fixing or smaller tasks. In this scenario, new developers find themselves staring at thousands of lines of code, completely lost as to how to begin. Fortunately, a new set of tools is quietly becoming available that accelerates the learning process. This post will detail how to use the features of next-generation FindInFiles tools, such as query recommendations, instant search, and quick review workflow, to avoid the common problems that new developers face.
To follow along download the Sando Code Search Tool, a free, open source Visual Studio extension.
Developer Dan Joins Family Lines.
Today let’s consider an imaginary scenario where Developer Dan from company XYZ joins the proprietary Family Lines project. The Family Lines project allows users to create, maintain, and edit family trees. A screenshot is included below:
As you can see in the screenshot above, both a father (blue) and a mother (orange outline) can be created, and children can be added (orange filled). The blue button on the right hand side of the screen allows you to add a daughter, mother, sister, brother, or father to the selected person.
Now, imagine that when a user chooses the option “add daughter” the links are not properly drawn between the father and daughter. Unlike in the screenshot above, the lines between father and daughter are missing. Let’s consider the steps that a developer would take to fix this bug.
Without Advanced Search Tools
First, let’s consider what the developer may do without advanced tool support. The developer will likely use FindInFiles to search for the word “daughter”. Performing this search on the code base will return 33 results, none of which are relevant.
33 hits, none of them relevant
Next, the user is likely to search for “add”. Unfortunately, this search is equally useless, as a search for add returns 1060 results, which the user would have to weed through in order to find the relevant code. There must be a better way!
With Advanced Search Tools
Fortunately, there is a better way to start a task thanks to modern search libraries, years of academic research, and a few innovative tool builders. Today we will use the Sando Code Search Tool (a free, open source Visual Studio extension), which provides a modern search experience for developers, ultimately making them more productive.
Using Sando developers can eliminate the problems experienced by the FindInFiles user. The Sando user would simply begin by typing “add” into the Sando search box.
As you can see in the screencast above (Click here to see the animated gif in action), as the developer types “add” several recommendations are suggested based on the actual word usage in the Family Lines project. While the words “add” and “daughter” don’t appear together in the project, the recommendations help the developer quickly realize that the correct search terms are “add child”, thus avoiding several failed searches before they happen.
Once the developer executes the search it is easy to review the results without opening a single file. The developer navigates down the result list using the arrow keys and each matching method, class, or field is shown in a preview popup with relevant terms highlighted.
Click here to see the animated gif
To upgrade your search experience download the Sando Code Search Tool, a free, open source Visual Studio extension or check out Entrian Source Search.
This article was Guest blogged by David C. Shepherd. David is a software engineering researcher and research area coordinator with ABB, Inc. based in Raleigh, N.C. While working with ABB's Software Engineering Group he looks into improving developer productivity and increasing software quality. While he is a researcher, and thus often found writing papers and attending research conferences, his industrial background compels him to actually implement his ideas as software tools. His current passion is creating better search tools for developers as the project lead for Sando, an open source code search tool and Visual Studio extension.
Will you give this article a +1 ? Thanks in advance