For me OO is very frustrating in that I don't have a hard time programming and find it pretty obvious when to create a function, but I really suck at designing objects and determining how they relate to each other. The sheer complexity it introduces is just incredible.
I have a tip for you: Just do everything with functions and free variables first. When you find yourself using the same group of variables frequently, toss them into a struct. When you find yourself using the same structs and functions together, you make an object.
Sometimes it's better to just get started, be messy, and aggressively refactor later.
I would never bother with Internal. While working through your code, and object-orienting, I would ask a few things about the variables and functions: Who is using them, and why? If the answer is "the class, only the class, outside classes shouldn't mess with these." then they are Private. If the answer is "the class and derivative classes that might override them but still must access the parent class functions, but nothing else besides those" then they are Protected. Public is for everything else, such as API functions.
For something like a doubly-linked list class, you'll have "reset(), next(), store(), retrieve(), endOfList()" which are the APIs, public functions. Private data is stuff like the struct for the list nodes, the pointer to the start of the list, and helper functions the user of the class shouldn't mess with in any way. For something like templates, Protected is basically all the functions are, besides being Virtual.
1
u/WisconsnNymphomaniac May 29 '14
For me OO is very frustrating in that I don't have a hard time programming and find it pretty obvious when to create a function, but I really suck at designing objects and determining how they relate to each other. The sheer complexity it introduces is just incredible.