Pulp Free Press Man
Pulp Free Press Banner

 

C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
Detailed Chapter Descriptions

 

Chapter 1

Chapter 1: An Approach To The Art Of Programming

Chapter 1 begins with a discussion of the challenges you will face as you study C++ and object-oriented programming. It presents a project approach strategy specifically designed to help you maintain a sense of forward momentum when tackling your first programming projects. The chapter also presents a development methodology, a philosophical discussion of the concept of the "flow", and practical advice on how to manage a programming project's physical and conceptual complexity. I will show you how to use three important preprocessor directives: #ifndef, #define, and #endif to create separate header files. You may or may not be familiar with all the terms used in the chapter, especially those related to preprocessor directives and identifier naming, however, you are encouraged to return to the chapter as required. It serves to offer you a glimpse of things to come.

Chapter 2

Chapter 2: Small Victories: Creating Projects With IDEs

Chapter 2 shows you step-by-step how to create C++ projects using two popular integrated development environments: Metrowerks CodeWarrior on the Macintosh, and Microsoft Visual C++ for the Windows platform. The focus of the chapter is the concept of the project and the steps required to create projects regardless of the IDE employed. If you prefer to use UNIX development tools this chapter also shows you how to use the make utility and how to create a makefile that can be used to compile, link, and manage multi-file projects.

Chapter 3

Chapter 3: Project Walkthrough: An Extended Example

Chapter 3 takes you step-by-step through a complete programming project from specification to final implementation. Along the way you are shown how to apply the project approach strategy and the development cycle to arrive at an acceptable project solution. The #ifndef, #define, and #endif preprocessor directives are used to create safe header files that separate function interface declarations from function implementation code. If you are a novice student I do not expected you to fully comprehend all the material or programming techniques presented in this chapter, rather, the material serves as an excellent reference to which you will return periodically as you apply bits and pieces of this knowledge in your first programming projects.

Chapter 4

Chapter 4: Computers, Programs, and Algorithms

Chapter 4 presents background information on computer hardware organization, memory systems, and algorithms. The emphasis is on understanding exactly what a program is from a computer and human perspective. I discuss the four phases of the program execution cycle, how program instructions are differentiated from ordinary data, and how memory is organized on common computer systems. I also talk about what makes a good and bad algorithm.

Chapter 5

Chapter 5: Simple Programs

Chapter 5 shows you how to write simple C++ programs using fundamental data types and simple expressions. I give examples of how to use all the C++ operators, how to create local and multi-file variables and constants, and show you how you can limit a variable's scope to one file. You will learn how to write two versions of the main() function and how to call functions upon program exit.

Chapter 6

Chapter 6: Controlling The Flow Of Program Execution

Chapter 6 moves beyond simple programs and shows you how to control the flow of program execution by using if, if-else, switch, for, while, and do-while statements. Many source code examples and diagrams are used to illustrate how control flow statements are written. The chapter includes a discussion of statements, null statements, and compound statements. I also show you how to write nested if, for, and while statements, and how to write loops that will repeat until explicitly exited.

Chapter 7

Chapter 7: Pointers And References

Chapter 7 uses a short story to simplify the complex topic of pointers and references. Perplexed One is a student who falls asleep in class and is awakened by the arrival of C++ Man. C++ Man then helps Perplexed One by answering questions and giving examples of how to declare and use pointers.

Chapter 8

Chapter 8: Arrays

Chapter 8 builds upon chapter 7 and shows the relationship between pointers and arrays. The chapter continues by showing you how to build single and multi-dimensional static and dynamic arrays. Lots of code examples and diagrams help you visualize how arrays are declared, initialized, and used in programs.

Chapter 9

Chapter 9: Functions

Chapter 9 builds upon chapter 8 and shows you how to write complex functions that can pass arguments by value and by reference. The emphasis is on writing highly cohesive functions that are minimally coupled to other program elements. Header files are used to separate function declaration (interface) from definition (implementation). To support the creation of header files I review and discuss the three important preprocessor directives: #ifndef, #define, and #endif. Other topics covered include: function variable scoping, static function variables, passing arrays to functions, passing multi-dimensional arrays to functions, returning pointers from functions, how to avoid dangling references, function overloading, recursion, function pointers, and call back functions.

Chapter 10

Chapter 10: Towards Problem Abstraction: Creating New Data Types

Chapter 10 shows you how to create type synonyms and new data types using type definitions, enumerated types, structures, and classes. The emphasis is on problem abstraction and how it is used to map a real world problem to a set of supporting data structures that can be used in a program. Structures are compared to classes and the notion of object-oriented programming is introduced. The class declaration is discussed as it relates to the structure declaration and how the notions of procedural and object-oriented programming differ from each other.

Chapter 11

Chapter 11: Dissecting Classes

Chapter 11 continues the discussion of classes and how they work. It introduces the UML class diagram and uses UML class diagrams to illustrate static class relationships. The special member functions are thoroughly discussed. These include the constructor, destructor, copy constructor, and copy assignment operator. A brief introduction to the orthodox canonical class form is given in preparation for a deeper treatment of the subject in chapter 17. Other topics include data encapsulation, member functions and attributes, access specifiers, member function overloading, and how to separate class interface from implementation.

Chapter 12

Chapter 12: Compositional Design

Chapter 12 builds upon chapter 11 and shows you how to build complex class types using simple and complex aggregation. The UML class diagram is extended to model simple and composite aggregate class relationships. The UML sequence diagram is also introduced to illustrate inter-object message passing. Other topics discussed include: managing physical complexity, the use of pointers and references to build simple and complex aggregate classes, and how to properly use constructors and destructors in aggregate classes. The chapter concludes with a complex aggregation example.

Chapter 13

Chapter 13: Extending Class Functionality Through Inheritance

Chapter 13 introduces the topic of inheritance and shows you how to extend class behavior through subclassing and subtyping. UML is used to illustrate simple and complex inheritance hierarchies. The compositional design techniques discussed in chapter 12 are combined with inheritance design concepts to provide you with a powerful arsenal of object-oriented design tools. The access specifiers public, protected, and private are discussed in the context of inheritance. Other topics covered include: virtual functions, function hiding, function overloading, pure virtual functions, abstract classes, abstract base classes, multiple inheritance, and virtual inheritance. The chapter includes a complex navy fleet simulation example that illustrates the use of inheritance and compositional design.

Chapter 14

Chapter 14: Ad Hoc Polymorphism: Operator Overloading

Chapter 14 is devoted to operator overloading. It builds upon the concepts of function overloading and shows you how to overload nearly every operator in the C++ language complete with examples of their use. A complete table of overloadable operators is included along with a discussion of how to overload the iostream operators to tailor them to your class needs.

Chapter 15

Chapter 15: Static Polymorphism: Templates

Chapter 15 shows you how to write generic code using templates. It shows you how to replace overloaded functions with template functions and how to use template functions your programs. The chapter also shows you how to use the special template definition syntax to explicitly specify template parameter types. A brief overview of the C++ standard template library (STL) is offered along with a discussion of STL containers, iterators, and algorithms.

Chapter 16

Chapter 16: Dynamic Polymorphism: Object-Oriented Programming

Chapter 16 reinforces and builds upon concepts introduced in chapter 13. The focus is on the C++ language constructs required to write truly object-oriented programs. Topics discussed in depth include: employing pure virtual functions to create abstract base classes, how to use abstract base classes to specify the interface to derived classes, and what behavior to expect when using dynamic polymorphic programming techniques. The engine component aggregate class created in chapter 12 is revisited and redesigned to employ dynamic polymorphic behavior.

Chapter 17

Chapter 17: Well-Behaved Objects: The Orthodox Canonical Class Form

Chapter 17 presents an in-depth discussion of the orthodox canonical class form (OCCF) to write well-behaved, context-minded classes. Keeping the OCCF in mind when you design and write classes forces you to consider how those classes will be used in an application. The classÕs possible uses or usage contexts will guide you in your choice of which operators to overload to insure your class objects exhibit predictable and acceptable behavior.

Chapter 18

Chapter 18: Mixed Language Programming

Chapter 18 shows you how to use C++ with C, assembly, and Java. Topics covered include: using the extern keyword to prevent C++ name mangling, the Java Native Interface (JNI) and how to write C++ functions that can be called from Java programs, how to use inline assembly code in C++ programs using the asm keyword, and how to link to object modules created in assembly language.

Chapter 19

Chapter 19: Three Design Principles

Chapter 19 presents and discusses three important object-oriented design principles: the Liskov substitution principle, the open-closed principle, and the dependency inversion principle. Bertrand MeyerÕs design by contract programming is discussed in relation to the Liskov substitution principle.

Chapter 20

Chapter 20: Using A UML Modeling Tool

Chapter 20 discusses the importance of using a UML design tool to assist in the application design process. The featured UML tool is Embarcadero TechnologiesÕs Describeª. The chapter focuses on only a few of DescribeÕs many features: UML use-case, class, and sequence diagram creation, how to link diagram objects to other diagrams, how to generate code from class diagrams, how to reverse engineer existing C++ code, and how to generate comprehensive web-based project reports.

 

Home | Products | SupportSites™ | Training Videos | Links | Contact
© 2003 - 2015 Pulp Free Press - All Rights Reserved