I am talking about normal PC applications, memory should be sufficient.
They declare global or member variables.
In each function/method, they use the same global/member variables.
At the beginning of each method, the variables are re-initialized so the old value is never used.
Why do they keep the variables but no chance to reuse the old value?
class A
{
List<Car> carList;
public List<Car> M()
{
// always re-init variable
this.carList = new List<Car>();
// ...
// fetch from DB
return this.carList;
}
public List<Car> N(string id)
{
// always re-init variable
this.carList = new List<Car>();
// ...
// fetch from DB
return this.carList;
}
}