|Don't ask to ask, just ask|
Re: ?Re: Re: ?Re: RFC: Class::DispatchToAllby domm (Chaplain)
|on Jul 11, 2002 at 20:19 UTC||Need Help??|
If a class has a get_fields, I'd expect it to return all appropriate fields.
I do not want to write 100 accessor methods in each and every class, telling all those methods where to look for the data.
Instead, I have one general accessor (get_config) in App. Through normal Perl inheritance, every class can access it.
So, how can this one general method know which values to return? Is there a "standard" way to do this? Or is my architecture completly screwd?
Perhaps you don't get why "extending" and "overriding" are useful.
I know Perl OO quite well. Overriding is completly clear to me, but what do you mean by "extending"? Something like
You are breaking that model.
I know. I break it by intention, because it doesn't fit my needs. And as TheDamian is doing something similar (NEXT.pm), it seems that I am not the only one with that need...
At that point, don't call it OO programming any more. You are merely aggregating through hierarchies, turning "IS A" into "HAS A" relationships.
I am a so-called "accidental programmer" (i.e. I didn't learn programming at university), and while I am quite aware of OO-methodology, I cannot tell whether this is still OO or not.
This will scare every single maintenance programmer that has to look at your code. Please don't do that
Currently, I am maintaining an old version of this App (written by me, so it's my fault...). In the old version, all those fields are specied in there own class. I can tell you from hourlong search-and-replace-sessions that it this is quite a pain to maintain, as I have to wade to a lot of config files and change/add some values, if I change something in the whole App.
It would seem much clearer to me if each class only adds its specif stuff (or changes already defines stuff). This is what I hope to accomplish with Class::DispatchToAll.