"SB" <> wrote in message
news:u0d_b.14387$Dc2.7710@lakeread01...
> Can anyone provide any insight/advice on how to take a problem (academic
> assignment) and figure out what the classes should be? I have an
assignment
> that is basically a doctors scheduling program, i.e. for three doctors
show
> their schedule for the month of surgies, lectures and free time. It also
> lets patients schedule appointments in the free time slots.
> My problem is not being able to determine what the classes and how many of
> them there should be. I know this is open ended, as each programmer might
> see it differently and have different classes and not the same number of
> classes as the next programmer. I would just like to know if there are any
> guidelines to follow for breaking a problem down into classes.
>
> Thanks in advance!
>
>
That's a pretty general question. I would say a well designed class
shouldn't contain two things that really have nothing to do with each other.
(Sounds simple, doesn't it?) I would also say it is better to avoid member
functions which could have been written entirely using the rest of the
interface. It's better for encapsulation if these "helper functions" are
written as standalone functions. Don't write get/set functions for each data
member. You should be able to set the data values using the constructor.
Don't use operator new() unless you have to. If you need a destructor, a
copy constructor, or an assignment operator you almost certainly need all
three. (For the assignment you just described you should be able to avoid
any of these.) Use standard library containers such as std::vector and
std::string rather than their C language counterparts.
Good luck.
--
Cy
http://home.rochester.rr.com/cyhome/