Electronic Design

Sharp Programming Language May Challenge Java In Embedded Systems

The new programming language on the block is C# (pronounced C sharp) from Microsoft. C# was developed partially in response to Java's popularity. It also was created because C and C++ programmers called for a similar language with many of Java's properties, such as automatic garbage collection. Microsoft, with its J++ product, has been at odds with Sun and Java. Many see C# as an alternative to Java and J++.

C# is little more than a twinkle in Microsoft's eye. There isn't a commercial version yet, but an edition for Microsoft's Visual Studio is in the works. Likewise, Microsoft is pushing on the standards front. Meanwhile, Sun's on-again/off-again Java standards effort has drawn the ire of some Java supporters. It'll be interesting to see if C# becomes a standard before Java. At this point, neither has crossed that line.

It also remains to be seen whether C# implementations will be available from third parties or whether Microsoft will remain its sole source and supporter. While Java hasn't been made a standard, its third-party support is extensive. Just look at the number of Java virtual-machine (JVM) and Java-compiler implementations.

Java has proven to be popular in some embedded designs. It's also a popular solution platform for server- and browser-based applications. C# should find its way into the same application space, providing Java with some stiff competition. Microsoft has designed C# so it handles Microsoft technologies such as COM+ (Common Object Model) with ease. This may limit C# to Windows platforms. The language itself, however, doesn't seem to depend on these technologies in any way. C# potentially can be a cross-platform development tool.

C# is clearly a new language, built from many of the better features found in C, C++, Visual Basic, and Java. Moving applications from any other language to C# will be a chore, but a chore on par with a movement to Java. Unlike C and C++, yet much like Java, C# has an object-oriented nature—all data in C# is an object. Along with other features, this makes C# a much simpler language than C or C++.

Another simplification restricts operation to a single inheritance. To make up the difference, C# supports multiple interface definitions with a class definition, as does Java. But C# goes a step further with delegations. A delegation is actually a tool for supporting COM+, but it's a generally useful programming feature for handling anonymous function invocations, too.

C# inherits much of its syntax from C and C++. Consequently, it's a natural alternative for programmers with this type of background. Semicolons, curly brackets, and square brackets abound, yet many familiar C and C++ constructs disappear.

For example, C# supports references but not pointers. The syntax for accessing elements of an object reference is the same as for accessing elements of a local variable—a list of names separated by periods. The use of references lets C# easily support garbage collection. C# also forgoes the use of C- and C++-style "#include" statements, providing a namespace system that's more robust than Java's.

This language goes its own way in a number of other areas, like its support for conditional compilation and array support. It also has an interesting method for documentation embedded in the source code. XML tags can be included in special "/doc" comment statements. This information is then used to generate XML documents.

With strong ties to the Windows platform, C# provides access to C API calls and supports the COM+ Common Language Subset specification. Explicit marshalling expressions handle native COM data types. Support for COM and COM+ will be easy, but this may restrict portability if Microsoft or third parties provide C# on other platforms.

While the complete definitions of C# and its support environment are yet to be finalized, currently available information indicates that C# falls short of Java in some areas. For instance, the C# specification doesn't address multitasking and related interprocess communication functions. A lock statement provides rudimentary synchronization support, but this is very limited compared to Java's process model.

Sun has surrounded Java with significantly more features, from JavaBeans to enterprise services. Microsoft, though, will have COM+ and its vast collection of services available to C# programmers. Developers will be tied to the Windows platform because most COM+ services are only available on this platform.

A work in progress, some of C#'s limitations may be addressed in its final form. Likewise, Microsoft will provide a clear development and support path once real development tools and sample programs are made available to the public.

Microsoft's web site is a good source of information on C#. Articles about C# are starting to appear in the trade press as well. Product delivery dates haven't been published yet, but it's clear that 2001 will be the starting point for major C# development.

C# will need to show up in three places to be considered for embedded systems: Microsoft's Visual Studio, one of the Windows CE embedded programming languages, and third parties that decide to develop support on non-Windows target platforms. These third parties will greatly depend on whether Microsoft releases control of C# to a standards organization or retains strict control itself, as it does with Visual Basic.

For more information about C#, visit www.microsoft.com.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.