Click here to Skip to main content
15,895,799 members
Home / Discussions / C#
   

C#

 
AnswerRe: send SMS in C# Pin
Sander Rossel2-Jun-12 0:43
professionalSander Rossel2-Jun-12 0:43 
AnswerRe: send SMS in C# Pin
taha bahraminezhad Jooneghani3-Jun-12 1:56
taha bahraminezhad Jooneghani3-Jun-12 1:56 
QuestionHow to hold dice in yahtzee Pin
Member 83368481-Jun-12 16:05
Member 83368481-Jun-12 16:05 
AnswerRe: How to hold dice in yahtzee Pin
sina rahimzadeh1-Jun-12 21:46
sina rahimzadeh1-Jun-12 21:46 
GeneralRe: How to hold dice in yahtzee Pin
Member 83368481-Jun-12 23:18
Member 83368481-Jun-12 23:18 
QuestionEntity Framework Problem Pin
Kevin Marois1-Jun-12 14:31
professionalKevin Marois1-Jun-12 14:31 
AnswerRe: Entity Framework Problem Pin
Unnikrishnan_S_N9-Jul-12 5:26
Unnikrishnan_S_N9-Jul-12 5:26 
RantVariable Names In Various Projects (Not My Own) Pin
Matt U.1-Jun-12 5:12
Matt U.1-Jun-12 5:12 
I hope this is the correct place to post this. If not, please help me correct it. Poke tongue | ;-P

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):

C#
// Somewhere else in the code; maybe in a different file, even
Dictionary<string, int> d = new Dictionary<string, int>();

// In some class
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)    // new item
            d.Add(l, q);
    }
}


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.

GeneralRe: Variable Names In Various Projects (Not My Own) Pin
Luc Pattyn1-Jun-12 5:57
sitebuilderLuc Pattyn1-Jun-12 5:57 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
PIEBALDconsult1-Jun-12 6:03
mvePIEBALDconsult1-Jun-12 6:03 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
Matt U.1-Jun-12 7:36
Matt U.1-Jun-12 7:36 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
GenJerDan1-Jun-12 10:30
GenJerDan1-Jun-12 10:30 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
Paul Conrad1-Jun-12 13:55
professionalPaul Conrad1-Jun-12 13:55 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
Matt U.2-Jun-12 7:38
Matt U.2-Jun-12 7:38 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
Ravi Bhavnani1-Jun-12 10:12
professionalRavi Bhavnani1-Jun-12 10:12 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
Matt U.2-Jun-12 7:40
Matt U.2-Jun-12 7:40 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
jschell4-Jun-12 8:15
jschell4-Jun-12 8:15 
GeneralRe: Variable Names In Various Projects (Not My Own) Pin
Matt U.14-Jun-12 2:37
Matt U.14-Jun-12 2:37 
QuestionWCF service as Windows Service Pin
TwilightEva1-Jun-12 2:26
TwilightEva1-Jun-12 2:26 
AnswerRe: WCF service as Windows Service Pin
sina rahimzadeh1-Jun-12 3:15
sina rahimzadeh1-Jun-12 3:15 
GeneralRe: WCF service as Windows Service Pin
jschell1-Jun-12 3:38
jschell1-Jun-12 3:38 
GeneralRe: WCF service as Windows Service Pin
Pete O'Hanlon1-Jun-12 3:47
mvePete O'Hanlon1-Jun-12 3:47 
JokeRe: WCF service as Windows Service Pin
TwilightEva1-Jun-12 4:05
TwilightEva1-Jun-12 4:05 
AnswerRe: WCF service as Windows Service Pin
jschell1-Jun-12 3:46
jschell1-Jun-12 3:46 
GeneralRe: WCF service as Windows Service Pin
TwilightEva1-Jun-12 4:04
TwilightEva1-Jun-12 4:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.