I stink with OOP... any input will help!
Posted on 2004-09-22
it's me again...
I started out as a Pascal programmer back in high-school (this is what i'm blaming my condition on =) and ever since then I find myself writing programs in a very procedural manner, this is not what I like. Okay, I understand the OOP concepts (data hiding, encapsulation, polymorphism)... you guys know the jargon. Well, I have read a few books and they all say pretty much the same thing, as an example:
class tiger is a subclass of feline which is a subclass of animals or
class square is a subclass of twoDimensionalShapes which is a subclass of Shape
Okay, thats fine and dandy, but what about real programs. Example:
I just wrote a program for the company I work for that automatically detects and deletes log files in X directory. This program has a richtextbox that displays information on how many log files were found, how many were deleted...etc This program has the ability to delete any type of file in any directory (point it to \TEMP directory and have it delete all the .tmp files if you want) This program also communicates with the registry so it can save some values (the last directory that it pointed to...etc)
When I first started this program I had objects in mind... but once I really started getting the code down I was ... oops... going back to the old familiar procedural ways! I found it hard to make really well written objects that could be used in other future programs that I might write. Can anyone help this newbie out!? For some reason I just don't grasp it quite yet... But after all the books i've browsed through I sure can make one hell of an animal hierarchy!
I understand how OOP works, I just have a hard time puting it to good use