On Fri, Sep 11, 2009 at 11:27 AM, Marvin Humphrey <[email protected]> wrote: > Huffman coding naming principles dictate that classes whose names are typed > most often should have the shortest names. Therefore, instead of locating > common classes within sub-trees, we should locate them at the first level -- > directly underneath Lucy.
I'm only heckling from the sidelines lately, but this produced an internal 'ug'. The main goal should be clarity, with short and clear to be preferred over verbose and clear. Yes, the names should be short, but this is to help us keep track of them in our mental models rather than for our ease in typing. > Schema, Doc, QueryParser, and probably Indexer will all descend from > Lucy::Obj. Might it be possible to rename Lucy::Obj to Lucy, so that everything is Lucy:: is a Lucy object? It's boring, but I really like 'Class::Subclass::SubSubClass' schemes. > Searcher, however, will descend from the abstract base class Searchable, which > definitely belongs under Lucy::Search. For my non-OO mind, keeping track of the hierarchical relation of 'Search', 'Searcher', and 'Searchable' is difficult enough without having them 'Huffman compressed'. Wouldn't it be clearer to have Lucy::Searcher be the base, with Lucy::Searcher::Subclass as the subclass? But if you really need greater abstraction, it would be clearer to me to have it under a catchall category like Lucy::Abstract (Lucy::Abstract::Searcher). > It also makes sense, if we see "Lucy" as a single > entity, for Lucy::Searcher to subclass Lucy::Search::Searchable, whereas that > would not really be appropriate if "Lucy::Search" was an atomic unit. Is Stockholm syndrome causing you to side with your captors? No, this doesn't make sense! Or rather, switch around the 3 variations of the word 'Search' into any of the possible permutations and ask if each time if it makes any less sense. Moving from Huffman to Shannon, I'd contend that Lucy::Search descending from Lucy::Searchable::Searcher inherently makes just as much sense as Lucy::Searchable under Lucy::Searcher::Search which makes just as much sense as your original, and hence they all convey zero information! Get rid of two of these! http://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffalo_buffalo_buffalo_Buffalo_buffalo OK, I'll try to finish on a more constructive note: Keep trying to find a naming scheme that does not rely on small variations of the same base word. Be careful conflating object hierarchy with directory structure. Either name your abstract base classes very explicitly or accept that their name will have to be repeated in all derived classes. If your class hierarchy a) cannot be explained to a non-OO-programmer, b) will not fit on a napkin, or c) is not actually a hierarchy, keep fighting for a better solution. And if ever in doubt, choose clear over short. --nate
