I have stumbled about an implementation issue, which I´m not that sure how to solve. It´s not about programming, but rather design - more specifically nomenclature of object methods.
I have several objects which represent a more or less granular view of some world facts. Lets keep it simple: There is an object class called Entry it has semantic knowledge about a word/phrase. Now I would like to have a method that does the semantic consistency check. This is no problem, but the consistency check is only in the scope as far as the Entry data structure can see - that is, within its own data. So far so good.
Then there is a superposed structure - Dictionary that also has to do semantic checks, but the scope is wider, the checks are touching virtually all Entry-Objects (that are part of the Dictionary).
And last there should be a consistency-check routine, that is looking at several dictionaries simultaneously. Now my problem/ question:
In my first approach I was tempted to call all of these methods semcheck and there will be of course no nameclashes as all semchecks are in separate Namespaces, but is it really a good idea to have them all have the same name? FOrmally the answer would be yes, as they all serve the same purpose within their own semantics. But practically I have serious doubts:
Just because of readability of the code. Objects of the various Classes may exist in parallel and the situation can arise, where in the global function (no method) named semcheck you have a call $e->semcheck; folowed by $d->semcheck probably folowed by a recursive call to &semcheck;
What say you? Should I avoid calling them the same (and thus circumventing what OO would like to abstract), or should I have faith in readability of good OO code? What is your experience?
Thank you for your opinions and suggestions
Richard
In reply to Question to OO Masters (about Style) by PetaMem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |