C# A Programmer's Introduction, 1/e: Tour of the Book (Continued)
Chapter 9-Object-Oriented Programming: Inheritance
In this chapter, we discuss inheritance-a form of software
reusability in which classes (called derived classes) are created by absorbing
attributes and methods of existing classes (called base classes). The
inherited class (i.e., the derived class) can contain additional attributes
and methods. We show how finding the commonality between classes of objects
can reduce the amount of work it takes to build large software systems. These
proven techniques help programmers create and maintain software systems. A
detailed case study demonstrates software reuse and good programming
techniques by finding the commonality among a three-level inheritance
hierarchy: The Point,
Circle and
Cylinder classes. We
discuss the software engineering benefits of object-oriented programming.
Crucial object-oriented programming concepts, such as creating and extending
classes, are presented in this chapter.
Chapter 10-Exception Handling
Exception handling is one of the most important topics in
C# from the standpoint of building mission-critical and business-critical
applications. People can enter incorrect data, data can be corrupted and
clients can try to access records that do not exist or are restricted. A
simple division-by-zero error may cause a calculator program to crash, but
what if such an error occurs in the navigation system of an airplane while it
is in flight? In some cases, the results of program failure could be
disastrous. Programmers need to know how to recognize the errors (exceptions)
that could occur in software components and handle those exceptions
effectively, allowing programs to deal with problems and continue executing
instead of "crashing." Programmers who construct software systems from
reusable components built by other programmers must deal with the exceptions
that those components may "throw." This chapter covers the details of C#
exception handling, the termination model of exception handling, throwing and
catching exceptions, and FCL class
Exception.
Chapter 11-Graphical User Interface Concepts
Chapter 11 explains how to add sophisticated GUIs to
programs. By using the techniques of rapid application development (RAD),
programmers can create GUIs from reusable components, rather than explicitly
programming every detail. The Visual Studio .NET IDE makes developing GUIs
even easier by allowing the programmer to position components in a window
through so-called visual programming. We discuss how to construct user
interfaces with Windows Forms controls such as labels, buttons,
textboxes and picture boxes. We also introduce events, which are
messages sent by a program to signal to an object or a set of objects that an
action has occurred. Events most commonly are used to signal user interactions
with GUI controls, but also can signal internal actions in a program. We
overview event handling and discuss how to handle events specific to controls,
the keyboard and the mouse. Tips are included throughout the chapter to help
the programmer create visually appealing, well-organized and consistent GUIs.
The last section of this chapter introduces visual inheritance, which enables
programmers to combine the GUI concepts presented in this chapter with the
object-oriented concepts presented in Chapter 9 to create user interfaces that
can be used and extended by other programmers.
Chapter 12-Multithreading
Users have come to expect much from applications. Users
want to download files from the Internet, listen to music, print documents and
browse the Web-all at the same time! To do this, programmers need a feature
called multithreading, which allows applications to perform multiple
activities concurrently. The .NET Framework includes built-in capabilities to
enable multithreaded applications, while shielding programmers from complex
details. The .NET languages are better equipped to deal with more
sophisticated multimedia, network-based and multiprocessor-based applications
than those languages that do not have multithreading features. This chapter
introduces the FCL's threading classes and covers threads, thread life-cycles,
time-slicing, scheduling and priorities. This chapter lays the foundation for
creating the multithreaded programs that clients demand.
Chapter 13-Strings and Characters
In this chapter, we discuss the processing of words,
sentences, characters and groups of characters. In C#,
strings
(groups of characters) are objects. This is yet another benefit of C#'s
emphasis on object-oriented programming. Objects of type
string contain
methods that can copy, search, extract substrings and concatenate strings with
one another. We introduce class
StringBuilder, which defines string-like objects that can
be modified after initialization. As an interesting example of strings, we
create a card shuffling-and-dealing simulation.
Chapter 14-Graphics
In this chapter, we discuss GDI+ (an extension of the
Graphics Device Interface-GDI), the Windows service that provides the
graphical features used by .NET applications. The extensive graphical
capabilities of GDI+ can make programs more visual and fun to create and use.
We discuss C#'s treatment of graphics objects and color control. We also
discuss how to draw lines, rectangles and ovals. The chapter also demonstrates
how to use various pens and brushes to create color effects, and introduces
techniques for turning text-only applications into exciting, aesthetically
pleasing programs that even novice programmers can write with ease.
Chapter 15-Files and Streams
Imagine a program that could not save data to a file. Once
the program is closed, all the work performed in the program is lost forever.
For this reason, this chapter is one of the most important for programmers who
will be developing commercial applications. We introduce FCL classes for file
inputting and outputting data. A detailed example demonstrates these concepts
by allowing the user to read and write bank account information to and from
files. We introduce the FCL classes and methods that help perform input and
output conveniently-they demonstrate the power of object-oriented programming
and reusable classes. This chapter lays the groundwork for the material
presented in Chapter 20, Networking: Streams-Based Sockets.
Chapter 16-Database, SQL and ADO .NET
Data storage and access are integral to creating powerful
software applications. This chapter discusses .NET support for database
manipulation. Today's most popular database systems are relational databases.
In this chapter, we introduce the Structured Query Language (SQL) for
performing queries on relational databases. We introduce ActiveX Data Objects
ADO .NET-an extension of ADO that enables .NET applications to access and
manipulate databases. We show the reader how to create database connections,
using tools provided in Visual Studio .NET, and how to use some of the classes
in namespace System.Data
to query a database.
