Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Inheriting from Authenticator

edited December 2005 in Vanilla 1.0 Help
[starting a new thread from comments in Understanding People]

Under the current arrangement, it looks like custom Authenticators have to be named Authenticator. That would prevent sub-classing the default Authenticator, since you can't have two classes with the same name. (Correct?) Now, I only want to change one or two methods in the default Authenticator, so it would make sense to me if there were an abstract class ("AbstractAuthenticator") that the default Authenticator inherited from (trivially), and that custom Authenticators could also inherit from. That way, the code could rely on the fact that the authentication module is called Authenticator, and we could take advantage of inheritance. Inheritance is especially important if we're going to be sharing our custom Authenticators, and want the non-custom methods to remain up-to-date.

The change is really quite easy, just rename the current Authenticator class to something else, and then define a new Authenticator class that extends the AbstractAuthenticator without adding any functionality.

Evan

Comments

  • MarkMark Vanilla Staff
    edited December 2005
    I understand what you are saying, but after a lot of research lately, I think it might be needlessly complicating things. I recently read that in php a method in a base class will perform considerably slower than if that method was in the derived class instead. It's a really sad and disappointing thing to discover, and is probably one of the big reasons that I'm having so much trouble speeding things up. I know that redundant code is a big no-no, but I also know that your idea for an authenticator is unique to you, and who knows what other developers will want. What if you're the only one who wants to use those couple of methods that already exist? Then I've slowed the application down unnecessarily. So, why not just copy the methods you want into your custom class and change the reference for the authenticator include to yours. As I said, it's a wee bit redundant, but it's not like the original authenticator will even be included - so as far as php is concerned, it's entirely new code.
  • Ah, I had no idea that base class methods were slower. Performance is more important to me anyway, so I'll content myself to ripping off the methods I need. Anyway, Thanks for researching this! It means a lot to me that you're paying attention to suggestions.
This discussion has been closed.