Crates.io | valobs |
lib.rs | valobs |
version | 0.0.1 |
source | src |
created_at | 2023-12-29 05:50:29.663626 |
updated_at | 2024-03-04 10:42:35.572371 |
description | Valobs - A collection of commonly used value objects in enterprise applications |
homepage | https://github.com/MRGRAVITY817/valobs |
repository | https://github.com/MRGRAVITY817/valobs |
max_upload_size | |
id | 1082990 |
size | 52,425 |
A collection of commonly used VALue OBjectS in enterprise applications
In Domain-Driven Design (DDD), a Value Object is one of the building blocks used to model the domain. Value Objects are objects whose equality is determined by the value of their attributes rather than by their identity. In other words, two Value Objects are considered equal if they have the same set of attribute values, even if they are distinct instances.
Here are some key characteristics and considerations for Value Objects in DDD:
Immutability: Value Objects are typically immutable, meaning their state cannot be changed once they are created. This immutability ensures that the value of a Value Object remains constant throughout its lifetime.
Equality: Equality of Value Objects is based on the equality of their attributes. If two Value Objects have the same attribute values, they are considered equal, regardless of their individual identity.
Identity Ignored: Unlike entities, which have a distinct identity, Value Objects do not have a conceptual identity. They are defined only by their attributes. This means that if you create a new Value Object with the same attribute values as an existing one, they are considered equal.
Side-Effect-Free: Value Objects should not have any side effects. Operations on Value Objects should not change the state of the system or other objects.
Examples: Common examples of Value Objects include simple types such as strings, numbers, and dates, as well as more complex structures like Money, Address, or PhoneNumber. These objects are characterized by the fact that their identity is determined by their attribute values.
Using Value Objects in your domain model helps to clarify the semantics of the model and can lead to more expressive and intention-revealing code. They are particularly useful for modeling concepts in your domain that are defined by their attributes rather than their identity.
In enterprise applications, there are many common concepts that are represented as Value Objects. These concepts often have well-defined attributes and behaviors, and are used across different domains and applications. Examples include dates, times, money, addresses, and phone numbers.
VALOBS is a collection of commonly used Value Objects that can be used as building blocks in your domain model. By using these pre-defined Value Objects, you can avoid reinventing the wheel and ensure consistency and correctness in your domain model. You can also take advantage of the best practices and patterns that are built into these Value Objects.
No, it won't.
The list of Value Objects in VALOBS is not exhaustive, and it is not intended to cover every possible Value Object that you might encounter in your domain. Instead, it focuses on the most common and widely used Value Objects that are applicable to a wide range of domains and applications.