Saturday, February 9, 2008

Class Abstraction for Modularity

In order to make this flexible, I've switched from plugins to modular core objects.

I went back to my original goal which was to make a limited core application with few features, then let the user add all their fun custom stuff in the form of actual scripts that will be managed by the project. I still wanted people to be able to use their own authentication methods and database methods, which I was very confused about.

Then, simon w gave some great ideas in a bit-tech forum thread about class abstraction.

I basically implemented his recommendation for the authentication and database portions of the Shoehorn project. Now, all someone has to do is write their own extension to my abstract class, then set the config variables to use the proper class. (They don't have to include any files or anything, they just have to create a new class with the proper naming technique and save the file with the proper name in the proper place.)

Head over to http://shoehorn.googlecode.com and browse the source tree to see what I'm talking about. Especially shoehorn_auth.class.php and shoehorn_auth_ldap.class.php which is my only good example of this so far. (well, the database classes are ok as well, but I'm not done with those yet, so they aren't as impressive)

No comments: