Core C++: A Software Engineering Approach - Softcover

Shtern, Victor

  • 4.17 out of 5 stars
    6 ratings by Goodreads
 
9780130857293: Core C++: A Software Engineering Approach

Synopsis

Teaches C++ by applying the best software engineering practices and methodologies to programming in C++. Shows the user how to build code that is more robust, easier to maintain and modify, and more valuable. Softcover. DLC: C++ (Computer programming language).

"synopsis" may belong to another edition of this title.

About the Author

Victor Shtern is Professor at Boston University's Metropolitan College, considered one of the top U.S. schools for working professionals. In addition to teaching C++ at the university level, Shtern also teaches training courses to experienced programmers.

Technical Reviewers: Dan Costello, Senior Software Engineer, GE Marquette Medical Systems Steve Glass, Senior Software Engineer, Motorola

Technical Editor: Clovis Tondo, author of The C Answer Book and The C++ Answer Book

From the Back Cover

Master C++ the right way: From the software engineering perspective!

  • Master C++ the right way!
  • Object-oriented approach to coding throughout
  • Harness C++'s strengths; avoid its dangers
  • Build more easily maintainable code

Build more powerful, robust, maintainable C++ software!

For developers with experience in any language, Victor Shtern's Core C++ teaches C++ the right way: by applying the best software engineering practices and methodologies to programming in C++. Even if you've already worked with C++, this comprehensive book will show you how to build code that is more robust, far easier to maintain and modify, and far more valuable.

Shtern's book teaches object-oriented principles before teaching the language, helping you derive all the power of object-oriented development to build superior software. Learn how to make design decisions based on key criteria such as information hiding and pushing responsibilities from clients down to server classes. Then, master every key feature of ANSI/ISO C++ from a software engineer's perspective: classes, methods, const modifiers, dynamic memory management, class composition, inheritance, polymorphism, I/O, and much more.

If you want to build outstanding C++ software, coding skill isn't enough. Objects aren't enough. You must design, think, and program using today's best software engineering practices — and with Core C++, you will.

So, Core C++ delivers:

  • The application of software engineering principles to C++ programming
  • A strong emphasis on writing code for easier future maintainance and modification
  • A practical understanding of object-oriented principles before teaching the language
  • Insight into the latest ANSI/ISO C++ features
  • Thorough explanations that respect your intelligence
  • Hundreds of realistic, to-the-point code examples
  • Levity Breaks: Stories and vignettes that illustrate key topics, concepts, and ideas through humor

Every core series book:

  • Demonstrates practical techniques used by professional developers.
  • Features robust, thoroughly tested sample code and realistic examples.
  • Focuses on the cutting-edge technologies you need to master today.
  • Provides expert advice that will help you build superior software.

From the Inside Flap

Preface

Congratulations! You have opened one of the most useful C++ books on the market! It will teach you the strengths and weaknesses of C++, and it will do this better than any other book I have seen. And I have seen a lot of C++ books. How Is This Different from Other C++ Books?

Of course, any author can claim that his or her book is one of the best on the market. What sets this book apart is its software engineering and maintenance perspective on writing C++ code. Very few C++ books (if any) do that.

Why is the software engineering and maintenance approach important? The point is that C++ changed not only the way we write computer programs, it also changed the way we learn programming languages. In the "good old days," you would spend a day or two looking at the basic syntax of the language, then you would try your hand at simple programming problems. Then you would learn more-complex syntax and would tackle more-complex problems. In a week or two (or in three or four weeks for a really complex language), you would have seen it "all" and could pose as an "expert."

It's different with C++; a very large and very complex language. Granted, it is a superset of C, and you can learn to write simple C programs (and, hence, C++ programs) very quickly. But things are different for complex programs. If the programmer does not know C++ well, a complex C++ program will not be portable; its code will be difficult to reuse, and it will be difficult to maintain.

C++ is a great language—it was created as a general-purpose engineering language, and its design is a clear success. Today, C++ is a language of choice for business, engineering, and even real-time applications. Significant effort was spent on the design of the language, to ensure that C++ programs provide great performance, that they support dynamic memory management, and that different parts of programs could be made relatively independent. Yet in all three areas, things can potentially go wrong even with a syntactically correct and thoroughly tested C++ program:

It can be slow—much slower—than a comparable C program.

It can contain memory management errors that affect the program only when memory usage changes (e.g., another program is installed); these errors might crash the program or quietly produce incorrect results.

It can contain dependencies between different parts of the program so that the maintainer has a hard time understanding the intent of the designer; a poorly written C++ program can be harder to maintain and reuse than a non-object-oriented program.

How important is this? If you are writing a small program that will be used only for a short time, then execution speed, memory management, maintainability, and reusability may not be of great importance. All that counts is your ability to quickly produce a solution. If this solution is not satisfactory, you can cut your losses by throwing the program away and writing another one. For this, any C++ book would do (but hey, you can still buy this one and enjoy its informal style and original insights into the language and its usage).

However, if you are working in a group, creating large applications that cannot be easily discarded and will be maintained for a long time, everything matters. The software engineering and maintenance approach I am advancing in this book is very useful and quite unique. Most books on the market do not mention these issues at all. (Just check their indexes and see for yourself.) When they do, they fail to spell out the techniques that can remedy a tough situation.

Another important characteristic of this book is its approach to the presentation of the material. There are many books on the market that do a good job enumerating the features of the language but do a mediocre job teaching you how to use the language. This is similar to learning a natural language. If you read a French grammar book, will it enable you to speak French? I did not study French, but I did study English, and I know—reading grammar books does not help to develop language fluency. In this book, I will show you how to use and how not to use the language, especially from the point of view of reusability and future maintenance.

Another teaching issue is that C++ features are so intertwined that it is hard to present C++ in a linear fashion, from simple to more complex. Many C++ authors do not even try. They say that these efforts "offend the intelligence of the reader." As a result, they might mention in Chapter 3 a concept that is explained only in Chapter 8, leaving the reader intimidated and frustrated.

My approach to teaching C++ is different. I introduce topics cyclically, first as a general overview and then again at a greater depth, with bells and whistles, and nowhere will your understanding depend on material in later chapters.

I developed my approach through years of teaching working software professionals. At Boston University Metropolitan College, most of my students hold professional jobs and come to classes in the evening in search of professional growth. I also taught numerous professional development seminars and on-site training courses. I developed great empathy for the students and their struggle with language concepts and programming techniques, and I translated this experience into a well-thought-out sequence of topics, examples, counterexamples, and recommendations. I think that my approach to teaching C++ is fairly unique, and you will benefit from it.Who This Book Is For

This book is written for professionals who are looking for a no-nonsense presentation of practical details combined with a deep understanding of C++ subtleties.

This book is written for you if you are looking for practical details of new technologies with a thorough discussion of their use.

It is written for you if you have experience in other languages and are moving to C++. If you are an experienced C++ programmer, you will find this book useful and sometimes an eye-opener. If this is your first programming book (and this is perfectly all right if it is), you will be well rewarded for the effort spent on reading it.How This Book Is Organized

I decided not to follow other authors who give you a detailed tour of their books, explaining what is covered and where. Unfamiliar terms, concepts and techniques will not make much sense to you now and will probably be quite boring. This is why I put the summary of the book into its final chapter, Chapter 19, "What We Have Learned," and you can read it if you are interested. It makes more sense there.

Instead, let me tell you what parts of the book might be of interest to you, depending on your background and experience.

If you are experienced in C++, Parts 3 and 4 will be most useful to you with their coverage of C++ power and programming pitfalls. If, in your initial study of C++, you were rushed to objects without building your muscle in procedural programming, memory management, and creating maintainable code, a review of Parts 1 and 2 will also be helpful (and interesting).

If you are an experienced C programmer who wants to move on to C++, Parts 2, 3, and 4 are written for you. If you briefly review Part 1, you might find the discussion of C from the software engineering and maintenance perspective interesting.

If you a programmer with experience in high-level languages other than C, C++, or Java, you should probably start with Part 1.

If you are looking for an introduction to programming, you should skip Chapter 1, "Object-Oriented Approach: What's So Good About It?": It will be too abstract for you at this stage. Study the other chapters of Part 1 first, then go back to Chapter 1, and then continue with Parts 2, 3, and 4.Accessing the Source Code

It is important to practice when you learn a language. Studying C++ without practicing it is as effective as taking a driver education course without driving: You'll learn a lot of useful things about driving, but you will not be able to drive. I strongly recommend that you experiment with the programs discussed in this book. The source code for all the listings can be found at the following site: ftp://ftp.prenhall/pub/ptr/c++_programming.w-050/core_c++Feedback

This book was thoroughly reviewed, carefully edited, and meticulously proofread. Still, some errors might remain.

In my drive to produce a unique book, I might have made statements that are groundless, unjustified, or plain erroneous. Or, they could be controversial and you might want to debate them.

Please do not hesitate to contact me at the following e-mail address: shtern@bu

For each typo or error that is pointed out to me or for each valid point regarding a discussion in the book, I promise to mention the names of the first two people who do so in the next edition of this book.

"About this title" may belong to another edition of this title.