Srinu <>, on 10/08/2010 22:45:03, wrote:
> Dear All,
>
> This is a unfortunate-problem of everyday life to every programmers.
> What are the simple guidelines to choose my classes for my problem?
> We would like to gather some thumb-rules from our own experience.
>
> This question arose, when I encounter two very different OOP approach.
> 1. For every word uttered in the requirement, we can write a class.
> 2. Most restrictive approach where it is forbidden to add one more
> class.
>
> Obviously, the above two approaches are not correct, for they
> represent two extremes.
> Question is now, where shall I stop adding more classes? What are the
> simple guidelines/thumb-rules to choose classes for my problem?
>
> Here interest is not on any particular type of problem. Guidelines
> need be very generic, applicable to all problems that can better be
> solved with OO technology.
>
> I will be happy to listen from your own experience.
There isn't any universal set of rules and there isn't any universal set
of guidelines, though there are many of non-universal ones in practice.
Bjarne Stroustrup gives some guidelines in TC++PL, but he stresses the
point that those guidelines are just that, guidelines, and that the most
important thing is using one's experience and common sense when making a
decision, without resorting to blindly follow any set of rules.
I think there could be some context where some rules are set and
expected to be followed, but those things would be "internal stuff" of
some developing team or company.
Personally, I find Bjarne's guidelines quite good and I use them as a
reference when I'm stuck on some design decision.
--
FSC -
http://userscripts.org/scripts/show/59948
http://fscode.altervista.org -
http://sardinias.com