If I have a number of classes, lets say a variety of buildings of some sort. Each of these buildings have various properties and do some stuff etc
Now there is a set of operations I need to do on these buildings that are all conceptually the same. Lets call this conceptual group of operations Move building effluent. This functionality is essentially responsible for performing methods based on the information of each Building and then setting properties in other areas of the code as well as setting information on the building itself (can't help the need to set properties in other areas at the moment due to current system design limitations).
It's important to note that although these methods are conceptually the same and they set many of the same properties in various classes the way they calculate and get to these values are different (they do share some code however).
My question is should I put the code to do this into one class called say EffluentBuildingDistribution or should I put it into each buildings own class with appropriate methods to perform essentially the same code.
So either something like:
public class EffluentBuildingDistribution
{
public void DistributeEffluent()
{
// parameters example only
DistributeBuildingHouse(var param1, var param2);
DistributeBuildingDogHouse(var param1, var param2);
DistributeBuildingSecondHouse(var param1, var param2);
}
// and various private methods to help work with the 3 methods some shared
// others not
}
or
public class HouseBuilding {
public void DistributeEffluent(var param1, var param2)
{
// do stuff
}
}
public class DogHouseBuilding {
public void DistributeEffluent(var param1, var param2)
{
// do stuff
}
}
Or perhaps neither of these options!.
I'm not sure if putting the code on the objects they are working on is the way to go, or putting it in a class that represents conceptually what we are trying to do. This is an example of my current dilemma however it's also a general responsibility question on where to proportion methods and actions etc
If it's not specific enough or needs more explanation etc let me know and I'll try to explain more of my issue.
EDIT: Due to some understandable confusion with my usage of the term Structure in my example, I since changed it to Building. Some of the answers below refer to Structure but they are still valid as I have not changed the core of the question.