Re: programming styles
Posted by Luigi Ballabio-3 on Jan 11, 2001; 12:46pm
URL: http://quantlib.414.s1.nabble.com/programming-styles-tp1631p1632.html
Just a thought I had writing some code, regarding rule 8 of the guidelines
(i.e., Names representing template types should be a single uppercase letter).
It is true that, for instance,
template <class Type> class Handle;
does not give any information more than
template <class T> class Handle;
does, so that in this case rule 8 holds.
However, there are cases where a longer name does add information. Namely,
template <class RandomAccessIterator> class SteppingIterator;
template <class Iterator, class UnaryPredicate> class FilteringIterator;
are in my opinion more understandable even at a superficial glance than
template <class I> class SteppingIterator;
template <class I, class P> class FilteringIterator;
because in the former case the names express the requirements for the
template arguments with single terms which are clear enough to any one that
happened to browse through the C++ standard.
Bottom line: we could relax rule 8, and leave it to the judgment of the
programmer whether a fully specified name would help. If not, the
single-character rule applies.
What do you think?
Bye,
Luigi