Return to Single Attribute Class
Monday, October 25, 2021
Is there a clear way that you can make an Attribute class that works with a single value by default, but can also work with multiple state-value pairs?
Your original Attribute class did this, but users of the attribute class still needed to call the different functions depending on if their attribute had multiple values or not. You decided that this differentiation wasn't clear and split the Attribute class into two with each containing the different representations.
While this split might have made knowing which functions to call clearer, it also has introduced more code clutter. There is more typing involved when working with attributes because instead of just referring to an 'attribute', you now have to refer to 'stateless_attribute' or 'stateful_attribute'.
How are stateful attributes used in other contexts?