Was just reminded of something (code taken from here (linked earlier)). Compared to the following:
public class Point
{
private int x, y;
public Point()
{
x = 0;
y = 0;
}
public int X
{
get
{
return x;
}
set
{
x = value;
}
}
public int Y
{
get
{
return y;
}
set
{
y = value;
}
}
}
Something like the following:
public class Point{
private int x, y;
public Point(){
x = 0;
y = 0;
}
public int X{
get{
return x;
}
set{
x = value;
}
}
public int Y{
get{
return y;
}
set{
y = value;
}
}
}
or particularly the following:
public class Point{
private int x, y;
public Point(){
x = 0;
y = 0;
}
public int X{
get{ return x; }
set{ x = value; }
}
public int Y{
get{ return y; }
set{ y = value; }
}
}
seems so clearly superior to me that I don't see what there is to debate. It's beyond me how anyone would like to read the first version, which is the exact same code as the final version but with 16 extra lines of nothing to wade through. It's almost twice as many lines as the final version.
While I'm here I might as well harp on tabs vs spaces. I'll never understand why some people prefer to only use spaces instead of tabs. Tab means "one level of indentation". Furthermore, some people like to use two spaces to indent their code. That's perfectly fine, but use tabs so I don't have to care about how you like to view your code.
Spider solitaire
To answer an earlier question, I amalmost certain every game can bebeat. ...
Jared: Jul 16, 2:20pm