Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Editor's Forum


January 2001/Editor's Forum


The Woods of Complexity

Well, I finally won at Stump the Compiler. That is, I asked it to compile a certain piece of template code and it replied with "Internal Compiler Error." I don’t know whether to be proud of myself or embarrassed. Did I write something clever, or just subtly wrong? Perhaps both.

After much tinkering and experimenting, I finally got the code to compile, and that got me thinking. There is a new school of thought concerning how C++ ought to be taught to new programmers. It says they ought to be introduced to certain parts of the Standard C++ library, such as iostreams, std::vector, and std::string, very early in their curriculum. This enables new programmers to start writing interesting programs quickly, not just toy programs to add a couple of numbers, spit out a line of text, etc. For a good introduction to this approach, see Bjarne Stroustrup’s article, "Learning Standard C++ as a New Language," in the May 1999 issue of CUJ (also on his website at http://www.research.att.com/~bs/new_learning.pdf).

I think there is much to be said for making things as simple as possible for new programmers. The C++ Standard library does that, in a sense; it replaces (or hides) pointers and arrays, and the particularly unfriendly scanf and printf families of functions. Yet I have reservations about this new approach to teaching C++. It relies upon templatized constructs, such as vector and string, behaving like good abstractions — which they do, if you’re careful to make the right mistakes. I find these abstractions perilously thin veneers over a mass of complexity. In my experience with templates, it is all too easy to punch through the veneer; and when you do, God help you if you don’t have good troubleshooting skills or someone to help you out.

Okay, so I am not a total believer in the new school, but I am not a total antagonist either. To prove it, I want to introduce CUJ’s newest columnist, Andrew Koenig. Andy probably needs no introduction to C++ programmers, but I will list a few of his impressive credentials: project editor of the C++ standards committee, former columnist for C++ Report, author/coauthor of three programming books. This first installment of his bimonthly column, C++ Made Easier (p. 42), is an excerpt of his latest book Accelerated C++, which he co-wrote with Barbara Moo. Accelerated C++ strongly promotes the new approach to teaching C++. Although I don’t know how effective this approach is for newbies, I know that the code in Andy’s column has had a big effect on me. It makes me want to trash everything I have done to date and rewrite it. Andy’s code is that beautiful. I believe even experienced programmers could learn much — about algorithm design and programming style, for example — by studying Andy’s code. So I am very happy to welcome Andy to the pages of CUJ.

I remain an agnostic on the new approach to teaching C++; I prefer to let readers judge for themselves. For my part, if I were to stress anything that new programmers should learn, it would not be this language feature or that; it would be basic troubleshooting, which is both an art and a science, indispensable in all fields of engineering. Happy the student with faithful guides, who never steer her into the woods of complexity. Happier still the one who goes there anyway, and knows how to find her way out.

Marc Briand
Editor-in-Chief


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.