CodeGPS is a code navigation tool for Visual Studio, as a VS package. CodeGPS mimics the GPS navigation in the real world. CodeGPS helps Visual Studio users to semi-automatically create a call path from A to B. A path is shown graphically. This can 1. speed up development for current time; 2. save time to find a path later on; 3. help understanding the code rapidly. What is CodeGPS?CodeGPS is a code navigation tool for Visual Studio, as a VS package. CodeGPS mimics the GPS navigation in the real world. A CodeGPS map contains code routes. A route represents a single functionality, task, action in the code. Routes are grouped into folders. Each route contains one or more streams. A stream represents a calling path, like from location A to location B in real world. A stream is displayed in a graphical UI for easy navigation and easy understanding of the code execution flow. All the above information along with navigation history and change history together is called a map, which can be saved as a xml file. Fig. 1 Code Execution Flow in a Stream Who Is CodeGPS for?Of course the main audience is the developers. Currently, CodeGPS supports C# to the fullest, with a little less functionality for C/C++, and minimal support for other text formats. If you are a developer with main code base in C#, and other language in the mix, CodeGPS is for you. CodeGPS supports Visual Studio 2013 and above. However only Visual Studio 2017 plus CodeGPS Enterprise License have full features. If you are a developer, working on a large code base, like a few million lines of code, navigate through different code area to find out how things work is a real challenge. What if you can mark the code execution flow according to functionalities, saved it for the next time, and that markup can be displayed in a graphical way? That will save you a lot of time. Over time, your understanding of the a few million lines code has turned to highly organized graphs, isn't that a dream? CodeGPS helps you to achieve that. This is real, not some ad phrases. The only drawback is you have to create the code routes manually, but over time, those code routes stays with you, even though the code is changing. CodeGPS can guide you through the changes, make sure your collection of code routes, called map, staying up to date. Better yet, CodeGPS can record call stacks and turn them into regular code routes, that way, you add code route semi-automatically. Now imagine you are working in a team, developers can share their code maps, you inherit other people's knowledge about the code from the time you start. That would be a great training tool for you and every team member. If you are a team lead, or development manager, you will appreciate how much this knowledge sharing improves your team's productivity. So far, it is just about the Code Route feature. CodeGPS has three other features: Current Document view shows current function info, including callers/callees and current file info; Navigation History view keeps 30 day nav history; Change History view tells you the history of your code changes in the past 30 days. Most of those features are critical to the success of a developer or a team of developers. An Overview of codeGPSAfter install CodeGPS Visual Studio package. Open Visual Studio, click View menu -> Other Windows -> Code GPS Window. A tool window called CodeGPS should open. Move CodeGPS window, let it dock at the bottom of Visual Studio so it can merge with output tool windows, or if you have dual monitors, you can leave CodeGPS window float, then move it to the second monitor. The main actions of CodeGPS are very simple: 1) On the top toolbar of CodeGPS window, from the left to the right The View dropdown box includes four different views: Code Routes is the main view of CodeGPS. That's the most important feature of this tool. Current Document View displays information about the current function/method the current cursor is on, and information about the current file. Navigation History view shows code navigation history of the past 30 days. Change History view shows code change history (by Visual Studio) of the last 5 days. Search: type in text and enter to search any text in Code Routes view. So far, search is only performed on Code Routes, and only done on route names. Open Map: to open a saved map. Import Map: similar to Open Map, but instead of replacing the current map but merging with the current one. Save Map: save the current map to as a xml file. Manage Code Branches: CodeGPS can share the map over different code branches, as long as they are the same code base but different branches. This means you can work on different branches without create a map for each branch. Fig. 2 The Toolbar 2) The work area below the toolbar This is the main area that has the content based on one of the above mentioned 4 view types. The default view is the Code Routes. In Code Routes view, most actions are available through context menus (right click). Fig. 3 The Content Area of Code Routes View How to Use CodeGPS?Now you have installed CodeGPS, and put Code GPS tool window at your preferred place on the screen. 1) How to Use Code Routes View Open the CodeGPS window you will see the default view is set to Code Routes. An empty map is in place by default. In the Code Route view, there is an empty folder called "Generic", you can rename it by right click on it. Open the Generic folder, there is a sample route called "First Test Route", again you can rename it by right click on it. Open the route by click on the "+" sign, it shows an empty route, with only a link in blue text says Show Comment. Click it you can type in comments and description for this route. This is where your work starts, you can add streams inside the code route. If it is not the first time you use CodeGPS, you would normally open a map you have saved, that would show what you have added instead of everything from scratch. Fig. 4 Context Menu in Code Routes View There are three types of streams: Structured stream is the most common form. It contains a structured call flow chained together by caller-callee relationship. Stream from callstacks: This is actually a structured stream, instead of created manually but created from the current call stack in Visual Studio when a breakpoint is hit. After the stream is created, it can be edited as structured stream. Free form stream: It contains independent code points in the code. It is useful when you just want to put a few code points together for your own purpose. To add a structured stream, while mouse cursor in the route area, right click and click menu "Add Stream - Structured". "Add Start Function" dialog pops up, because structured stream need a start function/method. To fill all fields for a function from the code is impossible. What you normally do is to go to an open document in Visual Studio, select the function name you want to start with (yes, make sure entire function name is selected), then click Get Selection button at the bottom of the dialog, all fields will be filled. Click OK, this function will be added to the stream. This is the minimum for a structured stream. From here you can chain callees after callees to form a stream. Now, right click on the newly added function in the stream, click menu Add Call Point, Add Call Point dialog popup, that's same dialog as the Add Start Function dialog, but this time is for adding a call point. A call point is a place inside this function, there is code calling another function. Select the text of the call point, click on Get Selection button, then click OK, a call point is added to the function. Now, right click on the call point, click menu Add Callee, Add Callee dialog pops up. This time, in the code windows navigate to the definition of the callee. Do same thing with the callee. Click OK, a callee is added after the call point. So on and so forth. Remember, at each function you can add more than one call points, therefore more callees, so the call flow can branch out to as much as you need. To add structured stream from call stack, Visual Studio needs to be in debug mode, and a breakpoint is hit. Now go to CodeGPS window, right click anywhere in a route, click menu Add Stream - From Call Stack. A structured stream is added based on the current call stack. Sometimes you may want to edit it to suit your needs. Adding a free form stream is rather easy. Right click anywhere in a route, click menu Add Stream - Free Form. A blank stream area framed by a rectangle is added. Right click on that area, click menu Add Code Point, Add Code Point pops up. This time select any text in the code, click Get Selection button, click OK. A code point is added. You can add more call point; they don't have to relate to each other. Click on a function or a call point, code point will bring you to the location in the code. Fig. 5 Structure Stream vs. Free Form Stream 2) How to Use Current Document View Switch to Current Document View. First put the mouse cursor on the code line you want to get information for. Click on Map It button, done. You get information about current function the cursor is on, its callers and callees. At the bottom the window, you can see information about the current file: list of functions. Fig. 6 Current Document View 3) How to Use Navigation History View Switch to Navigation History view, you will see there is Refresh button, click that shows navigation points you have visited in the past 30 days. The navigation points are organized by date, file, and function. Right click, you can delete them in many ways. Click on a navigation point, bring you to the code point. Fig. 7 Navigation History View 4) How to Use Change History View Switch to Change History view, click Refresh button, it shows all the changes you made in the code through Visual Studio in the past 30 days. Again the change points are organized by date, file. A change point is recorded at the time a file is saved, doesn't matter how much changes. Click on a change point shows the code and changes made on that file by highlighting the original line of text and changed line of text. Click each line will bring you to the line of code in Visual Studio. Fig. 8 Change History View 5) How to Manage Code Branches in CodeGPS CodeGPS tries to share same map as much as possible. It is the best practice to have multiple solutions share the same map file. The idea can be extended to multiple branches. The code branch list in CodeGPS is used to share one map across all real life code branches. This is based on the fact that the main code base is the same. For example: your code structure looks like this: C:\Source\MyGreatApp\Dev C:\Source\MyGreatApp\Main C:\Source\MyGreatApp\Release1 C:\Source\MyGreatApp\Release2 Click on the Manage Code Branches button on right side of the top toolbar. In Manage Code Branches dialog, add the above lines to the branch list. You are done. Now all above branches can share the same map file. 6) How to Share Map Files with Others Send a copy of your map file to another person, he can open it and edit on top of it. Or he can open his own map in CodeGPS, then import your map file that will be merged with his own map file, he can then save the merged map. Extra NoteIt would be a disaster if you accidentally delete or overwrite a map file which may contain many months of your work. To prevent that from happening, each time you save your changes, before it is saved, CodeGPS will make a copy of the current file in side of folder named {current file}_Backup. That keeps copies of your last time changes. LicensingCode GPS has Personal Edition and Enterprise Edition, by "Edition", it actually means "License". Personal Edition includes the main functions like creating code graphs, but lack of extended features, like current code location mapping, code navigation history, change history. Code GPS is shipped with Personal License by default (a limited number of downloads didn't have Personal License activated by mistake, please contact us for that matter). By purchasing Enterprise license, all features will be activated. |