In a project, I've found a code like this:
class SomeClass
{
private SomeType _someField;
public SomeType SomeField
{
get { return _someField; }
set { _someField = value; }
}
protected virtual void SomeMethod(/*...., */SomeType someVar)
{
}
private void SomeAnotherMethod()
{
//.............
SomeMethod(_someField);
//.............
}
};
How do I convince my teammates that this is bad code?
I believe this is an unnecessary complication. Why pass a member variable as a method parameter if you already have access to it? This is also a violation of encapsulation.
Do you see any other issues with this code?