|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
New Features - Part 3
Visual J# and the JLCA Microsoft knows that Java has a pretty decent foothold on enterprise development. They know the primary competitor to .NET is Java and J2EE. They know, in order for .NET to succeed, they must convert as many Java guys to .NET as possible. Visual Studio .NET 2003 includes one of the big guns of this offensive, Visual J# and the Java Language Conversion Assistant. Visual Studio .NET 2002 did not include J#, although it was available as a supplemental download from MSDN. J# is a complete clone of the Java language (and no, it’s not repetitive since C# is not a Java clone) that allows Java developers to write all their .NET code in “pure” Java. J# cannot, of course, be used to develop applications for the Java Virtual Machine. Below is an image of a WinForms application, written in J#, inside Visual Studio .NET 2003. Aside from the uglier Java syntax, it works exactly the same as any other .NET application. But wait, there’s more! Not only does J# let you develop your application using the .NET Framework libraries, you can also write code that seemingly targets JDK 1.1.4, yet runs on .NET. This means I don’t have to change System.out.print to Console.Write, or anything else for that matter, to get Java to compile in Visual Studio .NET 2003. This is possible because Microsoft wrote an emulation library (exposed via the “java” namespace) that converts calls to JDK libraries to their equivalents in the .NET Framework. Below is a screen shot of a “multiple finder” program I wrote in Java a long time ago. It originally targeted JDK 1.1.3. I simply copy/pasted in the code, and ran the program. Now that’s neat. In addition to all this, Microsoft included the JLCA in Visual Studio .NET 2003. The JLCA can convert any Java code that targets JDK 1.1.4 to C#, so if you want to move over to .NET like a real man, you can convert your existing Java code to C# with little or no effort. Like the VB6 to VB.NET tool, however, I’m sure more complicated code will need a little manual tweaking to get it to run properly. Obviously, Microsoft is not kidding around when it comes to getting Java developers to move to .NET. Their current set of tools offers a compelling migration path, so long as the anti-Microsoft sentiment that is typical in the Java camps doesn’t cloud their technological judgment on the matter. If anything, all these tools will help broaden the job market for Java developers by offering a fairly quick exodus from Java to .NET if they ever need it. Development for Smart Devices Soon after Microsoft released Visual Studio .NET 2002, they released a free download called the .NET Compact Framework. Visual Studio .NET 2003 now comes packaged with it, allowing you to seamlessly develop applications that run on your desktop and on your PocketPC. Visual Studio .NET 2003 now has several new projects types that allow you to create “mobile” applications. These include “Smart Device Application” and “ASP.NET Mobile Web Application”. The later is covered in the next section. Below is an image of the new project types. Selecting “Smart Device Application” brings you to the following dialog that lets you choose what platform you wish to target, as well as what kind of application you wish to create. The dialog is displayed in a way that suggests it could list more than just PocketPC and Windows CE as available target platforms. Can we expect Palm .NET apps in the near future? Probably not, but I can dream, can’t I? Anyway, I’ve never really done any Pocket PC development, so I was curious to see how it was different from normal Windows development. I created a new “Windows” application for Pocket PC, dragged a button onto the form, added a bit of code (1 line), and eventually had the following. I included a shot of the code to show that what I wrote for the simple Hello World application was exactly the same as the code for a normal Windows application. The only difference was the appearance of the form and button controls, which were in the flat style and had a different color scheme. So far so good, I thought, but it must be a pain to test these things, right? Nope! I told Visual Studio .NET 2003 to run the application, and soon I was shown a PocketPC emulator with Pocket PC 2002 booting inside. Not only did it boot, but it automatically “installed” the .NET Compact Framework onto the emulator just as you would on a real Pocket PC. Below is an image taken as the installation of the framework was just finishing up (it took about 20 seconds). Soon after the framework finished installing, Visual Studio .NET 2003 installed my little Hello World application as well, and ran it for me. Just like that, I was playing with my very first Pocket PC application! It took about 1 minute from when I started coding to when the application was running on the emulator, and almost all of that time was taken up by the “installation” process. Below is an image of my super awesome Pocket PC application. As I said, I have very little compact framework experience, but I do know that the compact framework does have its limitations. It’s obviously not the entire .NET Framework class library, so there are bound to be things you either can’t do, or are more difficult to do. In general, when there is 5 different ways to do it in full fledged .NET, there will be just one in the compact framework. Smart Device applications development in Visual Studio .NET 2003 is impressive. Although you’re still limited to those mobile devices that support .NET (currently only Windows CE and Pocket PC), Microsoft developers finally have what the Java community has had for quite a while – the ability to write an application that runs both on the desktop and on PDAs. Development for Mobile Devices (Cell Phones) Similarly to the Smart Device support, Microsoft released a set of ASP.NET controls, called the “Mobile Internet Toolkit,” soon after the launch of Visual Studio .NET 2002. The Mobile Internet Toolkit, now called the ASP.NET Mobile Controls, are included out of the box with Visual Studio .NET 2003. These mobile controls make it very easy to develop mobile phone-happy web applications. When I say “mobile phone”, I mean that in the most generic sense possible because the mobile controls support over 200 different phones, and has the ability to be upgraded to include more in the future. (Microsoft releases updates to support new phones on a regular basis.) Developing web applications using the mobile controls is just as easy as developing applications with standard ASP.NET. The only differences are the controls you use and the design paradigm you approach the problems with. Standard ASP.NET applications often have quite a bit of screen space to work with, whereas mobile applications need to fit on the tiny screen of a cell phone. For this reason, it makes sense to create a separate UI for the mobile interface to your web application, and therefore it makes sense to use the mobile controls. Pictured below is a dummy application I threw together to demonstrate the mobile controls. This particular application consists of two forms. Forms in this sense are a bit different from the typical WebForm or WinForm we’re used to. Instead, multiple forms are contained on a single ASP.NET page, and you use buttons to hide one form while you show the next. This makes sense as each form will usually have only a few controls on it, and managing each of them as a separate page would quickly become cumbersome. Because you can add a mobile interface to an existing ASP.NET application simply by creating a new set of pages that use the mobile controls, and that interface with your middle tier, I suspect that the number of mobile-accessible sites will begin to increase. For more information of the mobile controls, see Microsoft’s page about it or this .NET Show episode.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||