The Whidbey release of Visual Studio .NET, its associated programming languages, and the underlying .NET Framework is expected to deliver some key enhancements. Within the Visual Studio .NET environment, enterprise development is expected to get a boost with integrated requirements gathering, software analysis and design, application configuration, testing, and change and project management support within the Visual Studio .NET toolset. The goal is to easily translate business requirements into a set of Web services and components using designers. Visual Source Safe is expected to be enhanced to support Web services projects. Core .NET Framework WhidbeyThe Whidbey release of the .NET Framework itself has some major features planned, including the following:
C# WhidbeyA key highlight for C# in the Whidbey release is the support of generics. Generics are similar to the templates capability available in C++ and provide a mechanism for creating classes, methods , structs, delegates, and interfaces that take type-based parameters. For instance, consider the following class. It is similar to a typical .NET class, the only major difference is that it accepts a type parameter. public class MyCollection<Type> { private Type[] elements; public void Add(Type element) { ... } public Type this[int index] { ... } ... } Generics that implement parametric polymorphism provide a host of benefits, particularly when it comes to compile time. For instance, consider the following application, which uses a generics-based collection. intCollection, for instance, is a collection of integers, and can be implemented by using a "normal" collection. However, storing integers into the collection would require boxing them into objects. At the same time, retrieving them would require type-casting. Without additional code, the collection object would typically throw no errors when strings and other objects are used because they are also downcast as object types. It is possible to create specific implementations of collections for integers, strings, Booleans, and so on separately, but that would require additional code bloat. Generics solve this problem in a much more elegant fashion, reducing code bloat and providing several performance enhancements as well; no further type-casting is required. public class UseGenerics { public static void Main() { MyCollection<int> intCollection = new MyCollection<int>(); intCollection.Add(1); intCollection.Add(1111); int first = intCollection[0]; } } Another enhancement of the C# language is support for the easy development of iterators for collections. For instance, with Whidbey, developing an iterator would be as simple as writing three lines of source code (as shown next ). public class MyCollection { ... public object foreach() { for (int i = 0; i < count; i++) yield elements[i]; } } C# also is expected to support anonymous methods. Anonymous methods allow developers to encapsulate a block of code in a delegate that can be executed at a later time. This functionality is similar to that of the lambda function found in LISP or Python programming languages. The code snippet that follows shows an anonymous method used as an event handler to a button. using System; using System.Windows.Forms; class HelloForm: Form { public HelloForm() { Button exitButton = new Button(); exitButton.Text = "Exit"; this.Controls.Add(exitButton); exitButton.Click += new EventHandler(sender,e) { Application.Exit(); }; } public static void Main() { HelloForm hf = new HelloForm(); Application.Run(hf); } } C# introduces the notion of partial types, which, through a new keyword "partial," allows the class file definition to be split across multiple source code files. For instance, the following two programs, PartialHello1.cs and PartialHello2.cs, together define the Hello class. //File: PartialHello1.cs public partial class Hello { private String message; public Hello(String message) { this.message = message; } } //File: PartialHello2.cs public partial class Hello { public String SayHello() { return message; } } Visual Basic .NET WhidbeyVisual Basic .NET Whidbey continues to be enhanced as the tool of choice for Visual RAD “based application development. The Whidbey release advances it further by creating a new set of runtime objects and methods that provide direct access to frequently used functionality of the .NET Framework, enabling significant reduction of source code. Key highlights expected in this release are the following:
Visual C++ WhidbeyKey highlights of enhancements to the Visual C++ Whidbey release include the following:
Visual J# WhidbeyOne of the key capabilities available in the existing Java programming language is to run applets within a Java-enabled browser, such as Microsoft Internet Explorer and Netscape Navigator. Even though applets ended up not being as successful as they were initially hoped to be, applets continue to be used to create a better interactive user interface for application elements such as menu bars, toolbars, and so on. A new feature called J# Browser Controls allows existing Java-based applets to be deployed in a browser window, similar to applets, but they run within the context of the .NET Framework. A beta release of J# Browser Controls was available at the time of writing this book at http://msdn.microsoft.com/vjsharp/downloads/browsercontrols/. To understand how J# Browser Controls work, look at an example of how a simple Java applet can be converted into a Browser Controls “based .NET application. The code that follows shows a simple HelloApplet. Java applets extend from the java.applet.Applet class and have to at least implement the init method. In this scenario, the applet contains a simple button that says "Hello World." import java.awt.*; import java.applet.*; public class HelloApplet extends Applet { public HelloApplet() { } public void init() { add(new Button("Hello World")); } } After they are compiled using a Java compiler or a tool such as Visual J++, Java byte codes are generated into the file HelloApplet.class. The resulting class can then be referenced in an existing or new HTML Web page through the applet tag. If you have a Java-enabled browser, you should be able to navigate to the Web page and see the Java applet running. <applet code="hks.HelloApplet.class" width="100" height="100"> </applet> To use J# Browser Controls, after installation of the J# Browser Controls add-on, recompile the Java source file into a .NET library/DLL using the Visual J# compiler. vjc /target:library /out:HelloApplet.dll *.java
If you prefer (for instance, if you don't have the original source code), you can use the Java-language byte code to MSIL converter utility jbimp.exe to use the class file as an input to generate a .NET assembly. jbimp /target:library /out:HelloApplet.dll hks\*.class After the assembly has been generated, you need to modify the HTML file to use the .NET assembly instead of the Java byte code. The J# Browser Controls Beta release included a tool called TagConvert, which provides automated HTML applet-to-object tag conversions. The utility is available in the installation directory of the Browser Controls software. (For instance, it was in the C:\Program Files\Microsoft JSharp Browser Control Utility directory of my workstation; C: being the operating system drive.) TagConvert HelloApplet.html The utility modifies the HTML file to use the object tag instead of the applet tag. <object width="100" height="100" CLASSID="clsid:a399591c-0fd0-41f8-9d25-bd76f632415f" VJSCODEBASE="HelloApplet.dll#HelloApplet"> </object> If you open the modified HelloApplet.html file in your browser, you should see something similar to Figure 16.1. Figure 16.1. Using Visual J# Browser Controls.
Apart from Browser Controls, other highlights of expected features in the Whidbey Visual J# Release include the following:
|