HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
The Sharp Tongue of Microsoft

When all's said and done, August was a pretty uneventful month in the world of Java. No major acquisitions, CEO resignations or significant announcements. In the press world this period is often referred to as the "silly season": basically, nothing's happening, so they have to dredge up silly wee filler stories.

But instead of going into nonsense about some dog that can drive a car across four states, we'll take a quick look at Microsoft's new programming language, C#, some excellent customer service and what our Nordic cousins are up to with their mobiles.

It's Not Java, Honest!
This past summer, on June 26, Microsoft announced its new programming language to complement its .NET platform, called "C#" (pronounced sharp, as in the musical note). The new language promises all the latest features that a modern-day language should have without compromising security or functionality. I, like many of you, saw the initial press regarding its launch, then didn't give it much thought. After a couple of months, though, I thought the time had come to take a proper look at the language and see what the story is. I'm sure in the future there'll be many articles that will take you through wonderful, natty tables comparing C# with Java – with lots of ticks and crosses detailing various pros and cons. So as not to steal the thunder from that brigade of literature, let me just go through some of the broader points.

At the time of this writing (September), documentation on C# is thin on the ground. It took me over 15 minutes to find information on the main Microsoft Web site. Searching on "C#" – as in c sharp – yielded no results. Nor was it listed on any of their standard product pages. I was beginning to think that C# was simply Scotch mist or, as the Americans would probably say, vaporware. But eventually I stumbled on a link that took me to some literature I could refer to. Let me save you some time and point you in the right direction: http://msdn.microsoft.com/vstudio/nextgen/technology/csharpintro.asp.

No doubt about it...if you were to run your eyes quickly over a piece of C# code you'd think it was Java. The syntax is very familiar, and I don't believe this is by accident. I'm guessing that Mr. Gates wants us in the Java community to embrace this new kid on the block with much love and give it a chance to grow on us. Mmmmmm, we'll see.

Looking at it, Microsoft has put some cool features in there...and some that really shouldn't have been included.

using System;
public class ArrayClass {

public static void PrintArray(string[] w) {
for (int i=0; i < w.Length; i++)
Console.Write(w[i] + " ");

public static void Main() {
// Declare and initialize an array:
string[] WeekDays = new string [] {"Mon","Tue","Wed","Thu","Fri"};

// Pass the array as a parameter:

As you can see from the sample C# code, which prints out the contents of a string array, there are only subtle differences with Java. The first one you notice is the word using as opposed to import. The declaration of the class is the exact same – no difference there. However, C# has no notion of "extends" or "implements." All classes and interfaces are extended in the same way:
public class userClassX : baseClassY, interfaceClassZ{ ... }

Declaring methods takes on the same guise, so no major problems on that front. C# introduces a cool feature known as delegation. This is where you obtain a pointer to a particular object and can then call the necessary methods that this object has access to. This is what polymorphism is all about. In Java, however, you can forward- and backward-cast that reference to access other methods in the hierarchy. This isn't allowed in C#. You'd have to obtain a new reference to the object to accomplish it. You can argue whether this is good or bad, but it'll allow designers to maintain much stronger control over the use of their objects.

I'm confident that Java developers looking over the rest of the code will be able to understand it with no problem whatsoever. Barring a couple of wee case changes, it reads pretty much like any other Java program.

Another cool feature, which I find particularly useful, is variable initialization. As soon as you declare a variable, it's set to a default value. Sadly, Java has no standard for this one. It depends on what JVM you run whether or not a value will be set, so it's always safer to set it yourself and not have to rely on a third party. But with C# it's built in there from the start, so no worries.

Now before you throw down your Java and start running toward C#, it's not all a bed of roses. There are some quirks you need to be made aware of. So stay put for a moment.

One of Java's greatest strengths is its ability to run pretty much anywhere there's a virtual machine, and with the availability of JVMs reaching saturation point, this is no longer a major issue. C# doesn't share the same luxury. Unlike C++/C, it doesn't compile to a native program but instead needs to use Microsoft's .NET platform. So right away you can be pretty sure that getting your C# to run on a Solaris box isn't going to be smooth sailing. It can be argued that Java suffered from the same fate when it took its first steps into the wide world, so we'll have to wait and see which vendors implement .NET platforms for their boxes.

Another major stumbling block as far as I'm concerned is the retention of direct memory pointers. The days of accessing direct memory are back again. Hurrah! I think not. May I introduce a good friend, Dr. Watson; he'll be helping you with your C# development and deployment! It's going to be ugly. Consider yourself warned.

I highly recommend that you read about C# yourself. I personally like the look of it, but I'm not in the Windows world where I need to look at it seriously. However, I do know a lot of you are under major client pressure to stick with Mr. Gates, so I guess some manager somewhere will soon read about and start dictating that the next project has to be C# enabled. Before you denounce it, have a look and make up your own mind. At least that way, when you have to argue for Java, you'll be on far stronger footing.

Service, Please?
Sadly, we're not known for our customer service in this great nation of ours – the U.K., that is. We continually have to put up with poor service, rude suppliers and no sense of urgency. I could write books on what we have to endure, but I won't bore you with such moans. What I'd like to comment on is the quality of service from America. Damn, you're lucky!

We recently moved our offices into a nice old building that dates back to the 1800s. It's an ex-bank building with loads of character and we love it. But in this move we had to have a new Class-C allocated to us, so the pain of the form-filling at Network Solutions had to ensue. Well, thanks to the Labor Day holiday in the U.S., the DNS root servers weren't updated when they were meant to be. So we had to wait an extra day for the update. I learned this after a pleasant phone conversation with customer service.

The chap's name was David, and I was very impressed by the level of care devoted to sorting out our problems. He even asked for our phone number in case we were cut off. Now that's service! It was on speakerphone and Keith, after overhearing the whole thing, asked: "Why can't we have that level of service in this country?" Very impressive. The Brits could learn a lot from this customer care.

Big Brother Is Watching
I'm sure most of you have caught at least a glimpse of the great human social experiment of throwing 10 people into one house and observing how they get on. Stick a camera in any university dorm and you have your Big Brother. But it would appear that Big Brother is starting to monitor our movements for us, via our cellular phones.

Every time we move around with our mobile phone, some computer somewhere is tracking the location so it can route calls to and fro. Now, as was recently announced, a company in Sweden is selling this as a service. Bikeposition.com will guide you to your destination, detailing the direction you have to take and all necessary adjustments. Very cool technology. Scares me, this sort of thing. For every positive use a particular technology can be applied to, there is an equal, if not more negative, application. For example, slip a powered-on mobile into someone's pocket, and boom, you can monitor every movement. Too Orwellian for my liking.

On that note, I'm now reaching to turn off my Nokia as I prepare to head home. Remember to keep an eye on www.n-ary.com/industrywatch/ for updates.

See you next month.

Author Bio
Alan Williamson is CEO of n-ary (consulting) Ltd (www.n-ary.com), the first pure Java company in the U.K. A Java solutions company specializing in delivering real-world applications with real-world Java, Alan is the author of two Java Servlet books and contributed to the Servlet API. He can be contacted at: [email protected]


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.