|I hope this is the correct place to post this. If not, please help me correct it.
Lately, I have been digging around in open source projects at SourceForge.net. I download the source for an interesting project, typically if it seems like something I may learn from. I may be working on a project in which I need to create a custom control and I would like a good code example that I can study. Once the source is downloaded and I extract it as needed, I load the solution in Visual Studio 2010.
Once I begin digging through some of the code my head begins to hurt. It hurts terribly. For one, I see little white space in many projects. And two, the thing that really gets me, is the fact that variables have completely meaningless names, usually just one or two letters. It looks like this (not real code; just an example):
Dictionary<string, int> d = new Dictionary<string, int>();
private void MyMethod(string p, int q)
bool b = p == "string1" ? true : false;
List<string> l = GetList(b);
foreach (string k in l)
if (!string.IsNullOrWhiteSpace(p) && q > 0)
Before I continue, what does the fact that p == "string1" have to do with anything? Also, what does GetList(bool) do and how does the value of 'b' affect the results?
The first thing I tend to notice is that there is no documentation (///<summary>) for the method. Adding those comments too methods and classes is typically the first thing I do when I am coding. Maybe it isn't a recommended practice but instead it is just my own "standard"/style? If so, that's fine. Should this be something everyone uses?
The comments are typically quite vague as well. Or comments are missing entirely, even in methods that contain a lot of code. And in MyMethod, how should you really know what "d" is when it is declared in another file/class? And why exactly does "q > 0" have to be met before adding the item? This isn't a perfect example but I'm not on the computer I use when browsing through these projects. Perhaps I am being overly conscious about coding practices, standards, whatever. But I find it very difficult to read the code at times.
Another thing that bugs me slightly, though I guess it's expected when anyone can contribute to the project, is the lack of a consistent coding style. That doesn't bug me near as much as the rest. It's just a thought that I figured I'd throw in here.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.