I have an OOP design question about where best to put my code. Say I have table object and fire object. Does the Fire burn the table and burning code goes in the fire class with Table object passed to it or does the fire class simply call the burn method for the table? I was thinking about putting the burning code in the fire class. But each object burns differently A table would not burn the same as say grass , a person , a horse, or a chunk of magnesium? My question is for things like getting burned, frozen , covered in sodium-hydroxide ECT. Where does the code most efficiently go? In the class of the Problem or the class that gets the problems. Currently Problem is base abstract class that all problems extend and every thing has an ArrayList of Problems that they cycle through each turn. But I'm having a hard time efficiently splitting the code up.
↧