Today was yet another day without knowing what the JSON data was or how to access it, so I went back to the studying drawing board for today.
Step 1: Try to use includes as little as possible. Separate definition from declaration and use forward declarations.
Step 2: Public inheritance is a "is-a" model. Don't have objects inherit unless they are specifically types of their base class.
Step 3: With that, avoid hiding inherited names (use using declarations to get ahold of functions or even inline functions in the case of private inheritance)
Step 4: Interface and Implementation inheritance? Pure virtual is interface only, virtual is interface and a default implementation, and non-virtual is a mandatory implementation.
Step 5: Instead of virtual functions, try a strategy pattern using tr1::function, function pointers, or even a separate object, but note the lack of access to private members.
Step 6: NEVER redefine an inherited non-virtual function - it gives strange behavior and masks the original.
Step 7: NEVER redefine a function's inherited default parameters. Try non-virtual functions with default parameters that contain virtual functions if that is the case.
Step 8: Composition is the "has-a" equivalent in object oriented programming. If a set isn't a list due to unique objects, put a list in the set for specific, non "is-a" behavior while keeping list functionality.
More steps tomorrow!
No comments:
Post a Comment