cubes icon indicating copy to clipboard operation
cubes copied to clipboard

Make all model objects immutable

Open Stiivi opened this issue 10 years ago • 2 comments

Potential mutability of model objects is sometimes causing unexpected behavior. All model objects should be immutable, including Cube. All setters should be removed.

The problem is Cube creation and linking. Currently the cube is created in two steps:

# In Provider
cube = Cube.from_metadata(metadata)
link_cube(cube, locale, provider, namespace)

Replace that with a dimension finder that will be passed into the Cube:

# Somewhere in workspace
finder = DimensionFinder(root_namespace)

# In Provider
cube = Cube.from_metadata(metadata, finder)

finder might act as a dictionary object with dictionary item getters.

Expect Cube.__init__ to receive final list of linked dimensions.

Stiivi avatar Mar 22 '15 02:03 Stiivi

Other mutable methods:

  • Attribute.dimension
  • localization methods that edit object in-place

Stiivi avatar Mar 10 '17 05:03 Stiivi

This needs to be reviewed and updated.

Stiivi avatar Mar 17 '17 15:03 Stiivi