Description

Copyright 2000

Dimensions: 7 X 9-1/4

Pages: 755

Edition: 2nd

Book

ISBN-10: 0-13-086769-1

ISBN-13: 978-0-13-086769-8

8676J-4

Learn to program the way commercial developers do!

C++: Effective Object Oriented Software Construction, Second Edition is crafted to help you understand the C++ object-oriented paradigm in depth. It enables you to translate object concepts to practical solutions, no matter what software development environment you encounter. This edition is updated for the new ANSI C++ standard. The book introduces the fundamentals of object-oriented design/programming in the context of real world C++ software development, presenting proven strategies for using C++ to engineer elegant, high-quality software as quickly and efficiently as possible. You'll learn about:

Classes, objects, and data abstraction

0bject design techniques and strategies for building efficient and stable architectures

The C++ object model, and its cost/benefit implications

C++ code style guidelines for projects

Tips for writing multi-threaded object-oriented software

Single and multiple inheritance, generic programming, and error management

In this book, the author reveals the strategies professional developers have learned to maximize code and design reuse. You'll learn how to manage the extensive "housekeeping" that's associated with effective C++ software development. Then, you'll walk through detailed, real-world comparisons of the strengths and weaknesses of the major object-oriented languages. In addition, this book uses UML (Unified Modeling Language) to illustrate its design examples.

Whether you're a new programmer, a programmer familiar with procedural languages, or a C++ programmer who isn't using object-oriented techniques to their full potential, C++: Effective Object Oriented Software Construction will help you achieve your most critical goals as a developer.

Sample Content

Downloadable Sample Chapter

Table of Contents

I. CONCEPTS, PRACTICES, AND APPLICATIONS.

1. What Is Object-Oriented Programming?2. What Is Data Abstraction?3. Data Abstraction with C++.4. Initialization and Garbage Collection within OOP.5. The Inheritance Concept.6. The Concept of Multiple Inheritance.7. Selective Exports from Classes (Friend Functions).8. The Concept of Operator Overloading.9. Generic Types.10. Expecting the Unexpected.

Preface

Preface

Now that Object-Oriented Software Development is here to stay and is the preferred way to develop software, there is an increasing demand for good object-oriented software developers, designers, and system architects. To be successful in the world of object-oriented programming (OOP) one has to unlearn quite a few of the habits acquired from years of procedure-oriented programming and learn some new ways of looking at problems.

Object-Oriented Programming requires a thorough understanding of some fundamental paradigms, or concepts. Understanding these paradigms is essential to building a strong foundation in the OO software world. Any language that supports OOP must support these fundamental paradigms. In other words, learning effective OOP is simply learning a set of powerful paradigms that are supported by many languages like C++, Eiffel, Smalltalk, Java, etc. The first goal of this book is to drive home the essential concepts and principles of Object-Oriented Programming without getting too deep into the syntactic issues of a language. This is covered in Part I: Concepts, Practices, and Applications.

Mastering the syntax of a language that supports OOP is not the same as learning the concepts of OOP. One might be a guru of C++ or Java without any knowledge whatsoever of the basic OOP paradigms. On the other hand, anyone who imbibes the fundamental concepts of OOP will be able to use those concepts effectively with any language that supports OOP. Moreover, he or she would also know when to use a particular concept. As an analogy, anyone who has mastered the concept of a linked list will find it elementary to implement a linked list in Pascal, C, or Modula-2. If you know how to swim, you can swim in a lake, pond, or pool. The language is just a vehicle that helps in reaching the final goal.

Learning OOP concepts is just the first milestone, but thatÕs not the ultimate destination of any programmer/designer. One should be able to apply these concepts to problems in oneÕs domain or area of expertise. A financial planner might want to develop an object framework to manage personal finances; a department store might build an application to manage its inventory. But it is not a straightforward task to apply OOP principles to all these diverse areas. Solving toy textbook examples might be trivial, but conquering domain-specific problems and building systems is no cakewalk. It helps to learn from specific examples from specialized domains (for example, file systems, car dealership management, desktop publishing, flight scheduling system, etc.) IÕm definitely not knowledgeable in any of these areas and most readers may not find them very interesting because of their unfamiliarity with them. This is a classic problem authors face when writing about object-oriented design. However, there are certain rules of thumb that are useful to any software professional trying to solve complex problems, independent of the problem domain. One should know exactly when to use a butter knife or a chain saw. The second part of the book, C++: Using Object-Oriented Programming Effectively, illustrates some advanced OOP techniques with simple examples. Powerful strategies for using OO designs effectively are presented in this section. Professional developers are not content with just learning tricks and tacticsÑthey also would like to know the pros and cons of each technique, the alternatives, effect on portability and efficiency, and so on. All the necessary and important issues of the various techniques are discussed in detail. It is this overall knowledge that transforms a colt into a thoroughbred.

The emphasis throughout this book is on concepts and not on language syntax, although quite a few language issues are presented. Differences between C++ and other object-oriented languages are discussed for all major topics. Features from other OOP languages are compared to those in C++ to drive home concepts of OOP (and at times language design). This gives a deeper and broader picture of the OOP world. Just because the examples are coded in C++ does not mean that C++ is the only language to choose from. There are other equally good (if not better) OOP languages. It is good to gain an insight into the design goals of different languages. For readers already familiar with an OOP language other than C++, details of major concepts are first discussed from the C++ perspective, then followed by discussions of Eiffel and Smalltalk.

Since C++ is becoming increasingly popular (because of its rich feature set, strict static type checking, and strong support for writing industrial strength software) one ideally should be proficient in both C++ and OOP concepts. Well, just learning C++ syntax isnÕt much fun; we would like to pursue a much higher goal. In order to exploit the full potential of OOP with C++, there are a number of special patterns, techniques, and tricks that seasoned object-oriented software developers employ to turbo charge their programs. There are many such time-tested techniques currently being used in the C++ world. Also, at times it helps to know why certain features are the way they are in a language. It gives the programmer a better understanding of the language (and sometimes more respect for the designers of the language). It also helps in using the language more efficiently. The latter chapters in Part I cover those topics. Examples on many powerful C++ strategies and tactics are presented throughout the book.

Beginners should read Part I first, which deals with paradigms, theories, and applications. Within Part I, chapters are organized based on relevance and the difficulty of the material. Chapter 1 is a preliminary introduction and is followed by a thorough discussion of data abstraction in Chapter 2. Brief overviews of the Unified Modeling Language and the Booch methodology can be found in Chapter 2 as well. Chapters 3 and 4 shed further light on the object model and good interface design. Inheritance is covered in all its glory in Chapters 5 and 6, followed by some simpler topics in Chapters 7 and 8. Generic programming is given its due share in Chapter 9. Finally, Chapter 10 deals with exception management. The first chapter in Part II, Chapter 11, tries to demonstrate strategies for building powerful abstractions, while Chapter 12 does the same with inheritance. Finally, Chapter 13 briefly delves into the C++ object model.

Any chapter can be read at random, but some continuity might be lost because some examples carry through from the first four chapters. Chapters in Part II stand on their own.

Throughout the book, I have avoided showing dry implementation code as much as possible to keep things focused and short. Most implementation code is quite uninteresting. Implementation code is only shown in places where it adds considerable value to the on-going discussion.

This book can be used as an introductory or advanced text on object-oriented programming and will be very useful for programmers and students who are new to OOP. The second part of the book is useful for programmers already familiar with OOP concepts. Programmers familiar with other OOP languages (other than C++) are better served reading Part I first and then concentrating on Part II. Part I of the book can serve as an introductory course on OOP for undergraduate students, and Part I and Part II together can be used for a graduate course on OOP and C++ topics. Most of the book would immensely help fresh /intermediate developers and designers and seasoned professional will benefit from many chapters in Part-I and all of Part-II. This book can also be a good reference text once you have read most of the chapters.

This book assumes some rudimentary C++ syntax familiarity and some general programming experience (even classroom exposure is good enough). Some of the more complex parts of the C++ language (such as templates, exceptions, and inheritance) are covered in detail, with respect to language syntax.

In this second edition, some of the code examples have been updated to conform to ANSI C++ standard and some parts are rewritten to illustrate concepts more clearly. Also, numerous errors found in the first edition have been fixed.