I want to design a
Crate object. A crate is a wooden box that stores things. I need to be able to keep track of of the following things in regards to this crate:
- length in inches
- width in inches
- height in inches
- weight in pounds
- price of crate in dollars
can I store all of the above in the same class? Does it break SRP if I store the quantities in the same class?
An alternative, for example will be to break up the class into 3:
- CrateDimensions (length, width, height)
- CrateWeight (weight)
- CratePrice (price)
My specific use case is as follows: I have various many products that can be put into the crate. Based on those products I have code that creates the crate – sets up initial dimensions and weight of the product inside the crate, and if more product is added, the crate dimensions are adjusted, as well as the weight. Price is something that is not currently added, but will be added later.