|
CodeRush was initially designed to be an efficiency/productivity tool for developers - offloading tedious, repetitious, and error-prone tasks to the machine, and giving the developer more time to spend on the design. If you have spent time with CodeRush before, you know this design goal has certainly been achieved. CodeRush really makes you more productive keeps you focused on the essence of your software design rather than the specifics of language syntax.
Speaking of the new version, our primary design guidelines remain unchanged. However in this version we adopted a new goal, which was to make the depth of CodeRush's features more accessible to all customers.
CodeRush 2 offers an easier learning curve and a significant productivity upgrade over previous versions of CodeRush. Though many other enhancements have been made and numerous customer requests have been fulfilled, the essence of CodeRush 2 can be summed up in two words: productivity and discoverability. With the latest version, you will get much more out of this tool even if you are an experienced user. And you will find that CodeRush has become much easier to tune to your specific needs. And the learning curve has been dramatically flattened so even new customers will be able to comfortably increase their productivity with very little effort.
To find out how CodeRush can radically improve your productivity, read on....
Training Panel - A New Level of Discoverability
You will notice changes in CodeRush as soon as you will start to install your copy of version 2. The installation window recommends that you invoke our brand new CodeRush training tool window. If you like to browse menus after installing new products, you certainly won't miss it - it's the first tool window that the DevExpress menu has to offer you.

The CodeRush training window was carefully designed to deliver access to all the essential CodeRush features within just a few first minutes of use. The training window shows context sensitive hints while you navigate through code, select code blocks or type. And obviously the best thing you can do for starters is to move the caret through your code and see what CodeRush has to offer. Within seconds you'll discover useful features like smart block-by-block selection expansion, camel-case navigation through the parts of identifier names, one-key structural navigation between methods, smart clipboard operations and much more.
The most exciting thing about the first minutes spent with this training panel is focus on task. You don't have a long list of everything that CodeRush can do in front of your eyes so you get lost in it. When you are doing something with your code, you only see the features that can automate your work in this particular situation. This is just great for learning. For example, camel-case navigation shortcuts only appear in the training window when the caret is inside an identifier that has a lower case letter preceding an upper case letter (e.g, "likeThis"). Structural navigation is at your service when you are at the beginning of a statement or member declaration. If you are in an empty line, the training panel lists templates for writing code.

While context-sensitive task-based advice looks very good, this is not the most significant improvement in the new CodeRush. There is an even more amazing feature that delivers mind-blowing efficiency and productivity, unmatched in any other developer tool....
Dynamic Templates
The CodeRush template engine has experienced a significant redesign in this new version. From a usability and upgrade standpoint, nearly all the templates shipping in CodeRush 1.0 are still there, so existing customers can expect to be up and running immediately. What has changed is that the template rules themselves share an enhanced level of logic and common sense that make them easier to consume, and there are now so many more possibilities for template extension.
Incremental Templates
In CodeRush 1.0, a code template was a hard-coded alias that expanded into a meaningful chunk of code block based on the current context. Each template was explicitly declared and had its associated availability and expansion logic individually defined. For instance, there was an "mi" template to declare an Integer method and an "ms" template to create a method that returns a String. Extensibility beyond these preset explicitly-declared templates was challenging to say the least. With the release of CodeRush 2, hard-coded limitations are gone, and flexibility is the new name of the game.
First, we enhanced the template engine so it could more directly reflect the essence of what we were trying to achieve with all those hard-coded templates from version 1.0. Next, we removed the hard-coded templates and replaced them with dynamic templates, decoupling the type mnemonics (e.g., "i" for Integer, "s" for String) from the verbs (e.g., "m" for methods, "p" for properties, "v" for variables, etc). We also added new verbs ("n" for new instances, "t" for type references, "u" for using) and native support for generics, arrays, and nullable types, all fused into the shipping template language. The result is a significant drop in the number of templates we ship, while simultaneously delivering nearly unlimited template power to your fingertips. In CodeRush, you build a template by chaining together smaller template bits. The template language is easy to use and generates a powerful return. Simply type the letter that starts the task you wish to accomplish. For example, to declare a property, type "p". Next, enter the mnemonic for the type of the property you want to create. For example, to create an property that is a string, you would enter "ps" into the Visual Studio editor. This is a simple example, but CodeRush 2 really delivers on depth as we'll see in a bit.
With the CodeRush training window, working with templates becomes an interactive experience in CodeRush 2. The training window does a great job of making the process visual and intuitive, which only helps you learn faster. The training window takes you through template use step-by-step. Initially the training window presents a list of letters corresponding to context-sensitive tasks. Type a character from the list right into the editor, and the training window will present the list of additional characters you can type to refine your expansion. For example, if the caret is inside a class, the list might include "m" for declaring a new method. Enter an "m", and the training window will present a list of all type mnemonics (more on this letter), which might include "i" for integers. The training window also shows a preview for the expansion of the template at the caret. So simply typing in an "m" inside a class, struct or interface will get you a preview (you'll get a void procedure in C# or C++ and a Sub in VB). Or you can follow the "m" with a type mnemonic. For example, follow the "m" with an "i", and you'll see a preview expansion of a method that returns an Integer. You can stop here to get the method, or you can further refine the expansion to get a method that returns an array of ints or a nullable int. At each step, the training window shows the template that will be expanded when you press the space key. Productivity has never been this easy. Click the image below to see how easy it is to declare an abstract method that returns an array of Booleans. Notice how the expansion preview follows your every step - how a template gradually changes from a simple void method to a template that matches the very specific task at hand. 
CodeRush templates cover all code bits you're likely to need while programming -- not just declarations but also structural elements like loops, conditional statements, exception handling, attributes, and more. After each template expansion CodeRush harnesses the active Visual Studio language service (VB, C#, C++, etc.) to format the code in a style that consistent with your expectations. To see live demos of CodeRush in action, please visit our Training Videos section and watch the movies devoted to CodeRush 2.
Text Fields
Sometimes after a template expands, you might want to make some changes - specify an identifier name, add parameters, etc. When you are finished with this, you will need to move the caret to a place where you can continue coding. Generally, it would be nice to have a feature that helps you navigate between the places where changes are needed. CodeRush 2 solves this with Text Fields. This is small but convienent feature really helps to smooth out the rough edges of text expansions that have more than one bit that is likely to change. Text Fields are navigational waypoints that help you get to the right place instantly. They let you focus on typing, while navigation between entry points is handled automatically. Some details about Text Fields:
- Once a template has been expanded the caret automatically appears within the first available text field.
-
After changing the field, press Enter to accept the text and move to the next field.
-
Press the Tab key to navigate between remaining text fields.
- When non-empty fields are activated, their contents are automatically selected so you can simply start typing to replace the old content.
-
Once you have reached the last field, CodeRush displays the target indicator. This indicator points to a place where you are most likely to write code after you are done specifying new identifier names, parameter lists, etc. Once you have accepted the last text field, the caret automatically moves to that target.
Text fields are cool because they turn otherwise tedius coding into a simple form-based experience. Click the image below to see Text Fields in action. For more examples, see the CodeRush Training Videos.

Template Extensibility
You have seen by now that templates are assembled from smaller mnemonic parts. If you declare a method or property, for instance, one of those parts will be a mnemonic that represents the type (Integer, String, Boolean, etc.). In previous versions of CodeRush, you could only use a predefined set of commonly used types. CodeRush 2 now lets you register any type including your own custom data types, allowing them to participate fully with the CodeRush templates. Simply right-click the type name in the editor and select Use Type in Templates....

A small dialog appears, asking for the mnemonic to associate with your custom data type. If the specified mnemonic is already in use, the background of the mnemonic text box will have a light red tint. If this happens, you may click the Replace button... 
...or select a unique mnemonic and click the Add button. If the specified string is not on the list, you can add it by simply clicking Add.

Once you have added a new mnemonic, you can use it in the same manner as you use built-in type mnemonics. To prove that, let's use our new alias in a method declaration template. The image below shows how you can declare a method in exactly the same manner as shown in one of the examples above. 
Since our templates support both standard and custom types, the list of available types in the training window can become too long for some developers. If you wish to remove aliases from the training panel, you can easily do this by clicking the filter link at the bottom of the training window. 
This is great when filtering by namespaces is what you need. If you wish greater control over the registered type aliases, use the Options dialog. Navigate to the Core | Aliases | Dynamic Lists page. There you'll see all the registered aliases, including aliases for your custom types. You can re-assign aliases, remove them or add new ones.

Improved Embedding Engine
This is another extensibility feature - one more method to make your development environment friendlier and easier to work with. Selection embedding wraps a selected block of code inside the text you specify. CodeRush 2 adds powerful new tools to let you create totally custom embeddings.
To create a custom selection embedding, invoke the Options dialog and navigate to the Editor | Selections | Embedding options page.

The Selection Embedding options page offers you the following features:
- Add new embeddings to the list or delete existing ones.
- Customize the embeddings that will appear on the code editor's right-click context menu. You can re-arrange items, break the list into groups, or change item visibility.
- Choose where you would like to add text relative to a selection, and specify the text to be added. Note that in addition to static text, you can also add text commands and string providers, which can make your embeddings even smarter. For example, you can insert the contents of the clipboard, insert the current date, select a portion of the code after the embedding, place the caret, add text fields, and so on.
|