Features in Visual C 2005 How to Program, 2e


[Page xxv (continued)]

Features in Visual C# 2005 How to Program, 2/e

This new edition contains many new and enhanced features.

Updated for Visual Studio 2005, C# 2.0 and .NET 2.0

We updated the entire text to reflect Microsoft's latest release of Visual C# 2005. New items include:

  • Screenshots updated to the Visual Studio 2005 IDE.

  • Property accessors with different access modifiers.

  • Viewing exception data with the Exception Assistant (a new feature of the Visual Studio 2005 Debugger).

  • Using drag-and-drop techniques to create data-bound windows forms in ADO.NET 2.0.

  • Using the IDE's Data Sources window to create application-wide data connections.

  • Using a BindingSource to simplify the process of binding controls to an underlying data source in ADO.NET 2.0.

  • Using a BindingNavigator to enable simple navigation, insertion, deletion and editing of database data on a Windows Form.

  • Using the Master Page Designer to create a common look and feel for ASP.NET Web pages.

  • Using Visual Studio 2005 smart tag menus to perform many of the most common programming tasks when new controls are dragged onto a Windows Form or ASP.NET Web page.

  • Using Visual Web Developer's built-in Web server to test ASP.NET 2.0 applications and Web services.

  • Using an XmlDataSource to bind XML data sources to a control.

  • Using a SqlDataSource to bind a SQL Server database to a control or set of controls.

  • Using an ObjectDataSource to bind a control to an object that serves as a data source.

  • Using the ASP.NET 2.0 "login" and "create new user" controls to personalize access to Web applications.


  • [Page xxvi]
  • Using generics and generic collections to create general models of methods and classes that can be declared once, but used with many types of data.

  • Using generic collections from the Systems.Collections.Generic namespace.

New Interior Design

Working with the creative services team at Prentice Hall, we redesigned the interior styles for our How to Program Series books. In response to reader requests, we now place the key terms and the index's page reference for each defining occurrence in bold italic text for easier reference. We emphasize on-screen components in the bold Helvetica font (e.g., the File menu) and emphasize C# program text in the Lucida font (for example, int x = 5).

Syntax Shading

We syntax shade all the C# code, similar to the way most C# integrated-development environments and code editors syntax color code. This greatly improves code readabilityan especially important goal, given that this book contains 17,500+ lines of code. Our syntax-shading conventions are as follows:

comments appear in italic
 keywords appear in bold, italic
 errors and JSP scriptlet delimiters appear in bold, black
 constants and literal values appear in bold, gray
 all other code appears in plain, black
 


Code Highlighting

Extensive code highlighting makes it easy for readers to spot each program's featured code segmentswe place white rectangles around the key code.

Early Classes and Objects Approach

We still introduce basic object-technology concepts and terminology in Chapter 1. In the previous edition, we developed custom classes in Chapter 9, but in this edition, we start doing that in the completely new Chapter 4. Chapters 58 have been carefully rewritten with an "early classes and objects approach."

Carefully Tuned Treatment of Object-Oriented Programming in Chapters 911

We performed a high-precision upgrade of Visual C# 2005 How to Program, 2/e. This edition is clearer and more accessibleespecially if you are new to object-oriented programming (OOP). We completely rewrote the OOP chapters, integrating an employee payroll class hierarchy case study and motivating interfaces with an accounts payable hierarchy.

Case Studies

We include many case studies, some spanning multiple sections and chapters:

  • The GradeBook class in Chapters 4, 5, 6 and 8.

  • The optional, OOD/UML ATM system in the Software Engineering sections of Chapters 1, 39 and 11.

  • The Time class in several sections of Chapter 9.

  • The Employee payroll application in Chapters 10 and 11.

  • The GuestBook ASP.NET application in Chapter 21.


  • [Page xxvii]
  • The secure book database ASP.NET application in Chapter 21.

  • The airline reservation Web service in Chapter 22.

Integrated GradeBook Case Study

To reinforce our early classes presentation, we present an integrated case study using classes and objects in Chapters 46 and 8. We incrementally build a GradeBook class that represents an instructor's grade book and performs various calculations based on a set of student gradesfinding the average, finding the maximum and minimum, and printing a bar chart. Our goal is to familiarize you with the important concepts of objects and classes through a real-world example of a substantial class. We develop this class from the ground up, constructing methods from control statements and carefully developed algorithms, and adding instance variables and arrays as needed to enhance the functionality of the class.

The Unified Modeling Language (UML)Using the UML 2.0 to Develop an Object-Oriented Design of an ATM

The Unified Modeling Language™ (UML™) has become the preferred graphical modeling language for designing object-oriented systems. All the UML diagrams in the book comply with the UML 2.0 specification. We use UML class diagrams to visually represent classes and their inheritance relationships, and we use UML activity diagrams to demonstrate the flow of control in each of C#'s control statements.

This Second Edition includes a new, optional (but highly recommended) case study on object-oriented design using the UML. The case study was reviewed by a distinguished team of OOD/UML academic and industry professionals, including leaders in the field from Rational (the creators of the UML and now a division of IBM) and the Object Management Group (responsible for maintaining and evolving the UML). In the case study, we design and fully implement the software for a simple automated teller machine (ATM). The Software Engineering Case Study sections at the ends of Chapters 1, 39 and 11 present a carefully paced introduction to object-oriented design using the UML. We introduce a concise, simplified subset of the UML 2.0, then guide the reader through a first design experience intended for the novice object-oriented designer/programmer. The case study is not an exercise; rather, it is an end-to-end learning experience that concludes with a detailed walkthrough of the complete C# code. The Software Engineering Case Study sections help readers develop an object-oriented design to complement the object-oriented programming concepts they begin learning in Chapter 1 and implementing in Chapter 4. In the first of these sections at the end of Chapter 1, we introduce basic OOD concepts and terminology. In the optional Software Engineering Case Study sections at the ends of Chapters 36, we consider more substantial issues, as we undertake a challenging problem with the techniques of OOD. We analyze a typical requirements document that specifies the system to be built, determine the classes needed to implement that system, determine the attributes the classes need to have, determine the behaviors the classes need to exhibit and specify how the classes must interact with one another to meet the system requirements. In Appendix J, we include a complete C# implementation of the object-oriented system that we design in the earlier chapters. We employ a carefully developed, incremental object-oriented design process to produce a UML model for our ATM system. From this design, we produce a substantial working C# implementation using key programming notions, including classes, objects, encapsulation, visibility, composition, inheritance and polymorphism.


[Page xxviii]

Web Forms, Web Controls and ASP.NET 2.0

The .NET platform enables developers to create robust, scalable Web-based applications. Microsoft's .NET server-side technology, Active Server Pages (ASP) .NET, allows programmers to build Web documents that respond to client requests. To enable interactive Web pages, server-side programs process information users input into HTML forms. ASP .NET provides enhanced visual programming capabilities, similar to those used in building Windows forms for desktop programs. Programmers can create Web pages visually, by dragging and dropping Web controls onto Web forms. Chapter 21, ASP.NET, Web Forms and Web Controls, introduces these powerful technologies.

Web Services and ASP.NET 2.0

Microsoft's .NET strategy embraces the Internet and Web as integral to software development and deployment. Web services technology enables information sharing, e-commerce and other interactions using standard Internet protocols and technologies, such as Hypertext Transfer Protocol (HTTP), Extensible Markup Language (XML) and Simple Object Access Protocol (SOAP). Web services enable programmers to package application functionality in a manner that turns the Web into a library of reusable software components. In Chapter 22, we present a Web service that allows users to manipulate huge integersintegers too large to be represented with C#'s built-in data types. In this example, a user enters two huge integers and presses buttons to invoke Web services that add, subtract and compare the two integers. We also present a Blackjack Web service and a database-driven airline reservation system.

Object-Oriented Programming

Object-oriented programming is the most widely employed technique for developing robust, reusable software. This text offers a rich treatment of C#'s object-oriented programming features. Chapter 4 introduces how to create classes and objects. These concepts are extended in Chapter 9. Chapter 10 discusses how to create powerful new classes quickly by using inheritance to "absorb" the capabilities of existing classes. Chapter 11 familiarizes the reader with the crucial concepts of polymorphism, abstract classes, concrete classes and interfaces, which facilitate powerful manipulations among objects belonging to an inheritance hierarchy.

XML

Use of the Extensible Markup Language (XML) is exploding in the software-development industry and in the e-business community, and is pervasive throughout the .NET platform. Because XML is a platform-independent technology for describing data and for creating markup languages, XML's data portability integrates well with C#-based portable applications and services. Chapter 19 introduces XML, XML markup and the technologies, such as DTDs and Schema, which are used to validate XML documents' contents. We also explain how to manipulate XML documents programmatically using the Document Object Model (DOM™) and how to transform XML documents into other types of documents via Extensible Stylesheet Language Transformation (XSLT) technology.


[Page xxix]

ADO.NET 2.0

Databases store vast amounts of information that individuals and organizations must access to conduct business. As an evolution of Microsoft's ActiveX Data Objects (ADO) technology, ADO.NET represents a new approach for building applications that interact with databases. ADO.NET uses XML and an enhanced object model to provide developers with the tools they need to access and manipulate databases for large-scale, extensible, mission-critical multi-tier applications. Chapter 20 introduces the capabilities of ADO.NET and the Structured Query Language (SQL) to manipulate databases.

Visual Studio 2005 Debugger

In Appendix C we explain how to use key debugger features, such as setting "breakpoints" and "watches," stepping into and out of methods, and examining the method call stack.