Skip to main content

Define a Value Object

A value object is simple an object (or variable) that do not have any identity. This is the key difference between value objects and entities. Value objects simply describe some characteristics of a thing.

To declare a value object with Bitloops Language, you simply define your value object variable and name, adding a VO suffix:

ValueObject TitleVO {
  constructor(props: TitleProps): (OK(TitleVO), Errors(DomainErrors.TitleOutOfBoundsError)) {
    applyRules(TitleOutOfBoundsRule(props.title));
  }
}