Home > Store > Programming > Windows Programming

Programming in the .NET Environment

Register your product to gain access to bonus material or receive a coupon.

Programming in the .NET Environment

Book

  • Your Price: $39.99
  • List Price: $49.99
  • Available on demand.

About

Features

The authoritative guide for developers who want to develop software that fully takes advantage of the .NET Framework.

° One of the first books in The Microsoft .NET Development Series, direct from Microsoft

° Well-known and influential author team. Microsoft has sent Damien on a worldwide speaking tour.

° Not only describes the goals and architecture of the .NET Framework, but also demonstrates how it implements facilities and services to meet these goals.

Audio & Video

Video

Watch a video from the authors.

Description

  • Copyright 2003
  • Dimensions: 7-3/8x9-1/4
  • Pages: 560
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-77018-0
  • ISBN-13: 978-0-201-77018-6

Programming in the .NET Environment is the software developer's guide to the .NET Framework. The authors describe Microsoft's vision for distributed component-based systems development and then show programmers how to develop software that takes full advantage of the features of the .NET Framework. Readers learn how to author components, libraries, and frameworks that not only exploit the capabilities of the .NET Framework but also integrate seamlessly into that environment.

This book begins with an introduction to the goals and architecture of the .NET Framework. Readers will then gain a thorough understanding of the type, metadata, and execution systems; learn how to build and deploy their components within .NET assemblies; and gain an understanding of the facilities of the Framework Class Libraries.

Topic coverage includes:

  • The Common Language Runtime (CLR) and the Framework Class Libraries
  • The CLR's Type, Metadata, and Execution Systems
  • Creating and deploying .NET Assemblies
  • Internationalization and localization facilities
  • .NET Languages, including C# and Visual Basic .NET

The book concludes with appendixes written by other specialists in the field: Paul Vick (writing about VB .NET), Eric Gunnerson (on C#), Mark Hammond (on Python for .NET), Jan Dubois (on Perl for .NET), John Gough (on Component Pascal for .NET), Pankaj Surana (on Scheme for .NET), Nigel Perry (on Mondrian), and Juerg Gutknecht (on Active Oberon for .NET).

Written by a team of experienced authors using a practical, authoritative approach, Programming in the .NET Environment is an indispensable guide to developing components that fulfill the promise of Microsoft's .NET Framework.

Books in the Microsoft .NET Development Series are written and reviewed by the principal authorities and pioneering developers of the Microsoft .NET technologies, including the Microsoft .NET development team and DevelopMentor. Books in the Microsoft .NET Development Series focus on the design, architecture, and implementation of the Microsoft .NET initiative to empower developers and students everywhere with the knowledge they need to thrive in the Microsoft .NET revolution.



0201770180B10312002

Downloads

Source Code

Source Code

Source code

Sample Content

Online Sample Chapter

Programming in .NET: The Type System

Downloadable Sample Chapter

Click below for Sample Chapter(s) related to this title:
Sample Chapter 2

Table of Contents

(NOTE: Each chapter concludes with a Summary.)

Foreword.


Preface.


1. Introducing the .NET Framework.

Programming Issues.

Programming in the Small.

Programming in the Large.

Solutions.

Comparing the .NET Framework and IDL-Based Systems.

Elements of the .NET Framework.

Common Language Runtime.

Base Framework.

Exposing the .NET Framework.

Windows Clients.

ASP.NET: Web Forms.

ASP.NET: Web Services.

Terminology.

The Type System.

The Metadata System.

The Execution System.

Example: Hello World.



2. The Type System.

The Relationship Between Programming Languages and Type Systems.

The Evolution of Type Systems.

Programming Language-Specific Type Systems.

The Design Challenge: Development of a Single Type System for Multiple Languages.

CLR-Programming Language Interaction: An Overview.

Elements of the CLR Type System.

Value Types.

Built-in Value Types.

User-Defined Value Types.

Reference Types.

Object Types.

Interface Types.

Pointer Types.

Example: User-Defined Object Type.

Example: Use of Interfaces on Value Types.

Assignment Compatibility.

Nested Types.

Visibility.

Accessibility.



3. The Metadata System.

Medata Issues.

Saving Metadata About Types: IDL Files.

Reflection: Inspection of a Type's Metadata.

Reflection Classes.

Example: Using Reflection.

Example: Use of Type as an Abstract Type.

Metadata Tools and Extensions.

A Tool for Reading Metadata.

Metadata Extensibility.

Dynamic Discovery of Types.

Assemblies and Manifests.

Meta-Programming.

Metadata File Format.

COM Interop.



4. The Execution System.

The Execution System Versus Other—Component Models.

Intermediate Language.

Example: Generating Intermediate Language.

Verification of Intermediate Language.

Starting a CLR Program.

COR Debugger.

Application Domains.

Memory Management.

Value Types Versus Reference Types.

Garbage Collection.

Security.

Role-Based Security.

Evidence-Based Security.

Policy Manager.

Code Groups.

Named Permission Sets.

Policy Assemblies.

Examining Policy Levels and Permission Sets.

Stack Walks.

Declarative and Imperative Style.



5. Building Applications.

Existing Technologies to Solve Application-Related Problems.

Well-Known Locations.

Search Paths.

Symbolic Names.

Versioning-Related Technologies.

Windows Registry.

Assemblies.

Example: A Simple Assembly.

Version 1 of AboutBox.

Building the Assembly with nmake and makefile.

Functioning of the makefile.

Embedded and Linked Resources.

Example: A .NET Assembly with Embedded Resources.

Example: A .NET Assembly with Linked Resources.

The Assembly Linker.

Public and Private Assemblies.

Strong Names.

Assembly Caches.

Example: Creating and Using Public Assemblies.

Assembly Versioning.

Example: Building a Second Version of an Assembly.

Example: Binding to a Different Version of an Assembly.

Internalization and Localization.

Definitions.

Existing Technologies: Separation of Code and User Interfaces.

.NET Localization Concepts.

Example: A Localized Application.

Application Domains.

Application Domains Versus Processes.

Use of Application Domains.

Example: Retrieving Current Application Domain Information.

Example: Creating and Manipulating Application Domains.

Example: Loading Assemblies into Application Domains.



6. Deploying Applications.

Configuration Files.

Text-Based Configuration Files.

CLR Configuration Files.

Which Configuration Files to Use?

Downloading Web Content.

Referencing Assemblies with the codeBase Element.

The Download Cache Revisited.

Web Controls.

Installing Applications.

Copying Files to the Computer.

Downloading Files to the Computer.

Using Traditional Installation Programs.

Installing the .NET Framework.

The ECMA CLI Standards.

Compact Framework.

Smart Device Extensions.

Shared Source Common Language Infrastructure.



7. The Framework Class Library.

A Historical Perspective.

C/C++.

SmallTalk.

LISP.

C++.

Java.

Support for Multiple Programming Languages.

Goals of the .NET Framework.

Unify Programming Models.

Be Factored and Extensible.

Integrate with Web Standards and Practices.

Make Development Simpler.

Design Guidelines.

Naming Guidelines.

Member Usage.

Namespaces.

System.

System.Collections.

System.Data.

System.Globalization.

System.Resources.

System.IO.

System.Net.

System.Reflection.

System.Security.

System.Text.

System.Threading.

System.Runtime.InteropServices.

System.Windows.Forms.

System.Web.

System.Web.Services.

System.Xml.

Looking Back and Looking Ahead.



Appendix A: Visual Basic .NET.

Type System Additions.

Classes.

Inheritance.

Overloading.

Namespaces.

Type System Modifications.

Arrays.

Variant and Object Types.

Structures.

Date, Currency, and Decimal Types.

Platform Changes.

Deterministic Finalization and Garbage Collection.

Let and Set Assignment.

Late Binding.

On Error and Structured Exception Handling.

Events and Delegates.

Language Cleanup.

New Features.

Future Directions.

Conclusions.



Appendix B: C#.

History and Design Goals.

A Brief History of C++ and C#.

C# Design Goals.

The C# Type System.

Reference Versus Value Types.

User-Defined Types.

Component-Oriented Development.

Properties.

Indexers.

Operator Overloading.

Attributes.

Delegates.

Events.

Unsafe Code.

Advanced Interoperability.

Dealing with Existing Structures.

Performance Extremes.

Neat Things.

foreach.

switch on String.

params Arrays.

XML Comments.

A Stack Component Example.

Future Directions.

C# and Standardization.

Conclusions.



Appendix C: Python for .NET.

A Brief Overview of Python.

About Python.

Python Implementations.

Terminology.

Python for .NET.

Current Status.

Architecture.

Using Python for .NET.

Example: Hello World.

Using .NET Objects.

Method Signatures and Overloads.

Other Examples of Compiler Techniques.

Limitations of Python for .NET.

Performance.

Closed World Syndrome.

Class and Instance Semantics.

Type Declarations or Inference for Speed.

Type Declarations for Semantics.

Possible .NET and Python Enhancements.

Type Declarations.

Dynamic Language Support.

Alternative Implementation Strategies.

Python for .NET.

The Compiler.

The Runtime.

The Library.

Conclusions.



Appendix D: Perl and the .NET Runtime.

Perl for .NET Research Compiler.

The Parser.

The Code Generator.

The Runtime Library.

PerlNET Component Builder.

Interface with Standard Perl Interpreter.

Challenges.

Supported .NET Features.

PerlNET Status.

Example: A Windows Forms Application.

Conclusions.



Appendix E: Component Pascal on the CLR.

About Component Pascal.

The Type System.

Statements.

Module Structure.

Mapping to the CLR.

Mapping the Program Structure.

The Synthetic Static Class.

Controlling Visibility.

Mapping the Type System.

Static Record Types.

Dispatched Methods.

Semantic Challenges.

Nonlocal Addressing.

Structural Compatibility of Delegates.

Covariant Function Types.

Conclusions.

Compatibility Extensions.

Performance.

Notes.



Appendix F: Hotdog: Compiling Scheme to Object-Oriented Virtual Machines.

Introduction to the Hotdog Scheme Compiler.

Scheme, Briefly.

Object-Oriented Virtual Machines.

Implementations.

Closures.

Small Values.

Dynamic Type Checking.

Limitations.

Performance Improvements.

Conclusions.

References.



Appendix G: Functional Languages for the .NET Framework.

A Brief Introduction to Mondrian.

The Type System.

Exception Handling.

Concurrency Support.

The Syntax.

Types in Mondrian.

Primitive Types.

Type Products.

Type Unions.

Parametric Types.

Functions in Mondrian.

Monomorphic Functions.

Polymorphic Functions.

Partial Applications.

Just-in-Time Evaluation.

Calling Other CLR-Hosted Languages.

The Power of .NET: A Multilanguage Example.

The Sieve of Eratosthenes in C#.

The Sieve: Combining Mondrian and C#.

A Glimpse into the Future: Improving the Interface.

Conclusions.

References.



Appendix H: Active Oberon for .NET: A Case Study in Language Model Mapping.

History of the ETH Programming Languages.

The Active Object System.

An Extended Concept of Object Types.

A Unified Concept of Abstractions.

A Concept of Static Modules.

The Mapping to the Common Type System.

Recapitulation of the .NET Interoperability Framework.

Mapping Modules.

Mapping Definitions.

Interoperability.

Mapping Active Behavior.

Language Fitting.

Summary and Conclusions.

Acknowledgments.

References.



Glossary.


Suggested Reading List.


Index. 0201770180T10292002

Preface

Introduction

Developing large distributed software systems is a complex and interesting challenge. A number of architectures have been developed to simplify this task and distract developers from the many interoperability issues associated with developing such systems. This book is predominantly about one of those architectures, Microsoft's .NET Framework.

An often-asked question is "so what is new in the .NET Framework?" On one level the answer is "not much." To put this answer into context, the same may be said of most recent software advancements. As an example, C++ was a significant step forward but it was the amalgamation of the object oriented concepts of Simula 67 and the efficiency of C. Java also contained very little new science, with the concepts of virtual machines and class libraries having been commonplace for many years. So how then do these advancements contribute? Often they contribute via synergy, the combination of known technologies in a new and different manner that allows developers to combine two powerful concepts in a single architecture. So it is with the .NET Framework. Although there are significant benefits to be gained by using the Framework, many readers will be relieved to see that many familiar concepts exist in the environment, although their implementation may have changed.

For example, a major concept pervading the .NET Framework is object orientation. Recently this paradigm has seen enormous acceptance in many areas from Graphic User Interface (GUI) development through to network programming. The .NET Framework provides support for all of the object oriented concepts such as classification, information hiding, inheritance and polymorphism. What is new in the .NET Framework is that language boundaries have been removed. The .NET Framework also extends these concepts in concert with other concepts. For example inheritance can be subject to security constraints; just because you can use a type it may not follow that you can subtype from that type.

Audience

It is important to understand the target audience that this book was written for in order to know if this book is for you. This book is targeted at software developers who wish to:

  • Understand the philosophy and architecture of the .NET Framework,
  • Produce generic frameworks, libraries, classes and tools to be used in the .NET Framework, and
  • Use multiple languages to develop in the .NET Framework.

As this book is targeted at software developers, it not only describes the goals and architecture of the .NET Framework but also demonstrates how the technology implements facilities and services to meet these goals. Understanding the philosophy and architecture of .NET is important for any distributed system developer even if they do not use the .NET Framework. Why? The .NET Framework represents Microsoft's vision of distributed system development for the Internet. By understanding the architecture of the .NET Framework developers gain an insight into the issues associated with distributed systems development and Microsoft's solution to these issues.

Once developers have an understanding of the .NET Framework's architecture, the next step is to develop software that utilizes the framework. The .NET Framework is not an abstract programming model, it is a full-featured system that allows developers to implement their solutions and then make them available to other developers in a robust and secure environment. As the .NET Framework is language agnostic, developers can use the right language to develop parts of a system and then incorporate these parts together at runtime regardless of language differences.

So who is this book not for? This book is not an introduction to programming; readers should have experience developing software before reading this book. This book is also not the definitive guide to all aspects of the .NET Framework nor any single aspect of the .NET Framework. A single book that covered in detail all aspects of the .NET Framework would be almost indigestible. There will be books devoted to a single part of the .NET Framework, such as ASP.NET. Hopefully this book is a solid overview of fundamental aspects of the .NET architecture but for individual aspects, such as the security system, readers will have to refer to other texts or specific documentation for a complete treatment of a specific topic.

Book Structure

The structure of the book is fairly straightforward:

  • The Introduction Section of the book describes the basic concepts and gives background information on the issues involved in distributed system development.
  • The Runtime Section describes the issues that can be thought of as "Programming in the small." This section deals with issues such as defining types, storing metadata and executing programs.
  • The Building and Deployment Section deals with the hard issues in distributed systems development. Issues such as assembling and developing software from components and deployment issues are covered here. This section also covers the Base Framework, the libraries used to build applications.
  • Finally the appendixes contain important peripheral information that does not fit into the first three sections of the book. This includes experience reports from people who have developed compliers for the .NET Framework.

Our motivation for writing the book

"So why are we writing the book?" We have asked this question many times over.

In late 1998 Monash University was asked if it would like to be involved with Microsoft in the development of the "next generation of COM", which was then known as the COM Object Runtime (COR). The invitation to join Project 7, the name for this multinational joint collaboration between Microsoft and a number of universities, came from James Plamondon at Microsoft Research. Why was Monash University chosen? The major reason was because of our association with Bertrand Meyer and his object oriented programming language Eiffel. Even at this early stage Microsoft was firmly focused on having as many languages as possible supported by the runtime. Monash University accepted the invitation and Damien attend an overview in Atlanta during early 1999. The idea of writing this book was first discussed at that meeting. Having just attended the preview of COR, which was now known as Lightning at this time, Damien asked James Plamondon if he knew of anyone that was writing a book on Lightning. Even at this early stage it was clear that a number of books would be required to cover all of the aspects of Lightning but Damien also wanted to see that the small, but hopefully beneficial, involvement of Project 7 members was recorded. James encouraged Damien to consider writing such a book and, after a few years and numerous changes, this book is the outcome of that conversation. The appendixes in this book are the acknowledgement of the work done by many people outside of Microsoft on Project 7.

Mark Hammond has been involved in Python development since 1991, developing and maintaining the Win32 extensions for Python, which includes the PythonWin IDE and the support libraries for COM. Mark had been involved with Microsoft since the mid 1990s in Python related projects, most notably the ActiveScripting and ActiveDebugging extensions for the Python language. In 2000 Mark released his first book, Python Programming on Win32, co-authored with Andy Robinson.

In 1998, due to the increasing popularity of the Python programming language, the Project 7 team decided that Python should be one of the initial languages ported to the platform. Mark's history with Microsoft meant that he was the obvious choice and being located in Melbourne Australia along with two other initial participants, Melbourne and Monash Universities, meant that a core group of Project 7 participants formed almost exactly on the other side of the world from Seattle. This is how Damien and Mark met.

Brad was fortunate to be around for the birth of the Common Language Runtime, cutting his teeth in API design and working on fundamental types such as System.Object and System.String. He participated in the earliest design decisions that would later reflect across the breadth of the .NET Framework and in fact all .NET code. Brad was very enthusiastic about the cross language support being built into the runtime while leading the team that developed the Common Language Specification.

Early in 1998 Adam Smith, a developer from another team, asked if he exposed properties from his library could VB (and other languages) consume his API. Brad did what any respectable Program Manager at Microsoft would do and called a one hour meeting to decide what features of the CLR would be available in all languages. That meeting didn't resolve the issue, in fact it took well over three years and thousands of hours from key architects inside of Microsoft such as Anders Hejlsberg, Peter Kukol, Paul Vick, Alan Carter, Scott Wiltamuth, George Bosworth, Lauren Feaux, Ian Ellison-Taylor, Herman Venter, Jonathan Caves, Francis Hogle, Mark Hall, Daryl Olander, Craig Symonds and Brian Harry to answer this question. Later we reviewed and honed the CLS with a group of key language innovators outside of Microsoft, the Project 7 members. It is through this effort that Brad met Damien and Mark.

As a byproduct of working out what was to be included in the CLS many "Best Practices" were developed. Brad started writing these best practices down in what would later become the .NET Framework Design Guidelines document. This document lead the way in driving for consistency and usability across the APIs exposed in the .NET Framework. The work on the CLS and the Design Guidelines document lead Brad into a unifying role as we took disparate groups across Microsoft and formed the .NET Framework team. Through this effort Brad gained an appreciation for the value of the different parts of the .NET Framework as well as the need for consistent usage of concepts across them.

In addition to his day job, Brad joined a very small team tasked with creating the CLI and C# Language standards first through ECMA and then through ISO. Again the CLS and Design Guidelines got a careful review and honing from this group and with great help from Jim Miller they were published as part of the International standards for the CLI standard. Brad loves to talk about the .NET Framework and how it simplifies the lives of developers so agreeing to do this book was a no-brainer!

To partially complete the naming history of the .NET Framework it was known as Project 42 before COR and was subsequently called Lightning, COM+2.0 and NGWS (Next Generation Web Services) before finally being renamed to the .NET Framework only weeks before its launch at the PDC in Orlando in July 2000. From our personal viewpoint, the major satisfaction gained from working on Project 7, as with all experiences in life, has come not from developing a technology but from working with such a large, diverse and talented group of developers from all over the world.

An interesting aside about the history of the .NET Framework is to look into each and every .NET Framework executable for the string "BSJB". This magic number refers to some of the original developers of the .NET Framework, Brain Harry, Susan Radke-Sproull, Jason Zander and Bill Evans.

ECMA Standardization

Core elements of the .NET Framework have been standardized by the European Computer Manufactures Association (ECMA.) A major reason for standardizing the .NET Framework is so that other implementations of the .NET Framework can be built. Apart from the commercial Windows based implementation, Microsoft has built a shared source implementations for Windows and BSD UNIX, hopefully other implementations from different groups will follow. For information on the standardization effort, interested readers should visit:

http://www.ecma.ch

and in particular the .NET Framework standardization effort at:
http://www.ecma.ch/ecma1/STAND/ecma-335.htm

The C# language standard is at:
http://www.ecma.ch/ecma1/STAND/ECMA-334.htm

You can find out more about the Shard Source Implementations at:
http://msdn.microsoft.com/net/sscli


0201770180P07102002

Foreword

There is no substitute for experience. This is especially true when the goal of the exercise is to transmit that experience. As you'll see when you start reading Programming in the .NET Environment, the authors--Damien Watkins, Mark Hammond, and Brad Abrams--have experience to spare with Microsoft .NET development, as well as the ability to explain clearly what they know.

Damien Watkins was a member of the first wave of outside developers recruited to join Project 7, a joint project between Microsoft and a number of universities to develop the next generation of COM.

Mark Hammond, probably best known for his extensive work on the Win32 extensions to Python, was recruited into Project 7 at about the same time as Damien, when the Project 7 team thought that Python should be one of the first languages ported to the .NET platform.

Brad Abrams is a lead program manager on the .NET Framework team at Microsoft, and leader of the team responsible for the Common Language Specification (CLS). He has been involved with the design and implementation of the .NET Framework from the very beginning.

While the .NET Framework builds on Microsoft's experience with the Win32 API and component-based programming, it is different enough from any of its antecedents that it takes some time for a developer to get used to the environment. There are some fundamental shifts in thinking that have to be made before you can be efficient.

As a simple example, take the area of memory management. In Win32 programming, memory and resource leakage were major headaches. In .NET programming, the garbage-collected managed heap resolves most of those kinds of problems automatically. On the other hand, having garbage collection doesn't absolve the programmer of responsibility for good design--and the explanation you'll find here of how the .NET memory management system works will give you a leg up on designing your structures intelligently.

The CLR's security system provides two different security models, Role Based Security and Evidence Based Security. You're probably familiar with Role Based Security from working with Windows NT roles, users, and groups. Evidence Based Security, on the other hand, is probably a whole new kettle of fish for you.

Watkins and his coauthors explain this new model in a concrete way, making it easy for you to take full advantage of this powerful new platform feature.

While the subject of the Framework Class Libraries (FCL) is a huge one, requiring thousands of pages to cover it in detail, you'll find the short introduction to the FCL in this book an excellent way to get started. Again, experience tells: the authors explain the principles behind the library design as well as telling you how to use the classes.

You're in good hands.

--Jeffrey Richter

Index

Click below to download the Index file related to this title:
Index

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership