On 01/29/2013 03:50 AM, Reiner Karlsberg wrote: > So, after spending a > few days starting to dig into rather new source code regarding Rock, the > beginning of an old fairy tail came to my mind:
> - Use a lot of comments. > - Explicitly define every variable, and comment. > - Data structures had a pre-defined layout, > Similar naming conventions were used for executable code. Squid coding guidelines and code reviews should and, for the most part, do follow those principles IMO. Not all code has been written and accepted using those principles though. Sometimes, we miss problems. Sometimes, we have to chose between the lesser of two evils, primarily due to lack of resources. Personally, I agree with and try to follow the spirit of those principles, including in my Rock work. Some of them have to be adjusted as you move from assembly to C++ (e.g., "a lot of comments" is not really the goal, "understandable code", for the lack of a better term, is). Does Rock comply with Squid coding guidelines? It tries, but there are many exceptions. Many of those exceptions stem from the fact that the APIs and code structure that Rock had to use do not comply themselves. For example, the fs/ and DiskIO/ directory structure and naming conventions are ugly; the Store API has serious flaws (polishing Store API is on my to-do list). Some exceptions were just due to shortcuts we have taken, especially when copying ugly but-known-to-work code from another Squid branch. One important rule that you have not mentioned above is "be consistent". That includes "be consistent with the code around you", which often contradicts other rules. Balancing consistency and gradual code improvement is very difficult, especially when dealing with a large body of ugly code. BTW, if you are interested in Rock, consider working with the Large Rock branch on Launchpad. I hope that code will replace the current one soon so if you want to work on significant improvements, it is best to base them on Large Rock branch IMO. If you have questions about Rock or Store in general, please do not hesitate to ask here. Thank you, Alex.
