Variable and function prefixes:

  • the - global, a formal argument
  • my - function or module specific, a local variable or constant
  • an - user defined type (as opposed to a standard type)
  1. Chapters 1-5 were very easy.
  2. Chapter 6 deals with try / catch, this is an error handling statement (kind of like if / then?). Yes, it is similar to an if / then statement but better organizes the code for readability. It is also a more logical method of dealing with possible errors. Mostly used and found in libraries.

#Chapter 7: Functions - interesting thing is that you need to declare a function before you use it. Meaning that you have to put it above the code that uses it. This is different that php. Refactoring is breaking up kludgy code into functions for better organization.

  1. Chapter 8: Using modules - I don't really get what's going on with the header files, and what it means to link to a pre-compiled module, but at this point I don't believe it matters. Should be an easy chapter to get through (the two types of files are called header and implementation files). This one took some extra effort and I believe we'll be touching on it again. Namespaces are a simple concept but very useful, they should be taken advantage of ASAP, although I don't think they are used at all in PHP. C++ is definitely different from C. Also, it seems like a pain to have to dup many of the structural aspects of a module in both a implementation file and a header file but I suppose it makes for higher code quality.
  2. Chapter 10: "You've given a name to an expression (as a variable), which will reduce confusion in determining what it is intended to represent! Great statement.
  3. Chapter 11: switch statements (no prob, done this before in PHP), static variables (also referenced as encapsulation - have tried this before in php with little comprehension), runtime_exceptions (pay attention to this. its a new concept). Also discovered the rationale for using "my" as a prefix for a variable name. A function can own a variable, as opposed to a formal declaration that uses "the".
  4. Chapter 12: simple stuff - for loops, a++, b-- increments.
  5. Chapter 13: Alright! The good stuff. Heaps, stacks, pointers and references. After a quick read through, I kind of get stacks and heaps, pretty much understand references from PHP, but have to take a close look at pointers. Stack = automatically sized and arranged memory storage. Heap = manually allocated dynamic memory storage. To tell the compiler you want storage from the heap: "char *something = new char;" the * here represents that "something" is a pointer.

What the hell is a pointer? is it a pointer to a spot on the heap? Pointers are very important in C++ and should be reviewed from another source because this book doesn't clearly explain this concept.

  1. Chapter 14: there is a difference between naming a module a verb or a noun!
  2. Chapter 15: structs and types (enum). An enum is a type declaration that lets you define your own data type (like char, integer, bool, etc.). A struct is a set of variables, and seems to be a concept just one level below object oriented programming - it uses the dot reference: blah.barf! Also, the pointer member selection operator: "->". A pointer is always used with the heap. When they say pointers are important, it seems to me that pointers are important because they utilize the heap. What the hell is a callback?

After chapter 15 I have started to get lost, so I have stopped the lessons and am reading ahead to prepare myself better for the exercizes. I plan to read through the rest of the book, then go back to Ch. 16 and start doing the coding. I believe I have coded through chapter 16 or 17 so far and have read up to Ch 23. There are 27 lessons in the entire book. Only 4 more to go before backtracking. No problem! The closer I get to the end the more abstracct and advanced it gets. More difficult! Just plow through it. The chapter on testing was useful. Once you finish it, run through the sample code and call it a day.

FINISHED At least finished enough. Got to move on to Java!