I came across the following piece of code during a code review.
My intuition is telling me that this isn't following proper OOP.
I'm thinking that instead the LoadObject method should return a new SomeObject object, instead of modifying the one passed into it. Though I can't really find a proper explanation of why this is better.
Is my solution better? and if so why? specifically what OOP principles or standards are broken in the given code example (if any) ?
public void someMethod()
{
...
var someObject = new SomeObject();
LoadSomeObject(reader,someObject);
}
private void LoadSomeObject(SqlDataReader reader, SomeObject someObject)
{
someObject.Id = reader.GetGuid(0);
}