Home > Articles > Programming > C/C++

An Interview with Barbara Moo on C++11

  • Print
  • + Share This
C++ Primer has been one of the most popular C++ textbooks for nearly two decades. Now in its new fifth edition, it covers all of the new C++11 core features and library changes. Danny Kalev interviewed co-author Barbara Moo about the new edition of C++ Primer, the writing process, her experiences from the early days of AT&T’s C++ project, and her future plans.
Like this article? We recommend

Like this article? We recommend

Danny Kalev: Congratulations on the fifth edition of C++ Primer! Currently, this is one of the first C++11 books in the market. What were the main challenges involved in writing about C++11? Do you feel that C++11 is easier to teach than former variants of the language, or is it the other way around?

Barbara Moo: Thanks! Being early definitely had its challenges. I started writing before the standard was finalized, and there were a couple of places where I had to revise what I’d written due to late-breaking changes in the final version of the standard. 

More importantly, until fairly late I didn’t have a compiler that could compile all the code examples. Unusually among C++ books, nearly all the code in the Primer is directly compiled. That is, I have a set of tools that lets me insert compiled code fragments into the final text of the book. Whenever I change an example or get a new compiler, I “recompile the book” so I always know that the examples compile and execute correctly. 

Of course, I couldn’t compile the examples for features that weren’t yet implemented.  In those cases, I had to fake the related code.  Not surprisingly, I found bugs when I first compiled those examples. Fortunately, the GCC 4.7 release came out before I shipped the book, and that release handles all but two of the features we cover in the Primer.  So, I was able to check all but a couple code examples and am really grateful for the timing of that release!

As to whether it’s easier to teach (and to learn!) original C++ or C++11, the answer depends on what teaching strategy is used.  In the Primer, we teach the language as an integrated whole.  We do so because we think it is definitely easier to learn C++11 that way.  I think that it would be much harder to teach (or learn) C++ by first mastering the original language and then learning the C++11 features. 

The reason I think it’s easier to teach the C++11 features right from the start is that there are a handful of features—auto, decltype, range-based for, and smart pointers—that simplify getting readers up to speed.  Using auto and decltype meant that we didn’t have to spend much time explaining ungainly type declarations such as vector<string>::const_iterator. Using smart pointers, and the library string and vector types, meant that we could talk about writing classes earlier in the book. Moreover, by using these library facilities, readers can write pretty sophisticated classes without having to worry about copy control.

Danny: Many C++ Primer readers are beginners making their first steps in C++. What are your recommendations and guidelines for learning C++ systematically? On which C++ features should newcomers focus?

Barbara: I guess I have one hard and fast recommendation:  Learn the library before learning lower-level concepts. Use smart pointers, string, and vector, not ordinary pointers and arrays! Too many books still teach readers bad habits, such as using fixed length arrays for string data. Understanding how to use vectors and strings is so much easier than learning how to deal with pointers and arrays. Low-level code involving arrays is harder to write, harder to understand, and nearly impossible to get right! 

Other than that, it’s hard to know how people will learn a new language. In particular, the Primer has always assumed the reader has already programmed in some language. The level of experience the beginner has affects how they should learn the language.

One enhancement we made in this edition is that we’ve included icons in the margins to help guide the reader. We’ve distinguished those sections that we think pretty much every C++ programmer needs to know from those that can be skipped or skimmed until a problem arises that requires that particular feature. Particularly in Part I, where we cover the basics of the language, readers should feel free to skip sections that are not marked as essential and plan to come back and learn the other material as needed.

The Primer is also frequently used by folks who want to brush up on the C++ they already know. With this edition we think even somewhat experienced C++ programmers will want to read the Primer to get up to speed on the new C++11 features.  For those readers, we’ve provided a separate table of contents that lists sections that describe the features added by the C++11 standard, and we have marginal icons that highlight the sections that cover the new features.

Danny: Let’s talk about the writing process. When you’re writing a book, how many hours every day do you dedicate to writing? Do you write everywhere or is there a specific location (e.g., your home porch, a study or a favorite café) dedicated to this task? What usually inspires you to embark on a new writing project?

Barbara: Ah, the life of a writer. Honestly, the answer to how many hours is somewhere between 0 and 12!  I have a nice office at home where I sit staring at my screen for hours on end.

Danny: Does the emergence of electronic books and book readers affect the way you write today in any way?

Barbara: Not yet.  Because this is a revision of an existing book, we necessarily stayed with the existing approach. 

We used LaTeX to do the typesetting, and sent the machine-readable text to AW for conversion for e-readers. I was delighted that one of the early Amazon reviews noted that the “fonts and spaces are perfect for a programming book.”  I do think LaTeX does a beautiful job of typesetting.  Another reviewer noted that the Kindle edition is “very good” so I infer that the AW folks did a fine job on the translation to the electronic version.

Danny: What is your advice for new authors who wish to write programming books? In your opinion, what are the ingredients of a good programming book?

Barbara: The best advice I can give is advice that was given to me: When you think you’re done, you’re no more than half-way there!  A book requires an enormous amount of revision.  More than you think…..and then well, a bit more.

Moreover, inevitably when one sets out to teach a programming language, there are many intertwined concepts. Carefully thinking through the order in which topics are covered is essential. Once you’ve got that order, you need to stick to it. Nothing is so frustrating as a lot of forward references (or worse, using a feature that hasn’t yet been covered without bothering to note that fact!). Some forward references are unavoidable, but strive to minimize them.

Danny: Back in the early 1980s, you managed a project that would become one of the biggest successes of the software industry--the C++ project. You worked with gurus such as Bjarne Stroustrup, Andrew Koenig, Stan Lippman and others. What was it like to work with so many brilliant minds? Can you share with the readers a remarkable anecdote from those days?

Barbara: What was it like: challenging, exhilarating, exhausting, fun! When folks think of AT&T they probably figure we had lots of resources, but we were always a pretty small group that was kind of outside the mainstream of the business. Dealing with that corporate reality presented many more challenges than working with all these great people. 

It was pretty much of a whirlwind in those early days, and I don’t know whether it counts as “remarkable,” but one dreadful moment was in June 1989. We had just shipped what was then a long-awaited major revision, Release 2.0 [of Cfront, the first commercial C++ implementation]. Unfortunately, after we’d shipped, we discovered some not too terrible bug, but one that would affect binary compatibility going forward. So, we had to fix it. 

But, we’d already shipped to manufacturing. The folks who would handle distribution already had a labeled release, and we were not at all confident that we could just ship them a new tape and that the old one would be properly disposed of. But, we also didn’t want to ship with an altogether updated release number such as 2.0.1. That’d just be too embarrassing. Someone, I’ve forgotten who, suggested that we could label the corrected version “2.00” (note the extra zero).  It was a good thing we did because if I recall correctly some customers did get the wrong version!  Anyway, as a result, we always thought of that release as “2 dot uh oh.”

Danny: You have a broad perspective of the evolution of C++. What are your predictions regarding future programming? Do you see any other programming language replacing C++ as the workhorse of core programming, for example?

Barbara: Oh, you know that’s really a hard question. Back in the mid 80s when I first started working with C++ someone asked a similar question about what programming language would folks be using in the year 2000.  The joke then was, no one knew but that it would be called Fortran!

Danny: The software industry, and C++ in particular, are by and large a men’s habitat. In your opinion, what makes female presence so rare in this industry? What attracts you to this field?

Barbara: I’m not sure C++ is more or less male dominated than other language/operating system type software.  And, honestly, it’s not a question I’ve ever thought about too deeply. At AT&T we had a number of women who worked in the compilers group and on C++ in particular. 

Personally, I kind of stumbled into working on C++. I started my career as a banker, but I didn’t like that work all that much. In the meantime, I’d met folks who worked in the computer industry and they just seemed so much more engaged with what they were doing. I was lucky to get a job at the computer center at Columbia and went back to school to study CS, and as I was finishing up my MS was again lucky to get a job at Bell Labs. My first job at Bell Labs was with the compilers department. From there I stumbled into the C++ group.

The thing that engages me about the field is that it is intellectually challenging but comprehensible, if that makes sense. At AT&T most of the work (such as switching systems and the business systems that large telephone companies use to manage their business) are so large and so complex that one person can’t hope to comprehend them.  That wasn’t the case for a project like C++. One could understand the issues, even if it required a bit of thought.

Danny: Looking back at a long and full-of-accomplishments career, what do you consider as your biggest achievement thus far? Is there something that makes you especially proud?

Barbara: Throughout my career I’ve been more on the management side than on the “doing” side of things. In pretty much every project I’ve worked on I’ve had folks tell me that I was the “best boss” they’d ever had. That’s the greatest compliment I can imagine. 

Danny: What are your plans for the future?

Barbara: Getting some sleep:-)

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020