in reply to Question to OO Masters (about Style)

It seems like part of your naming confusion may be due to some design confusion. An alternate approach to object decomposition is to look for verbs, not nouns. That is, if you come to see encapsulation as hiding behavior as well as data, you'll find it easier to pick out objects.

Figure out what you need to do, and write objects to do those things. The actual data will tend to fall out from there.

Looking at the problem very quickly, I'd probably make the Entries do their semantic checks. If it's necessary to do a global check in a Dictionary, I'd probably write something like check_all() that just iterates over the collection.

If you need similar behaviors that can apply to an Entry or Entries, it may be worth breaking those checks out into separate classes. It's hard to say, but I'd revisit the design. It may be more flexible elsewise.

  • Comment on Re: Question to OO Masters (about Style)