Complex policies

A

anderberg

Reading about policies in Andrei Alexandrescu's Modern C++
Design, I was wondering about the complexity of policies.

It there a general recommendation that these policies should be
relatively small and simple (compare Create policy in the above
book) or can they be arbitrarily complex? For instance would it
make sense to define a FileParser policy which states how a file
should be parsed? Or should that be deduced further to smaller
components/policies?

Maybe it doesn't matter as long as the policy interface is
followed?
 
V

Victor Bazarov

anderberg said:
Reading about policies in Andrei Alexandrescu's Modern C++
Design, I was wondering about the complexity of policies.

It there a general recommendation that these policies should be
relatively small and simple (compare Create policy in the above
book) or can they be arbitrarily complex? For instance would it
make sense to define a FileParser policy which states how a file
should be parsed? Or should that be deduced further to smaller
components/policies?

Maybe it doesn't matter as long as the policy interface is
followed?

I think it's the choice you need to make when designing your system.
Nothing in the language says your template arguments need to be simple
or cannot be as complex as you can handle. Whether it makes sense to
subdivide your more complex parts of the system into simpler ones, is
completely up to you (and the group you're working in).

For language-neutral advice on OOD and OOA, try 'comp.object' newsgroup.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top