C#PRO封面故事:C#Builder vs. VS .NET: 如何选择?(English)

类别:编程语言 点击:0 评论:0 推荐:

C#PRO Cover Story

C#Builder vs. VS .NET: Choose Wisely

With Borland's new C#Builder, VS.NET now has a real competitor. Both are great tools, but which will work best for you?

By Joe Mayo

In case you haven't heard, C#Builder is a new Integrated Development Environment that lets you build .NET applications in C#. This new product debuted just a few months after Microsoft released Visual Studio .NET 2003. Although both products target the same audience - the C# developer - and have many of the same capabilities, each certainly is unique. Now that you've got a choice, you're bound to wonder: What does C#Builder offer? How does C#Builder compare to VS .NET? And of course, why would you choose one over the other? Well, let's see what we can do about answering these questions. (For a quick side-by-side comparison, see the sidebar, "Making the Grade.")

Out of the box, C#Builder and VS .NET look similar. They sport a single document interface for code editing and visual design surfaces, property editors, tool palette, project managers, and docking/sliding windows. The first impression many developers get is that C#Builder looks just like VS .NET (see Figure 1). Then again, first impressions often are misleading. In fact, C#Builder innovates in pleasingly surprising ways that are definitely worth a second look.


Figure 1. This shows the C#Builder Default Layout, which is quite similar to VS .NET. Besides multiple layouts, another difference with C#Builder is its Tool Palette, shown in the lower-right corner, as well as its ability to show live design-time data. Also notice the close buttons on the tabs in the designer and the tab at the bottom of the designer, which lets you navigate quickly between code and a graphic view.

The VS .NET desktop opens with a tabbed view on the editor/design surface, and it lets you split the editing window and move to MDI-style editing (see Figure 2). C#Builder takes a different approach, however, by having different desktop layout styles. The default style is similar to VS .NET, but you can change it to a floating window style, similar to JBuilder and Visual Basic. Another C#Builder desktop layout is used for specifying window layout while debugging.


Figure 2. VS .NET has a consistent look and feel, but it is not quite as colorful as C#Builder. Code and GUI have separate tabs, and notice that, unlike C#Builder, VS .NET does not have live design-time data.

From a C# developer's perspective, there is no difference between the two IDEs when it comes to the ability to build any type of .NET application. Because Borland licensed the .NET Framework SDK from Microsoft, both C#Builder and VS .NET use the same C# compiler and library. You can develop any .NET technology with C#Builder, including Windows Forms, ASP.NET, ADO.NET, and Web services.

The major advantage of VS .NET is it allows development in multiple languages such as C#, Visual Basic .NET (VB .NET), Managed C++, and J#. C#Builder, as its name suggests, limits your language choice to C#. It does let you work with VB .NET source code, but it is only a supplementary capability intended for the convenience of people who need to incorporate existing VB .NET code into their project.

Go for the Code

Sure, the fancy designers and wizards offered by both IDEs help me be more productive; I use them quickly and I'm done. But the code editor is where I spend most of my time. Both IDEs have configurable syntax-colored code and code folding, but the differences in code formatting, commenting, navigation, and Code Completion/IntelliSense are significant.

When testing an IDE, the first thing I do is start typing and banging out code. The VS .NET code editor has intelligent indentation, where pressing Enter after beginning a block auto-indents to the next tab. If I am typing in an indented state and type an end-of-block, VS .NET will line up the curly brace in the proper column. C#Builder will indent to the same column under the begin block, but I have to press the Tab key to indent. Furthermore, typing an end-of-block in the C#Builder editor simply types the character where it is. Another formatting feature in VS .NET is the ability to highlight a block of code and press Ctrl+K+F to auto-format the entire block. Perhaps I'm spoiled by VS .NET formatting, but I like it and it makes me more productive.

One of the great things about C# is its XML documentation-commenting facilities, and both IDEs have options for extracting documentation comments to file. VS .NET provides automated support for XML documentation comments. All you have to do is type "///" on the line above a type or class member and VS .NET automatically generates a template shell for documentation comments. For a method with multiple parameters and a return type, this is a big gain. VS .NET also offers a documentation-generation facility that applies a transform to the XML documentation to produce HTML pages. Another capability of VS .NET is to highlight a block of text and press Ctrl+K+C; this adds comments to every highlighted line. Conversely, pressing Ctrl+K+U removes comments from a highlighted block. In the C#Builder code editor, you must type in all comments manually and it doesn't have automated commenting or a comment/uncomment capability.

I was pleased to see that C#Builder lets you jump to a declaration, the same as VS .NET. There are, however, differences in how to navigate to specific portions of code. VS .NET has a Class View window that lets you locate types and their members. C#Builder provides a similar capability, but it does so through a Model View window. One feature C#Builder doesn't have, which is something I use frequently in VS .NET, is the Members ComboBox (located above the editor), which lets you navigate directly to a type member.

Both C#Builder and VS .NET include context-sensitive help in the editor, but there are nuances that make them different. In VS .NET, context-sensitive help is named IntelliSense, and in C#Builder it is named Code Completion. IntelliSense includes descriptions when a method is selected from a list, but C#Builder simply lists the member. Additionally, IntelliSense is smart enough to remember your most frequently selected item (or the item you'll most likely choose) and highlight it first. Although Code Completion isn't that smart, it will filter results so only relevant items appear in the list. Additional IntelliSense capabilities, not found in Code Completion, include support for the new keyword, automatic implementation of interfaces, automatic delegate implementation, and automatic override implementation.

Nuts and Bolts

Project management in both C#Builder and VS .NET is a case of being able to accomplish the same goal but in different ways. The C#Builder Project Manager window lets you control build order in the Project Manager directly, but the VS .NET Solution Explorer has a separate dialog box where you can specify build order. The primary difference in philosophy is VS .NET determines build order and dependencies automatically if you create project references between projects, but C#Builder makes you maintain your own build order. I know for a fact that casual tinkering with the build order and dependencies in VS .NET can totally spike your project, which is why you instead should use project references and let VS .NET sort these things out. Because C#Builder is so new, it will take some time to see if people have any project-management problems. I've given some consideration in this area to C#Builder and have done some experimentation, but I have yet to reproduce such problems.

Both IDEs also have integrated Help; you simply press F1 to get it. C#Builder Help pops up in a separate window, and VS .NET Help appears in an IDE window with its search options displayed as dockable windows (including Dynamic Help). Fortunately, you can turn off Dynamic Help or hide it behind another docked window in a tab group if you don't want to view it.

As for designers, C#Builder uses the same design surface as VS .NET, so you get a very similar look-and-feel to visual user-interface design. Similarly, the C#Builder Object Inspector is a modified Property Grid from the .NET Framework's Base Class Library.

The difference in design interface lies with the C#Builder Tool Palette, which is analogous to the VS .NET Toolbox. The Tool Palette sports a configurable list of categories where you can change the color, order, and layout of items. VS .NET holds its controls on a standard sliding ListBox. In code-editing mode, the Tool Palette displays a list of snippets, which are blocks of commonly used code you can drag to the editor. VS .NET has a clipboard ring containing the most commonly copied code. The difference is that C#Builder's snippets are persistent between invocations of C#Builder; in VS .NET, contents of the clipboard ring disappear when it shuts down. Also, the C#Builder Tool Palette includes a search box that filters the components you seek as you type in each character of the component name.

When opening files, VS .NET opens a new window for every file, which is cumbersome because when you are working with multiple files the work area soon becomes full. Also, a form and its code are separated, prompting you to hunt and peck to find the correct code. In C#Builder, form and code are grouped together and you can switch between each easily using tabs at the bottom of the work area. Another nice C#Builder feature is the Close button on each workspace window tab, where a single click closes the window. VS .NET requires you to find the tab, select it, and click on the close button on the top right-corner of the workspace.

In addition to supporting the SQL Server, Oracle, OleDb, and ODBC data providers included in the .NET Framework that VS .NET supports, C#Builder also includes the Borland Data Provider (BDP). BDP is an extensible data provider that lets you connect to multiple databases with the same code. Current databases supported include Borland InterBase, IBM DB2, Microsoft SQL Server, and Oracle 9i. At press time, Borland is adding even more support for new data providers and, by every indication I've seen, it is committed to continue doing so for the foreseeable future.

Both VS .NET and C#Builder have code browsers for looking at the internals of individual assemblies. But C#Builder Professional and above also include an application-diagramming capability named Model View (see Figure 3). Based on standard UML diagrams, Model View lets you view the relationships between application objects, drill down into their contents, and navigate between model and code. Although this is only a viewing capability, it helps you get a better idea of how an application is put together. VS .NET doesn't have this capability.


Figure 3. C#Builder has a feature named Model View that shows static UML diagrams of a project's code. This is useful for familiarizing yourself with code that someone else has written or even reacquainting yourself with your own code after not seeing it for a while.

One feature set that might entice you to make C#Builder part of your tool suite is its ability to export and import VS .NET projects. C#Builder has a wizard for exporting to a VS .NET project and, correspondingly, you can import a VS .NET project by selecting Add Existing Project in the C#Builder Project Manager and choosing a VS .NET project. Think of an architect who uses C#Builder as her preferred modeling tool. When complete, she would export the C#Builder project, which would be added easily to any VS .NET project.

Finally, C#Builder Architect edition has integrated Together UML modeling technology into the IDE. This provides a design-time capability where developers and architects may build UML models and the underlying code is updated. Similarly, code changes update the UML model immediately. There is no intermediate translation or representation of the model, which means there is direct interaction between code and model. VS .NET Architect has Visio, but the capability doesn't even compare.

Another exciting offering in C#Builder Architect is Enterprise Core Objects, or ECO (pronounced eeko). ECO is a runtime-modeling capability that implements the vision of the Object Management Group (OMG) Model Driven Architecture (MDA). With ECO, you can build new models or import existing XMI format models created from other modeling tools. ECO's primary capabilities include support for data persistence, transactions, security, and data binding. ECO models may also evolve as changes to database schema are made. VS .NET has no offerings in this area.

Collaborating Lifecycle Management

Borland has begun an initiative named Application Lifecycle Management (ALM), where people involved in projects can coordinate and work in a collaborative fashion via tools that integrate into the environment. ALM is divided into six distinct phases, which include Define, Design, Develop, Test, Deploy, and Manage. (For more information on ALM, visit Borland's Web site at http://www.borland.com.) The significance of ALM is the way tools integrate and interoperate in the C#Builder environment. For example, CaliberRM, which is a requirements-management tool for the Define phase, integrates directly with C#Builder to put customer requirements directly into the developer cockpit. ALM doesn't prescribe a specific methodology, but it is presented in a way that supports agile processes. Additionally, C#Builder is open to integration with third-party vendors, avoiding lock-in from single-vendor solutions. The integration story goes much deeper than this, but the fact is C#Builder is part of a larger vision to help development teams that include managers, testers, and developers build better software faster.

VS .NET integrates well with other Microsoft technologies, and third-party vendors may integrate if they obtain a license for the Visual Studio .NET Integration Program (VSIP). Microsoft prescribes the Microsoft Solutions Framework (MSF), but it doesn't have integrated tools and guidance on how to perform an ALM-like process with VS .NET.

I could have touched on many other subjects in this article, but I chose what I felt to be the most important issues. Both C#Builder and VS .NET are wonderful tools that let you develop any type of .NET application you want. The difference is the way you construct your code. For coding, I love the VS .NET source-code editor. From a team-development perspective, though, C#Builder delivers on tool integration and productivity for the entire application lifecycle. I personally welcome Borland into the .NET arena and expect more innovative technology to be built into C#Builder in upcoming versions. With the extra competition in the .NET arena, I have no doubt future versions of both C#Builder and VS .NET will be released with many more wonderful features that make developers more productive in shipping their code.


Joe Mayo is an author, independent consultant, and trainer specializing in .NET technologies. He operates the C# Station Web site (http://www.csharp-station.com), and he is the author of C# Unleashed (Sams) and C#Builder Kick Start (Sams). E-mail him at mailto:[email protected].

Making the Grade

Here's a report card of how VS .NET and C#Builder stack up in different programming areas. Each product excels in some areas while lacking in others, so choose the product that most closely maps to your development style and needs.

Feature

C#Builder

VS .NET

Comments

Appearance and navigation

A

A

Both aesthetically appealing and easy to navigate

Language and platform

A

A

Both use .NET and C# code

Code editor

C

A

VS .NET has more capability and is well suited for the hands-on coder

Project management

B

B

Both do the job well, but I wonder if they could be improved for larger or more complex projects

Help systems

C

A

VS .NET Help has more features and is consistent; C#Builder's BDP Help is spotty

Designers

A

A

Two different ways to accomplish the same tasks

Database

A

B

With BDP, C#Builder offers more options in addition to what VS .NET has with .NET Framework data providers

Code browsing

A

C

C#Builder's Model View provides superior code visualization

Design

A

C

C#Builder integrates with Together Control Center for UML design and modeling support; Visio on VS .NET doesn't even compare

Model Driven Architecture (MDA)

A

F

Enterprise Core Objects (ECO) integrates with C#Builder, providing model-driven runtime MDA support; VS .NET offers nothing in this area

Application Lifecycle Management (ALM)

A

D

C#Builder integrates with many tools to support ALM; although VS .NET has tool integration, its support of an ALM-like process is blurry

本文地址:http://com.8s8s.com/it/it29063.htm