Move model creation defaults into a utility function #8

Closed
Stiivi opened this Issue Sep 29, 2011 · 1 comment

Comments

Projects
None yet
1 participant
@Stiivi
Member

Stiivi commented Sep 29, 2011

"Explicit is better than implicit."

Current state: During creation of model objects, such as dimensions or cubes, some defaults are applied. For example in the dimension:

  • If no levels are specified during initialization, then dimension name is considered flat, with single attribute.
  • If no hierarchy is specified and levels are specified, then default hierarchy will be created from order of levels
  • If no levels are specified, then one level is created, with name default and dimension will be considered flat

This should not be enforced, as some users might not expect that. Also it might come into a conflict later. This should be moved to some utility function/method:

model.apply_defaults()

Model objects should be kept in their state as created by user, having the model valid or not. That's what model validation is there for. And after using model.apply_defaults() model should be valid, only if there are really serious issues.

@Stiivi

This comment has been minimized.

Show comment
Hide comment
@Stiivi

Stiivi Jun 18, 2012

Member

Different approach was taken:

  • Model() from now on will expect correctly constructed model objects.
  • create_model(dict) was added as replacement for Model(**dict)
  • create_model() will handle various simplifications and defaults during the construction process.
Member

Stiivi commented Jun 18, 2012

Different approach was taken:

  • Model() from now on will expect correctly constructed model objects.
  • create_model(dict) was added as replacement for Model(**dict)
  • create_model() will handle various simplifications and defaults during the construction process.

@Stiivi Stiivi closed this Oct 4, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment