Manning Logo
Home | Ordering Info | Shopping Cart | Manage My Account | Login
Attention customers: online shopping is now available exclusively through our main website: http://www.manning.com. Thank you.
Microsoft .NET for Programmers

Inside the book

Sample Chapters Table of Contents Index Preface Book Reviews Source Code Author Online

Manning Blog

Why small is sweet?

Author Blogs

Dave Crane more...

Author Calendar

Upcoming Events

Catalog

Java .NET Perl XML All by Subject All by Title

About...

Manning Contact Us Ordering FAQs ebooks Covers Sandbox Forums Distributors Manning Early Access Program (MEAP) Affiliate Program Academia/Publicity User Group Program Press Releases Jobs

Manning Publications Co.
209 Bruce Park Avenue
Greenwich, CT 06830

Microsoft .NET for Programmers
Fergal Grimes

2002 | 386 pages
ISBN: 1930110197
$34.95 Softbound print book  
$17.50 PDF ebook  

Preface

As the title suggests, this book is written for programmers who want to learn about the Microsoft .NET platform. There is a lot to learn. .NET development embraces many areas including:

  • Windows desktop development
  • Component development
  • Development of remote objects and services
  • Development of XML Web services

In addition, programmers need to become familiar with an extensive new class library and a new runtime environment. Even for seasoned Windows developers, this almost amounts to a fresh start.

About this book

The purpose of this book is to explore the many parts that make up .NET, to assemble them into a meaningful whole, and to do so within the confines of a compact and readable publication. Although many of the topics weíll explore, such as XML Web services, Windows Forms, or ADO.NET, are worthy of separate books in their own right, all are just pieces of the .NET jigsaw puzzle. I felt there was a need to examine each of the individual pieces, and to show how they relate to one another, and how they fit together. This book is the result.

The scope and size of .NET make it impossible to cover everything in a single book. So Iíve taken some shortcuts. In particular, Iíve tried to impart the essentials while avoiding unnecessary handholding, repetition, or padding. In general, the documentation, online help, and samples, which come with the .NET software development kit (SDK), are comprehensive and complete. So, armed with the knowledge gleaned from this book, you should be able to consult the documentation for supplementary information.

This bookís audience

This book is written for intermediate and advanced programmers who plan to develop applications, components, or services for .NET. The typical reader will have some experience programming with Visual Basic, C++, or Java. This is not an absolute requirement, since Iíve included an appendix which provides an introduction to C#, the language used for the examples in the book.

To get the most out of chapter 4, ìWorking with ADO.NET and databases,î you should have some knowledge of SQL database objects including databases, tables, and SQL queries. Likewise, chapter 8, ìCreating the Web Forms user interface,î assumes a basic understanding of the Web including HTML, HTTP, and forms processing.

Choosing a .NET programming language

.NET is a language-neutral platform, and comes with a huge set of class libraries that are accessible to all .NET-compliant languages. Therefore, you can code equally powerful programs using C#, Visual Basic .NET, JScript .NET, or a host of third-party languages. So which language should you choose?

The obvious candidates are C# and Visual Basic .NET since most Windows developers will be coming from a Visual C++ or Visual Basic background. At the outset, I considered including examples using both C# and Visual Basic .NET. However, it quickly became clear that the result would be a repetitious book, which might shortchange both groups of readers. I settled on C# since it was designed for use with .NET and carries no legacy baggage. Being designed with .NET in mind, it could also be argued that C# provides the most natural fit to .NETís object model.

It is worth noting that there is less difference between C# and Visual Basic .NET than you might think at first glance. Programmers from both camps will need to get comfortable with assemblies, namespaces, types, classes, structs, enums, interfaces, methods, properties, events, delegates, threads, and more. These are features of .NET, and not the preserve of a particular programming language. So the differences between C# and Visual Basic .NET are mostly syntax-related.

Ultimately, youíll choose the language(s) with which you are most comfortable. This book teaches .NET, not C#. I hope that, by placing the C# introduction in a separate appendix, it will help to distinguish the C# language from the (language-neutral) .NET platform.

Depending on the level of interest, I hope to be able to provide a Visual Basic .NET edition of this book in the future. Stay tuned.

Do I need Visual Studio .NET?

Visual Studio .NET is Microsoftís integrated development environment (IDE) for .NET programming. It provides an impressive array of features that automate many tedious development tasks, making your job easier. However, for the beginning .NET programmer, this automation hinders understanding. So weíll build our examples, and our case study, using the .NET SDK tools.

Although you donít need a copy of Visual Studio .NET to follow along, we wonít completely ignore the IDE. In particular, weíll briefly explore the creation of Visual Studio .NET projects and the use of the drag-and-drop forms designer to create both Windows Forms and Web Forms.

Organization of this book

This book contains eight chapters and three appendixes:

Chapter 1 Introduction

Chapter 1 provides an overview of the .NET architecture and introduces application development using the .NET Framework class library.

Chapter 2 Understanding types and assemblies

In chapter 2, we look at fundamental .NET features including types, assemblies, and the Microsoft Intermediate Language, or IL. Also, to illustrate reflection, we develop a simple language compiler.

Chapter 3 Case study: a video poker machine

The video poker case study is introduced and described in chapter 3. We develop simple COM-based and Internet Explorer-based versions of the game.

Chapter 4 Working with ADO.NET and databases

Chapter 4 introduces ADO.NET and the new disconnected architecture for data access via the Internet. We also look at XML serialization, and we implement a data tier for the case study.

Chapter 5 Developing remote services

In chapter 5, we explore the .NET remoting architecture and the activation models it offers. We also look at Windows Services and Microsoft Message Queuing, and we use what we learn to develop several new versions of the case study.

Chapter 6 Developing XML Web services

Chapter 6 describes .NETís features for developing XML Web services. We look at SOAP, WSDL, and UDDI, and we present a Web service-based implementation of the case study.

Chapter 7 Creating the Windows Forms user interface

We explore Windows Forms, the new class library for the creation of Windows GUI applications, in chapter 7. We examine the Windows Forms programming model, and we see how to design a GUI using the Visual Studio .NET forms designer. We also implement a Windows Forms-based version of the case study.

Chapter 8 Creating the Web Forms user interface

Chapter 8 explores ASP.NET and the Web Forms classes for the creation of browser-based applications. We examine the new server controls and we learn how to create our own user controls. We also look at designing Web Forms inside Visual Studio .NET, and we develop a Web Forms-based version of the case study.

Appendix A Introduction to C#

Appendix A provides an introduction to the C# programming language. For readers who have no exposure to C#, this material provides all you need to follow the bookís examples.

Appendix B The poker engine listings

Appendix B contains the C# code for the classes that make up the Poker.dll assembly.

Appendix C The WinPok.cs listing

Appendix C presents the C# listing of the Windows Forms-based video poker machine.

Each chapter builds on previous material. So the chapters are best read in the order presented.

The programming samples

This book contains many short programs and code snippets designed to illustrate .NET programming. While writing the book Iíve had several discussions about so-called real-life examples and Iíve had reason to think about this. Witness the increasing number of programming books that use e-commerce as a vehicle for examples. I generally dislike this trend for the following reasons.

The obvious problem with real-life examples is that peopleís lives differ. The reader engaged in retail e-commerce may want to see an online shopping cart example. The banker might want to see a financial application. The list goes on.

The second problem is that real-life examples often deviate from established principles of good teaching. In general, an example should be just big enough to illustrate the point. Any bigger, and it can obscure it. This is particularly relevant for a new technology such as .NET. If you can demonstrate .NET remoting by invoking a method that says ìHello from Server Xî, then there is no need to distract the reader with details of an imaginary banking application.

However, there is no doubt that more substantial real-life examples can be useful, provided they are confined to a case study where they do not interfere with the presentation of basic concepts. Therefore, this book includes both short illustrative examples, and a complete case study. The case study provides a realistic example of a production .NET system consisting of several interrelated applications and components. For the most part, when introducing a concept for the first time, I use examples that are as short as possible. When we are acquainted with the concept, we apply what weíve learned by integrating the feature into the case study.

The source code for all examples in this book is available for download from http://www.manning.com/grimes.

The case study

The case study is an implementation of a video poker gaming machine. I think it makes a good case study for the following reasons:

  • Video poker is defined by a small set of simple rules that can be easily digested and remembered.
  • It is most naturally implemented as a game engine and a set of interfaces. Weíll reuse the same engine to implement different versions of the game based on COM, Internet Explorer, remoting, Windows services, message queuing, XML Web services, Windows Forms, Web Forms, and Mobile Forms. In doing so, we get a fairly complete tour of .NET development.
  • The game looks nice on the screen.
  • It will sharpen your poker skills!

Is this a real-life example? Yes. For a short period in the mid-1980s I made a meager living writing video poker machine software. For those of you who are interested, the game was coded in PL/M-80, an Intel language for its 8080 series processors. The software was compiled on an Intellec development system and transferred directly to EPROM for testing inside the machine. (We didnít have an in-circuit emulator.)

Any similarity between the game presented here and any commercial video poker machine, living or dead, is purely coincidental. In particular, the payout control strategy we explore is designed to illustrate ADO.NET database programming. It is not intended to be a serious payout management algorithm.

Organization of a typical chapter

Once weíve established the basics and introduced the case study in the early chapters, the typical structure of the each chapter is:

  • Briefly introduce the new topic; e.g., XML Web services or Windows Forms
  • Present a simple example program to illustrate the topic
  • Present and discuss incrementally more complex examples to reveal the topic in full
  • Apply what weíve learned to the case study

Therefore, the case study is a recurring theme throughout the book, and serves as a vehicle to implement what weíve learned as we progress through the material.

Conventions used in this book

The following typographic conventions are used in this book:

  • Constant width is used for all program code and listings, and for anything you would typically type verbatim.
  • Italic font is used for file and directory names, and for occasional emphasis such as when a new term is being introduced.
  • NOTE is used to indicate an important side comment to the main text.

DESCRIPTION

Written for intermediate and advanced programmers, this book builds on your existing knowledge to teach you exactly what you need to know to develop .NET applications.

Packed full of practical examples, the book presents a case study which takes you through the design of an application "engine" and its implementation as a .NET assembly. You'll reuse the engine to create different versions of the application using Windows Forms, Remoting, Web Services, Windows Services, COM, MSMQ, ASP.NET, ADO.NET, and the Mobile Internet Toolkit. You'll also learn about fundamental .NET concepts such as types and assemblies and develop a simple language compiler which can emit a .NET executable.

Also included is an appendix containing a comprehensive introduction to the C# programming language.

ABOUT THE AUTHOR...

Fergal Grimes is a freelance programmer and systems designer. He has 15 years’ experience developing diverse applications for embedded, mainframe, client/server, and Web-based platforms, and is a Microsoft Certified Solution Developer and a Sun Certified Java Developer. He lives in Hollywood, California.
Home | Catalog | Privacy Policy | About Manning

© 2003-2006 Manning Publications Co.