I agree with you when you say the code is very 'dense'.
One of the reasons it is so hard to grock, it's because there is a lot of useless code and loops, etc.
A few of my commits are actually removing code, not adding any.
Here is one example:
function directory_display_home_category($vid, $tid = 0) {
if ($tid == 0) {
// snip code
}
else {
// some other code
}
}
The problem is that according to the code, $tid is never set and cannot be anything else than 0.
It is most obviously a remnant of some much older code, of a function that didn't make it or that was moved somewhere else.
I am wasting a lot of time trying to figure out what some piece of code is doing, only to find out that it is not used at all.
The best solution to save time to future developer is therefore to remove those chunks of code.
The attached patch shows what I am removing in this case (the 'if' statement, the whole 'else' block, and change the function definition (no $tid passed on to the function), so that the above speudocode boils down to:
function directory_display_home_category($vid) {
// snip code
}
This ongoing issue is another, bigger example of this problem:
http://drupal.org/node/144743
In this commit, I removed another piece of code:
http://drupal.org/cvs?commit=67801
So, I am going ahead and removing the code (as per patch). This issue is to let you know about what I am doing.
| Comment | File | Size | Author |
|---|---|---|---|
| remove.useless.code_.patch | 1.67 KB | beginner |
Comments
Comment #1
(not verified) commented