#Notes to the Reader ##The Design of C++ ###Programming style Language features exist to support programming styles. C++ language feature support four programming styles:

  • Prodedural programming - design and processing of data structures
  • Data abstraction - focussed on the design of interfaces to hide implementation details
  • Object-oriented programming - design, implementation and use of class hierarchies providing run-time polymorphism and encapsulation
  • Generic programming - general algorithms which accept a wide variety of types as long as the algorithm's requirements on its types are satisfied

###Type checking Static types and compile time checking is central to C++.

##Learning C++ C++ is a language that you can grow with.

To gain the benefits of C++, programmers coming to it from a different language must learn and internalize idiomatic C++ programming style and technique. The same applies to pro- grammers used to earlier and less expressive versions of C++.

Some guidelines:

  • Prefer statically type-checked solutions (when applicable).
  • Keep information local (e.g., avoid global variables, minimize the use of pointers).
  • Don’t overabstract (i.e., don’t generalize, introduce class hierarchies, or parameterize beyond obvious needs and experience).

##Exercises

  1. (*1) What does (2.5) mean for an exercise?

    It will take between 1 hour and 1 day, it is a little more than a drill, but not fantastically challenging.

  2. (*2) Briefly describe the design aims of C++ and comment on the extent to which C++ meets those.

  3. (*4) Write an essay: What can a good programming language do for you and what can’t you expect it to help with?

  4. (*1) What are the main programming styles supported by C++?

    Procedural programming, data abstraction, object-oriented programming, generic programming

  5. (*2.5) List five language features offered by the 1985 version of C++, five features added by C++98, and finally five new features added by C++11. In each case, order the features in order of importance and for each feature write a sentence describing its role in programming.

  6. (*3) Describe the difference between dynamic (run-time) and static (compile-time) type checking and outline the strengths and weaknesses of each.

  7. (*1.5) List the major components of the C++ standard library.

  8. (*1.5) List five libraries that you would have liked to be part of the standard.

  9. (*1) List three (or more) advantages from having a library as part of the standard.

  10. (*3) List 20 major real-world C++ applications.

  11. (*2) From §1.3 pick five suggestions that to you looks most likely to help improve your programming style.

  12. (*2) Make a ‘‘top-ten list’’ of helpful design and programming rules. Hint: §X.2.