[development] Rename hook_menu ?
James Walker
walkah at walkah.net
Wed Dec 13 15:55:32 UTC 2006
On 13-Dec-06, at 2:43 AM, Dries Buytaert wrote:
>
> On 12 Dec 2006, at 22:19, Michael Favia wrote:
>> Karoly Negyesi wrote:
>>> Today it was raised in #drupal that hook_menu has so little to do
>>> with
>>> menus nowadays that
>>
>> I was initially confused by this and underestimated the hooks
>> importance
>> and functionality. At first i thought the name wasn't as important as
>> it's proper documentation as a pillar of the drupal system. But
>> after a
>> moment of reflection, I remember being confused by this on my
>> first time
>> through as well.
>>
>> I'm not saying the documentation isn't there I'm just relating that i
>> didn't find it by default like I found FAPI and the other hooks
>> intuitive, etc probably because it was called a Menu system and I
>> discounted it as what i was looking for. Anything more descriptive
>> sounds good to me. Control, route, path, etc. I hope I would have
>> noticed any of those for what they are.
>
> Great feedback, Michael. I know a few people that told me the exact
> same story. Karoly senses this as well -- otherwise he would not
> have made the suggestion. It's a real problem and I think we
> should fix it.
>
> Renaming hook_menu() causes some pain, but in the long term, it
> will pay off. As we are going to completely overhaul the menu
> system in Drupal 6, this is the right time to make semantic
> improvements. Like it or not, but your menu code is going to break
> anyway.
>
> Thus, I'm in favor of renaming hook_menu() to hook_router() as that
> is semantically more accurate and matches the terminology used in
> other systems (eg. RoR and PEAR).
>
> I'd be happy to debate and weigh alternative names but let's not
> invent new terminology for an existing pattern. Let's go with
> hook_router() for now, or come up with a list of names that other
> systems use.
Sure, I'll throw in my $0.02... wth. I think that with a rewrite of
menu (that chx has underway already), it makes it an ok time to
switch the naming around. I agree it's gonna break anyway, let's get
it right.
I'm ok with hook_router, although in my experience hook_dispatch
might be more MVC "true" - certainly in the Java world. I can put a
+1 behind either hook_router or hook_dispatch though.
--
James Walker :: http://walkah.net/ :: xmpp:walkah at walkah.net
More information about the development
mailing list