Do not abbreviate variable names
chx - June 7, 2008 - 05:00
| Project: | Validation API |
| Version: | 6.x-1.0-alpha1 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
You have function names like _validation_api_form_fields then why do you have $va_fields? I guess your IDE can autocomplete, so it's not more work to write out completely.

#1
Note that this issue is up for discussion. I am not 100% I am right.
#2
I do not intentionally write some terms out and abbreviate other terms. Personally, I would rather have the functionality in, then come back later and fix up the over/under-descriptive terms. I am trying to comment my work as much as possible, so clean-up later on will not be that difficult of a task. Is there a reason I should continually keep my terms and functions in a proper format while in early-development?
BTW, thanks for the feedback. I do not intend to shoot down any comments, but I want to understand what is the best way to do things.
#3
I still see instances of $va_fields.
In general, since Drupal is programmed in procedural way instead of locking up modules in classes where namespaces are localized, developers have to be sensitive to namespace collisions between modules. Not only does it take an extra moment to pause and translate $va_ mentally to $validation_api, but it's just in general good to make sure your variables keep to the namespace you have claimed, in this case validation_api. Otherwise, just don't be lazy.
Specifically related to this case, I think $va_fields in validation_api_validator() is more appropriately named something like $database_fields and what needs changing is _validation_api_va_fields(). I think that can be just _validation_api_fields(), otherwise I'm mentally expanding that to _validation_api_validation_api_fields().
#4
Fixed in revision.
#5
Automatically closed -- issue fixed for two weeks with no activity.