Jalil Vaidya

Virtual home in cyberspace!

Whats the need for .NET ?

Microsoft came out with the new development platform called .NET. It provides a new way to develop applications for Windows OS. Windows developers vouch that it makes developing certain kinds of applications very easy to develop. Sure it does, I agree. But was there a real need for a whole new development platform ?

Application development on Windows platform has come a long way. When Windows 1.0 was first released, Microsoft also released a set of APIs to enable programmers to write applications for Windows. These APIs were a set of C functions used to create the Graphical User Interface or GUI of an application and carry out other application functions. A rich set of functions were created for Windows OS that replaced most of the C functions that the developers were used to. As Windows OS grew, so did these APIs. Over the period of time, Microsoft created new technologies to develop applications on Windows platform. The first in the line, if I am not mistaken, was Dynamic Data Exchange or DDE which was used as a uniformed way to exchange data between applications.

The new technologies that Microsoft came up with over the period of time where for data exchange between applications during runtime. The next installment of DDE was OLE or Object Linking And Embedding. OLE not only enabled applications to pass data between each other but it also enabled one application to be used inside of other application as if it were a part of first application. A classic example of this is editing an Excel spreadsheet from within a Word document. A user will first insert a spreadsheet in a document and then double click on the spreadsheet to edit it from within Word application. The menus and toolbars in Word will be replaced by that of Excel's providing the user with the full capabilities of Excel inside Word. This worked like magic for users and developers were able to develop such powerful applications to enhance user experience. Even today this technology is used in applications. For example, when you click a link to a .pdf file in Internet Explorer, Acrobat opens up automatically and enables you to view the pdf document inside IE with full capabilities of Acrobat.

As Object Oriented Programming gained grounds in Software Engineering community, Microsoft kept enhancing its application development technology. Component Object Model or COM was a newer incarnation of OLE. COM allowed developers to write reusable code components. Instead of writing a monolithic self-contained application, developers now write individual components that can be assembled into an application. The individual components can be used in more than one application providing the reuse at binary level instead of just source code level. Application developers where encouraged to write components that will provice common functionality, like File I/O, that can be used by different applications without having to rewrite the same code again and again. Only one copy of the component is required on the machine which will be shared by all the applications. COM gained a widespread popularity and has stood test of time. COM has further matured into ActiveX, MTS and COM+. All of these technologies provided greater strength to component development technology. Microsoft also developed tools and libraries that made it easy to develop COM components. Microsoft also provided COM components that carry out common tasks and upgraded its own other technologies to use COM. For example, data access was orignially done using Open Database Connectivity or ODBC. The data access technology was upgraded to DAO, RDO, ODBC-Direct, ADO and finally to OLE-DB. The GUI APIs were also moved from straight C/C++ functions to VBX, OCX and ActiveX controls. Microsoft continously upgraded its parallel technologies to use its own new application development technologies. However, it is worth noting that Microsoft never gave up or discarded the original C based APIs. On the contrary, these APIs were extended and new set of APIs were continously added to the Windows API set. The newer component based technologies were a just a wrapper around these APIs. Be it MFC, WTL, Visual Basic Forms or VBX/OCX/ActiveX controls, they all called the underlying Windows APIs for creating GUIs. Data-Access wrappers like DAO, RDO and ODBC-Direct called the ODBC APIs under the cover. DDE, OLE, COM/MTS/COM+ are actually implemented using a set of APIs. Microsoft always encouraged developers to use COM when developing an application. A whole new industry came into existence which developed and sold COM based components. It became a defacto standard of application development in Windows. Microsoft provided its own set of COM component libraries to make developer's lives easy. For data access there was ADO/OLE-DB. For File I/O there was FileSystemObjects. There was MSXML parser COM component for XML. For almost all kind of requirements there was a COM component library either from Microsoft or from Third-Party vendor. COM technology is more than a decade old and has a solid foundation. Developers and companies around the world had spent endless amount of time, money, energy, efforts and resources on COM based development.

So why did Microsoft ditch this rock solid technology and came up with .NET ? The answer is not very easy to convince. .NET is a whole new platform for application development. It is a paradigm shift. Microsoft boasts of number of features the major ones being cross-language development and an exhaustive class library to speed up application development. The huge class library certainly makes it easy to develop applications.

Lets first take a look at the class library argument. It is common to hear expressions like "I can write a Windows Service very easily now with .NET" or "It takes 5 lines of code to write a FileSystemWatcher with .NET classes". .NET class library makes it easy to develop applications which were difficult to develop earlier. You just said it - Class Library. So all it is that makes things easy is a class library. There are classes now available for certain things that were not available before. So all that was needed was a new set of class libraries, a new set of COM components. Microsoft has provided COM libraries in past. They could have done it again. Why didn't they do it ? Why write a whole new platform instead and then write a class library for this new platform ? All that was needed was just a few new COM components like they have MSXML parser or SOAP toolkit for COM. Instead Microsoft choose to force developers and companies to adopt a totally new development environment and sooner or later rewrite entire applications. Why ?

Another argument in favor of .NET is ability to do cross-language development. A class or component developed in any language that supports .NET can be easily used in another language that supports .NET. For example a class written in VB.NET can be used without any kind of changes from C#. The developer doesn't have to worry about what language that .NET component is written in; he/she can just use the component in his/her own favourite .NET language. But what the heck is new in that ? COM already supported cross-language development. A COM component written in C++ can be used in Visual Basic without any changes. A component written in VB can be easily used from Delphi or Powerbuilder or for that matter even Perl. This was possible because COM itself is built for compatibility at binary level from any language or development platform. Whether it was C++, VB, PB, Delphi, Java or Perl, developing a COM component in one language and using it in other was what COM was meant for. So why promote a new "feature" which has absolutely nothing new ?

Instead of providing a set of new libraries, Microsoft is forcing everyone using Windows platform to abandon their current investments in existing technologies and adopt a totally new platform. .NET is a major change. It not just about learning a new language. It is about getting aquainted with new platfrom, a new way to work. It has a steep learning curve, about 6 months for an average programmer. Adopting new platform means investing lot of time, money, energy and resources, the returns of which will not be obtained for a long time. Its not that such a drastic change was inevitable. In fact, it was not at all required.

Does it make any business sense to invest a huge amount of money and resources to do something in a totally new way that could have been done very easily and with a fraction of cost ? Perhaps not to you but to Microsoft it does. Microsoft is making a very very long term investment and building up strategy to keep its control over computer and software industry. It was not even a huge investment for Microsoft either. It is in fact a little more investment over the one already made and getting returns out of it. How ? You may ask. Here it is how...

As you might already know, Microsoft lost a lot of its market to Java. There are about 2.3 Million Java Developers and the number is only increasing. This means that there is a huge market that Microsoft lost which directly translates into loss of revenue. If there were no Java, most of those 2.3 Million developers would have been using Microsoft products bringing in a lot of cash flow. Although Microsoft riddiculed Java early on, it had to endorse it later. Instead of totally loosing on to Java, Microsoft came out with its own version of JVM and Java related tools. Microsoft arguable developed the best JVM for Windows platform (and only for Windows platform). Java was also integrated with Windows and in the process of which they tried to change it so much that code that runs on Windows won't run on any other platform. Microsoft got slapped for its anti-competitive practices and monopolistic behaviour and started loosing grounds in Java. Microsoft had already invested very heavily in Java and giving up on Java would mean heavy losses. Instead, Microsoft decided to invest a little more in the technology that they already had and win back the market that they lost. Microsoft is already convinced that the underlying concepts of Java are very solid and people are buying in to it. It is now well known that Microsoft gathered its best of the engineers that worked on Java and developed .NET which is based on exactly the same concepts and principles of Java. Those who have used Java and C# know that C# is just a better Java. Microsoft may not be very good at developing new and innovative technologies but it certainly does a fairly decent job in building upon existing technologies. Java had its own flaws which needed to be corrected. With C#, you get a better Java and then some. By developing .NET and C#, Microsoft is not only saving its investment in Java but the close resemblence to Java will also help them win back a chunk of what it lost to Java. Microsoft even developed a version of Java called J# for .NET to make sure it gets back lot of Java using developers and companies.

Microsoft is not leaving any stone unturned in promoting .NET and C#. In doing so it is trying to drive away the developers from using existing technologies. They are asking developers to no longer use Windows APIs or COM technologies that they are currently using. They will enforce this by stoping support to Visual Studio 6.0 and earlier development tools so sooner or later everyone will have to move on to .NET. They do understand that this will not happen overnight. So they have a Interop layer which facilitates the usage of existing technologies and provides a "smooth and comfortable" transition. However, the funniest part about the entire .NET platform is that it totally depends upon existing technologies!!! Get Anakrino and peek into .NET code. It calls Window API under the hood. When an application Window is created, .NET calls CreateWindowEx API. When you click on that "X" button to close the Window, it calls the same SendMessage API with WM_CLOSE message. The FileSystemWatcher calls ReadDirectoryChangesW API to do its work. The C# compiler itself is implemented using COM and Visual Stutido depends heavily on COM too. Even the Common Language Runtime or CLR, which is equivalent to JVM, is implemented using COM. Everything in .NET is done using Windows APIs and COM under the hood. .NET is just a wrapper around Windows APIs and this is not changing anytime soon either. The entire functionality of Windows is yet to be moved to or wrapped under .NET. As a matter of fact, the functionality of only about 15-20% of Windows API is moved to .NET so you still need the APIs and COM. But sooner the developers move on to .NET, the better it is for Microsoft.

So where does all this leave developers like me ? I wish Microsoft didn't force every other Windows using developers and companies to waste time, money and energy moving on to something which has no apparent advantages to anyone except Microsoft. Re-iterating the point, things could have been done in an easier, less expensive way. Personally, I don't really care much. I will develop on any platform/language/OS that my employer asks me to. As long as I am paid I am fine with working with your favourite tool :-) I just wish I didn't have to go through unnecessary hassle for no reason...

This article was last updated by Jalil on December 27, 2002 10:43 PM