Preface

[ fromfile: preface.xml id: preface ]

C++ had been in use for many years before it was standardized in 1989, which makes it a relatively mature language compared to others in popular use today. It is an important language for building fast, efficient, mission-critical systems. C++ is also one of the most flexible languages around, giving developers many choices of programming styles for uses ranging from high-level GUI code to low-level device drivers.

For a few years in the early 90s, C++ was the most popular object-oriented (OO) language in use, and many computer science (CS) students were introduced to object-oriented programming (OOP) via C++. This was because C++ provided a relatively easy transition to OOP for C programmers, and many CS professors had been teaching C previously.

Starting around 1996, Java gained favor over C++ as the first OO language for students to learn. There are a number of reasons that Java gained so much popularity.

Many of these benefits can be achieved with C++ used with Qt.

Although Qt does not provide garbage collection, it provides a variety of alternatives you can use to avoid the need to delete heap objects directly.

  1. Containers (see Section 6.8) that support reference counting and copy on write

  2. Parents and children (see Section 8.2)

  3. QPointer, and QSharedPointer, and QWeakReference (see Section 19.11).

  4. Subobjects (see Section 2.14)

  5. Stack objects (see Section 20.3)

Using C++ with Qt comes close to (and sometimes exceeds) Java in ease of use, comprehensiveness, and convenience. It significantly exceeds Java in the areas of speed and efficiency, making everything from processing-intensive server applications to high-speed graphics-intensive games possible.

Another benefit of learning C++ with Qt comes from Qt's widespread use in open source projects. There is already a great wealth of free open source code that you can learn from, reuse, and perhaps help to improve.

How to Use This Book

Part I contains the meat of the course: introduction to C++, UML, and Qt core, QObjects, Widgets, Model-View, SQL, XML, and design patterns. This part is designed to avoid forward referencing as much as possible, and it presents the topics in an order and a level of detail that should not overwhelm someone who is new to C/C++.

For completeness and for reference, Part II covers in more depth some of the "dry" but important C++ features that were introduced in Part I. By the time you have reached this point, these ideas should be a lot easier to understand.

At the end of each chapter, you will find exercises and review questions. Most of the programming exercises have solutions available to instructors on our Website. For the questions, if the answers are not in the preceding chapter, then often there are pointers on where to find them. If this book is used for a course, these questions could be asked by the student or by the teacher, in the classroom or on an exam.