Microsoft ASP.NET and C# for Java developers

Summary of .NET web software development from a Java developer’s perspective

By Stewart Sims

There are two major competing web development technologies, one based on Sun Microsystem’s Java and the other on Microsoft’s .NET framework. Both have evolved into powerful tools for developing web applications. They are capable of producing simple dynamic web pages to vastly complex enterprise web systems. Regardless of the positive and negative aspects of both web platforms that may exist – it is necessary at this time for most web developers to at least familiarise themselves with both technologies.

Some basic distinctions between the two:

Part of web system

.NET

Java

Programming language

Multiple – C Sharp, J Sharp, VB

Java (J2SE)

Flagship IDE

Microsoft’s Visual Studio

NetBeans

Dynamic presentation pages

Active Server Pages (ASP) / ASP.NET

Java Server Pages (JSP)

Web containers/application servers

Microsoft Server

Any supporting Java – GlassFish, Apache Tomcat etc.

There are many differences between the two platforms but, due to the consistant nature of internet and web protocols they must work with, both have remarkable similarities.

The structure of a web application generally comprises of three layers. One layer for a central data storage system – which is generally some form of SQL database. Then there is a business / application logic layer which is written almost entirely in the corresponding programming language and interacts with the database. Finally there is the presentation layer which formats the output for the user to interact with – it is the web user interface.

It is generally accepted that the most useful programming language in Microsoft’s army of ‘supported languages’ (those that the .NET supports) is C Sharp (C#) - which to any developer other than those with the laziest of eyes is quite clearly based on Java itself. There are many differing features, but to give the language a name that suggests it is a variant of C/C++ seems somewhat misleading. It is more apt to think of C# as Microsoft’s flavour of Java.

While a full version of Visual Studio might be an attractive development environment for someone looking to quickly pickup some skills in the use of ASP.NET and C# I would actually recommend the freely available version for .NET called Visual Web Developer Express. The Visual Studio environment seems incredibly cluttered and only serves to confuse matters from my perspective at least.

Here’s some basic pieces of information that might be useful to someone starting out with ASP.NET and C#:

The strucuturing of web applications follows the same principles in both Java and .NET: The web is the real platform you are working with.

Utility and model classes can be built in C# just as in Java and a modular design that utilises these sort of back-end classes is advised wherever possible.

You can document code in C# using the XML comment triple slash /// – this operates very similarly to javadoc in Java.

In C# ‘namespaces’ can be used to add extra definition to parts of object oriented code (e.g. in the namespace ‘bob’ we may have class ‘something’, accessible via ‘bob.something’

There are a few differences between C# and Java relating to specific details such as inheritance in object orientation, but both languages are not monumentally different. If you are familiar with Java you are probably better off learning as you code rather than attempting to commit to memory all the intricate differences between the languages at once.

Once you start thinking about more complex web systems where a careful architecture and design is required there are further differences between the two technologies. There is no direct equivalent of JavaBeans or Enterprise JavaBeans in ASP.NET. There are Enterprise Services and Message Queuing technologies in .NET, but these do differ. Unsurprisingly these can only be used with Microsoft Server. Of course .NET is enevitably all aimed towards deployment on Microsoft products and operating systems, but it is worth noting that the parts of the technology designed with extensibility and interaction with other software are platform specific. This needs to be taken into consideration when designing and developing more advanced systems.

The main thread explored in this summary is the similarity between the two technologies and the view that if you can do something with the Java platform, you can do exactly the same in .NET and vice versa. However there are inevitable differences in the ease of development, the choice of deployment mechanisms, and the performance and effeciency of systems produced using either web platform. Hopefully this document provides a basis for those who work with Java to get their head around Microsoft ASP.NET.

Where do I go from here?

There are many books about Microsoft’s ASP.NET and C# as well as plenty of web resources. The information on the web relating to .NET technologies can be somewhat confusing, so finding a good quality book would be my recommendation. It can get somewhat confusing considering there are a plethora of web technologies out there and both useful and useless ways to implement them. If you’re knowledgable about web systems in general and have experience building web applications it is not worth re-learning what you already know, so you may not even need to read much of a well-written text to get your head around ASP.NET.

What will prove most useful is practice building simple web applications using Microsoft Visual Web Developer Express or a third party IDE. If you are used to working with Java, Java Servlets, JSP and/or J2EE after a short time experimenting with .NET you should begin to see how you can implement familiar concepts with the platform. My feeling is that the best way to transfer your skills is the path of least resistance – which in this case is recognising familarities and building on them and making note of any differences you come across along the way.