Re: OT - Kind of
Classes and OO design:
As I understand it (I've studied programming but never really done any) OO design is diferent from regular programming design because:
In regular programs, you set up a system with a bunch of rules to govern how the things within in that system behave. Then you drop a load of itms into that system and the system looks after them. For example, you might make a menu screen, and the menu checks constantly to see whether one of it's buttons has been clicked and what to do if it has.
In object oriented (w00p!) design you set up a bunch of classes, with their own rules about how they interact with on another and the system they live in. Those classes then spawn objects (A class is essentially just a blueprint for an object) into the system, and you just sit back and watch them interact with one another like a little ecosystem. In the menu example, each button would be an object. (probably all from the same class) Each button would watch out for it's own mouse clicks, and store it's own information about what to do when it is pressed.
Of course it's never as easy as I make it sound...
Anyway, the advantage is that an object within a system is by definition smaller and less complex than the system itself. Therefore, it's easier to capture and define all the possible permutations and interactions for that object than for a system. This means you can break your code down into (relatively) simple and (utterly)self containd parts.
Furthermore, because objects are treated as self contained and completely independent of outside intererence, it's easy to add, remove, replace and alter them to/ from/ within your program.
As long as its interfaces remain unchanged, you can just pull it out, make whatever changes you need to within it and then drop it back in without fear of generating some seemingly random error on the other side of your software.
Or something.
*Dogscoff skulks back to his pint.
|