Why such methods as model rules(), component behaviors(), controller actions(), filters() realized in Yii as methods and not as public properties?
If realize this things as class properties (and use the same methods that available now for reading them), we would have posibility to configure it via configuration and modify by events and behaviors.
There are several reasons that we do not introduce these properties:
the extra properties may "pollute" the property namespace of the base classes. For example, having a "$rules" property in AR means you will have trouble if a table also contains a column named "rules".
some of these methods already have the corresponding ways to allow customization by external classes. For example, you can manipulate the result of getValidators to customize the rules of a model. So instead of adding new properties without actual needs, we handle these requests case by case, depending on how often is a feature used in real applications.
In any projects where we use 3-rd party extensions, often we need to configure it for our objectives. It will be reasonably not edit their sources, that makes it unubdatable and not use inheriting, that can cause problems with names and paths, but configure it via config.
You will see actual needs of this if you look on this from the point of view of creating flexible CMS on the top of Yii with admin inerface, that can modify application configuration. From this point we have a reason to do all components of Yii more configurable.
The reason is to make it like puzzle – Less project-specific code,less dependencies in your code, just add all, that you need to config.
Polluting of property namespace of the base classes isn’t so serious problem to set aside improvement of flexibility. Note that this flexibility dont mean just freedom to use methods or to use properties. It means a principal abitilty to configure things about i talk via config.
Fully agree with qiang, the current implementation is versatile enough and consistent with the way yii configures things. It is one of the things I love about yii.