What I did
This week I had completed Drilldown’s Filter Line for Hierarchy Field, which is a great tool to filter down pages on the basis of values. The Drilldown for hierarchy allows filtering via. queries equivalent to finding values “WITHIN” the set of all the children of the queried value. Also, the single primitive matching is also supported. Sample drilldown filter line looks like: Fruits (23) * Vegetables (30) (“Vegetables” only (3) * Root vegetables (15) (“Root vegetables” only (1) * Carrots (12) * Turnips (2) ) * Peppers (12) )
Incorporated several rounds of code reviews for the patch implementing hierarchy supported querying commands - “WITHIN”, “NOT WITHIN”, “HOLDS WIHTIN” and “NOT HOLDS WITHIN”. During our daily discussion’s Yaron pointed out that it was needless to keep the “NOT” variants of the “WITHIN” and “HOLDS WITHIN” command. According to him, it was better to keep the design simpler, and a good software is one which does require to remember much. As the already existing query commands did not support “NOT” prefixed commands, except “HOLDS”. So we even decided to deprecate “NOT HOLDS” command from the Cargo. I was astonished by the fact that before deprecating Yaron suggested that we inform the person who introduced “NOT HOLDS” command.
Although the person who committed the code for “NOT HOLDS” did not reply to the email, and we finally decided to deprecate “NOT HOLDS” and I also removed “NOT WITHIN” & “NOT HOLDS WITHIN”. I discovered that the current code was not handling “NOT (WITHIN …)” and “NOT (HOLDS WITHIN …)”, which was essential as we had deprecated the counterpart commands. I also implemented this in the code this week.
Later, I received more comments regarding the comments and the design. Even I was not very sure of the object oriented design which I followed to implement Drilldown classes and thus wanted to have some discussion on it. Although everything seemed to work (as per the primitive goals), I was not very sure of the design. After immense discussions with Yaron, we finally came up with a design. Which required to inherit an already existing class. But the new challenge was to perform inheritance as the old class was responsible for creating Tree Data Structure, and due to simple inheritance was not easy to perform unless I got to know about something special in PHP - “new static()” instead of “new ClassName()”.
Regarding the comments in the comments in the code, Nischay found some sections (old and new) of code lacking comments to explain what was going on. Earlier I had felt the same, now Nischay’s advice had reinforced my thoughts.
What I learnt
I realized that now I had initiated the change in the design of code. I felt good, as this was one the tips that I gave to myself in the starting of the GSoC - that was to strive to improve the organized structure of the code. ( I learnt about myself - I was improving here)
Also, it is important to keep the software simple. Thus, Yaron insisted of removing “NOT” variants.
Tip to future myself (and anyone else reading this post)
“Keep the software simple and easy to use. The less user has to remember, the better your software is”comments powered by Disqus