Learning Windows Server 2003
9.1. What Is .NET?
.NET is two things: a state-of-the-art software platform, and a prime example of a marketing disaster. I'll try to focus on the former before I proceed, though, I would like to recommend that if you have been frequenting Slashdot.org or watching a lot of TV, please wipe your mind of all prior knowledge related to .NET. Most likely you are another victim of the Microsoft marketing department, which at one point had slated every Microsoft server product, including Windows Server 2003, to include the .NET name. Many months of disorder passed before Microsoft, probably inspired by a confused techie, finally reverted to a more sensible naming convention for its product line. Today only a few artifacts outside of the .NET software platform contain .NET in their names. I've already stated that .NET is an amazing software platform. The next step is to actually define "software platform." A software platform is composed of the following elements:
Now let's cover how .NET addresses each element. 9.1.1. Language
Prior to .NET, a single language defined a software platform. Examples of other platforms are Java, Visual Basic, and C++. Each platform corresponds directly to a language. Component Object Model (COM) and other technologies have made strides to allow interoperability between languages, but it's been at the expense of productivity and, most importantly, developer sanity. .NET implements the concept of language interoperability from the bottom up. First it lays the ground rules: the Common Language Specification (CLS) and the Common Type Specification (CTS). Languages must abide by these rules to maintain interoperability with other languages. Currently Microsoft has incorporated several different languages into .NET, including C#, Visual Basic, Visual C++, Jscript, and J#. Microsoft recommends developers use C# and Visual Basic for general development and the other languages for ease of code migration or for rare scenarios that are beyond the scope of this chapter and book. Microsoft also has opened the floodgates for anyone with a few spare hours to write a language compiler from scratch. .NET compilers for languages from COBOL to Perl have been developed and are freely distributed more often than not. You can find an up-to-date list at http://www.jasonbock.net/dotnetlanguages.html. 9.1.2. Libraries
Libraries provide building blocks for applications. You can accomplish tasks such as sending an email or updating a row in a database with minimal code by using a well-designed set of libraries . Traditionally, developers could depend on only a limited set of libraries to be present on a system before installing an application. Additional libraries required for an application would need to be packaged with the application before deployment. The concept of a robust class library in a PC environment began with the advent of Java. .NET expands the idea of a class library with the .NET Class Library (sometimes referred to as the .NET Framework). The .NET Class Library includes thousands of different classes enabling the development of very complex applications without many dependencies outside of a base .NET Framework installation. Some of the most widely used libraries cover the following functionality:
9.1.3. Tools
A software platform requires a solid set of tools , such as code editors, help documentation, build tools, debuggers, and similar items, to support widespread adoption. Microsoft has continued the evolution of the Integrated Development Environment (IDE) with Visual Studio.NET. An IDE, as inferred by the name, is designed to provide the developer with all needed development functionality in a single application. Wizards, project templates, and database connectors are extras that make an IDE attractive. Developers on a low budget or that like a little more control have not been forgotten with .NET. Microsoft distributes the .NET Framework and a Software Development Kit (SDK) free of charge. These two combined provide a crude subset of a full toolset, the most notable inclusions being documentation and compilers. Combine these with a favorite code editor and you're in business, as long as you can live without the wizards and other pizzazz of Visual Studio.NET. 9.1.4. Runtime
Not too long ago, software demands were quite simple and hardware resources were limited. With this in mind, developers could spend great amounts of time on simple tasks and focus heavily on efficiency. This mindset can be attributed to causing the Y2K hoopla, as developers trying to squeeze a little more data into a little less space decided that two digits were adequate to represent date years. Alas, times have changed. Software demands have become increasingly complex and the availability of hardware resources has increased by several orders of magnitude. This has allowed the developers to transfer a lot of the low-level, bit-twiddling work onto their new best friend, the runtime. Runtimes provide services to running code. Think of a runtime as your maid, your personal trainer, and your banker, combined digitally to serve your application. The runtime does all the dirty work that you had to do yourself, before you won the lottery. This includes cleaning up, managing performance, and making sure everything is correct along the way. The Common Language Runtime (CLR) is the runtime for .NET. The name Common Language Runtime is somewhat deceptive. The name implies that code from each common language can be compiled and executed directly by the runtime. Actually, language code is not compiled directly. First it is compiled by the language compiler into Intermediate Language (IL) code. IL exists as a layer of abstraction to provide a common set of instructions in a very machine-efficient manner. The CLR operates exclusively with the IL code. All types of .NET applications are hosted inside a CLR instance. The CLR provides a multitude of optimized services to application code. Automatic memory management, also known as "garbage collection," is arguably the most important service the runtime provides. The term garbage collection has earned itself quite a stigma because of some of the substandard implementations in the Java world. The implementation within .NET should alleviate the stigma. As well, just-in-time (JIT) compilation provides machine-based optimization to code at runtime. This allows the deployment of common code that you can optimize for future computer architectures. |