.NET Editing ToolsAs a developer, most of our time is spent using a glorified text editor. Therefore, choosing an editor is a very important task because you will be sitting in front of it for an awfully long time. There are literally hundreds of editors out there (proprietary and Open Source) that support various programming languages. You must weigh the goals of your project and your company to be able to choose the correct editor for your situation. Editor FeaturesHere are some features to look for in an editor. These are not the only methods you can use to compare editors but rather are a collection of useful features on which I have become dependent. Integrated HelpWhile the .NET SDK comes with great documentation, the way in which the editor integrates it (or the lack thereof) can almost determine the editor for you. However, switching back and forth between the editor and the documentation is not the end of the world. Each editor will have its little quirks. One annoying feature of VS.NET is when cutting and pasting from locations that use HTML (like MSDN or a Web page), VS.NET pastes the HTML markup, which is not exactly what is usually desired.TIPThere is a wiiciwgp (What is in the clipboard is what gets pasted) plug-in for VS.NET available from http://www.codeproject.com/useritems/wiicwgp.asp that eliminates the HTML cut-and-paste problem.I find myself using several of the editors later listed in this chapter, depending on the job at hand. Syntax HighlightingWe take this for granted in IDEs today, but syntax highlighting is a very important feature. Being able to easily distinguish language key words from built-in types just by the color of the word is extremely helpful. It is not possible to demonstrate this familiar feature in a black and white book, but all of the editors listed here do support syntax highlighting. However, with some of the editors, you may need to download a plug-in or specialized file that extends the editor for the desired language. Integrated DebuggerAnother feature that is almost assumed in an editor today is an integrated debugger. This allows a developer to debug the application directly from the editor. Some IDEs support this better than others. Microsoft's freely available .NET SDK comes with a functional graphical debugger (DbgCLR) and a somewhat cryptic debugger (Cordg). Both tools can be found in the FrameworkSDK folder in the .NET SDK directory. The source for Cordg is also shipped with the SDK. The SDK documentation is very helpful in describing how to use the Cordg utility to print out variables and dump memory, so I will not rehash that information. Some editors wrap the functionality of the debugger of your choice into the IDE, allowing you to step line-by-line through the code. While this is much better than having to switch tools, probably the best debugger integration I have seen is in the Visual Basic 6 (VB6) IDE. VB6 allowed you to edit the code while debugging and continue on without having to break the debug session and recompile (which has been promised in the Visual Studio.NET 2005). Another nice feature is retrieving the value of a variable by just hovering the mouse over the text in the IDE. The integration and debugging with SQL also is very nice. Integrated Command ShellBeing able to issue various operating system commands from the IDE is often useful. I was surprised to find that many of the newer editors do not support this or support only a subset of commands. Many of the old-faithful editors that have been around forever have the best integration of issuing commands from the IDE.TIPMicrosoft has finally released a command shell for VS.NET, which is available as part of the VS.NET Powertoys (http://www.gotdotnet.com). Intellisense AutocompleteYou may say that programmers have become lazy, but I think that the cleverest improvement in IDEs in a long time is Autocomplete. Later on, Figure 3-3 shows this feature in action. Intellisense saves a large amount of time in weeding out compiler syntax errors. I think one thing Microsoft has always done extremely well is put out development tools that are superior to any other tools available. Some of the more advanced tools available today rival Microsoft tools, but when attending conferences (and I do attend conferences not geared only to Microsoft), I have observed that usually a majority of developers use Microsoft development tools to get the job done. This is one of the sore spots with Java. Until the last few years, Java's IDEs were not as easy to use as other languages' IDEs. However, if you frequent MSDN TV (http://msdn.microsoft.com) as I do, you will note that many of the leading Microsoft developers use the very Open Source editors mentioned in this chapter and not Visual Studio.NET. Figure 3-3. Sharp Develop IDE.[View full size image] ![]() Key Bindings and ShortcutsBy far the most powerful feature of an editor is key bindings and shortcuts. While these features are often overlooked, they provide greater time savings than any other feature. Editors provide these features in many different ways. VI is probably the most powerful at straight text editing. You can turn a file upside down and backwards with just a few keystrokes. (This can also be dangerous if not used properly!) But some editors have gone the extra mile and have specialized their shortcuts to .NET languages. For instance, a few editors support C# XML commenting much better than others. Of course the most specialized is Visual Studio.NET, and a list of facts and bindings can be found at http://www.sellsbrothers.com/spout/default.aspx?content=archive#vs.netfunfact.NOTE For visual studio .NET 2003 users there is a plugin at http://microsoft.com/downloads/detail.aspx?FamilyID=3FF96915-30E5-430E-95B3-621DCCD25150 that lists all key bindings in VS.NET. Source Code Management IntegrationMost editors today have some sort of integration with Source Control Management (SCM). I am not a big fan of version control that is integrated into IDEs. This is probably because Microsoft's tools have never done a very good job of integration. Because of the level of integration (or lack thereof) in Microsoft's tools, I have developed a preference of just using a separate tool for SCM. Multiple Operating System SupportOne feature you may not have thought of but should keep in mind when selecting an editor is the operating systems that it supports. As .NET matures on operating systems other than Windows, this editor feature becomes more important. Since many programmers memorize their key bindings and shortcuts, choosing an editor that works the same way on different operating systems eliminates having to learn a new editor and is a big timesaver. Of course this is not a key factor if you know you will always be using a specific OS. EmacsEmacs is a GNU project in and of itself, which means it is free. Emacs also supports many operating systems and languages. I find Emacs easy to use and a very quick editor that is much more powerful than Notepad. Figure 3-1 shows Emacs with the C# plug-in. Figure 3-1. NTEmacs with C# Plug-in.[View full size image] ![]() Setting Up EmacsSince Emacs is already installed on most versions of Linux and Unix, I will focus this section on using Emacs on the Windows platform. First you must visit http://www.gnu.org/software/emacs/windows/ntemacsl and download NTEmacs, which is the Windows port of the GNU project. Installing it is very simple. Then download the C# plug-in from http://www.cybercom.net/~zbrad/DotNet/Emacs/ and unzip it to the [emacsInsallDirectory]\site-lisp. Then copy the zbrad.emacs file to c:\.emacs from the command line. For Linux and other OSs that contain Emacs, you can just use the C# plug-in instructions and skip the Emacs installation steps. VIMVI iMproved (VIM) is a very popular distribution of the powerful VI editor. Available under the GNU GPL license, VIM is downloadable from http://vim.sourceforge.net. VIM is easily installed on either Windows or Linux, and the latest version I downloaded has the C# syntax module already installed. Figure 3-2 shows VIM in action. Figure 3-2. VIM's C# Editing Capabilities.[View full size image] ![]() Command ModeVIM defaults to command mode. To issue a command, the colon (:) is used. Entering Insert Mode is just one of many commands available in VIM. VIM comes with great documentation, and almost any Unix book has a chapter on VI. Insert ModeOnce in Insert Mode, text can be inserted to the currently active buffer. Traditional VI cursor navigation is a little different than most Windows applications. However, VIM has graciously allowed the arrow keys to be used to navigate throughout the buffer. Sharp DevelopSharp Develop (#develop) is an Open Source IDE for developing .NET applications, which itself is written in C# using Windows Forms (see Chapter 4, "Build Automation") for its builds. Sharp Develop goes farther than most other editors by also supporting VB.NET, Resource Files, and Web services. Most editors listed here support XML, Java, C++ and a smattering of other languages, but #develop is the only one I have found so far that supports VB.NET- and .NET-based Webservices so well.#develop uses other Open Source projects from icsharpcode.com including the CVS C# Module for Software Configuration Management (SCM) integration and #ziplib to zip all the files together into a solution file. Both #CVS and #ziplib are also used by the nAnt project, which goes to show how reusable Open Source is. Sharp Develop uses nAnt, and nAnt uses components of #develop. I am sure that neither team had each other in mind when creating the projects. This is the amazing power of Open Source. Sharp Develop's beautiful user interface uses another Open Source project called Magic (http://www.dotnetmagic.com). Unfortunately, the Magic UI makes a lot of direct Win32 calls and thus prohibits #develop from working on any other platform than Windows, but the Sharp Develop team is working hard to remedy this and has replaced much, if not all, of the Magic Library with Lutz Roeder's CommandBar (http://www.aisto.com/roeder/dotnet/). Web MatrixAlthough not an Open Source product, Web Matrix does qualify as free software per the FSF's freedom level 0 definition. Web Matrix is freely available (http://www.asp.net/webmatrix) and is the most powerful editor available for ASP.NET Webform Applications. This IDE is very similar to the Visual Studio.NET user interface but without the cost. Figure 3-4 demonstrates Microsoft's Web Matrix contribution to the development community. Figure 3-4. Microsoft Web Matrix.[View full size image] ![]() EclipseEclipse (Chapter 2, "Open Source and the .NET Platform"). Figure 3-5. Eclipse IDE.[View full size image] ![]() WorkspacesA workspace deals with projects. Projects contain files, folders, and other resources such as SCM. A workspace is a team-focused feature. The workspace is a container for workbenches, the project history (used almost like a mini-SCM to prevent data loss), and markers (used for status of things like error messages and to-do lists). Resources are so well managed that a user can open a workspace and receive the exact same views, plug-ins, tools, and overall project status. WorkbenchesWorkspaces are not really reflected in the user interface and are more of a conceptual thing. Workbenches are what you see when you fire up the UI. Workbenches consist of editors, views, and perspectives. EditorAn editor (top-left portion of Figure 3-5) allows a user to create or modify an object. Most often, an object is a file type like C#, XML, or Java. Editors can be generic text editors or more specific and complex editors supplied by other plug-in tools. ViewViews provide information about an object. In Figure 3-5, Navigator, Outline, and Task are all views giving information about the test.cs object. Changes to a view are usually applied immediately, whereas changes to an editor are buffered until the user explicitly saves them. Additional views are supplied by other plug-ins. PerspectivePerspectives are a collection of editor and view configurations. Only one perspective can be viewed in the workbench at a time. Eclipse comes with built-in perspectives (CVS, Install/Update, Java, Java-Browsing, and Resource). Figure 3-5 is in the Resource perspective. The icons on the top left of Eclipse allow you to change perspectives.TIP After installing Eclipse, you must switch to Install/Update Perspective to install the Improve Technologies C# Plug-in.
|