[buddypress-trac] [BuddyPress Trac] #6083: Perhaps split up classes in existing component-class.php to separate files

buddypress-trac noreply at wordpress.org
Mon Dec 29 17:51:18 UTC 2014


#6083: Perhaps split up classes in existing component-class.php to separate files
----------------------------+-----------------------------
 Reporter:  DJPaul          |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  All Components  |    Version:
 Severity:  normal          |   Keywords:
----------------------------+-----------------------------
 Some of the -class.php files in the components have many classes in them.
 While historically okay, with all the new development, it feels to me that
 the class files are getting pretty long, and I think the larger a file is,
 the harder it is to understand the code.

 WordPress core has a nice pattern of using `class-whatever.php` for
 separate classes. It keeps thing manageable in terms of removing
 distractions of other bits of code in the same file, and the class name in
 the file name makes some IDEs' features of opening a file by name possible
 (for example, cmd+p in Sublime Text).

 I'm suggesting that we adopt a one class per file approach, and re-factor
 all the existing classes for this. We could either keep the files in the
 same directory as the rest of the component, or create a new sub-directory
 (e.g. `bp-groups/classes/class-paul.php`).

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6083>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list