Classes

Classes should be given descriptive names. Avoid using abbreviations where possible. Class names should always begin with an uppercase letter. Component class names should start with the component name. Examples of good class names are:

class MyClass
 
class MyComponentClass

Uppercase classnames

A couple of observations:

1) We're so not there right now

2) Have you ever thought it's weird that in english, we capitalize the proper name of something/someone/somewhere, which you might think of as the instance of a particular class of things, but the popular programming convention is exactly the other way around?

weston 09 Sep 2008

More specific examples

There are a few more cases I'd like to see addressed:

Components

class Component_App extends Component {}
class Component_Formz extends Component {}

Abstract and extending classes

// abstract base class
abstract class FormzDriver {}
 
// extending classes
class FormzDriver_Doctrine extends FormzDriver {}
class FormzDriver_FormDB extends FormzDriver {}

Note that they aren't necessarily namespaced by their component (i.e. Formz_FormzDriver_Doctrine... this could get ugly really fast), but they're namespaced by what they do. Much like Component_Formz is namespaced by what it does.

justin 04 Feb 2009