[wp-hackers] Adding wp-includes/class folder

Jacob Santos dragonwing at dragonu.net
Fri Aug 31 03:17:16 GMT 2007


What debate could there be for adding a class folder to wp-includes? I 
know the current standard is to have 'class-whatever.php' file to 
wp-includes folder. This would allow for better convention and 
organization moving forward. I mean this for external developers.

One disadvantage is that developers would have to browse through 
multiple directories to find the current file. This setup is confusing 
to beginners and well everyone that isn't intimate to the code. Another 
disadvantage that using the PEAR convention you lose *perceived* 
*initial* Opcode Caching speed boost.

The advantages are

1. Easier to unit test, can remove classes from presentation files.
2. Also keep the class model separate from application logic.
3. Using the PEAR convention, you would be able to use __autoload() on 
PHP 5.
4. Easier to extend later (once the convention is established, any new 
classes can be applied).
5. Simplifies more root WordPress files.

I suggest keeping the functions where they are and just separating the 
classes into their own file, so you would have 1 class per file, instead 
of cramming as many classes as there in that feature in a single file. 
Using Dashes to represent folder paths, so wp_xmlrpc_server would be 
/wp-includes/class/wp/xmlrpc/server.php. Would also suggestion using 
Pascal naming convention for class names: WP_Xmlrpc_Server or ABSPATH . 
WPINC . '/class/WP/Xmlrpc/Server.php'.


More information about the wp-hackers mailing list