From: Demian K. <dem...@vi...> - 2010-12-06 14:11:20
|
> I took a closer look to the LDAPAuthentication problem. First, what I > would like to change, is the use the PEAR Auth package instead of the > PHP LDAP functions. This definitely makes sense from a testing perspective. I have just two main concerns about this approach: 1.) It adds a new external dependency to VuFind... and I like to avoid those when possible. 2.) A lot of work has gone into making VuFind's LDAP code work across many different LDAP setups. If the mapping from our current code to the PEAR code is very obvious and straightforward, we may not have any problems... but it seems likely that there may be some subtle cases where changing the mechanism could break some people's setups, and there's no easy way to test it! Perhaps the best compromise solution here is to rename the old LDAP option to something like "LDAP_No_PEAR" and deprecate it. We can add the new dependency into the upgrade scripts for the next release and use the new PEAR-based authentication by default... but this still gives us a failover for users who have trouble with PEAR and want to use the old code instead. If it turns out that nobody needs the old version, we can remove it in a future release. > What we should keep in mind, is that the use of unit tests changes the > manner we makes programs. You will automatically avoid to use a name > for your class, that is used somewhere in your packages before. If you > think, your class should be called MyClass, because it is the only > useful name, but there is another class in your package called MyClass, > then it is because it does a similar work. So why not use the class > that exists and take some changes on it? The main issue I was thinking of here has to do with the controller classes -- every module of VuFind needs to have a class named "Home," etc., etc. But since we don't need to unit test these classes, I suppose it's not really an issue. You are correct that in other circumstances, good naming conventions help us avoid the problem. > I agree with you, that we need more examples. For my part I will change > the code in my VuFind branch to fit with the PEAR Auth and try > different unit tests approaches. I will then write some lines in the > wiki and try to motivate other developers to use unit tests and TDD :- > )! Thanks! - Demian |