Well, this is less about Rails and more DDD (Domain-Driven Design) and Clean Architecture territory, but hey
At a glance
Term In a nutshell Examples
Entity Something you tell apart by ID User, deal, order
Value object Something you tell apart by its contents Amount of money, phone number, address, period
Service object A box for putting procedures in Calculating tax, uploading to S3
UseCase One thing the user wants to do Registering a deal, confirming an order
Entity β something you tell apart by ID
A person is the same person even if they change their last name or move. On the flip side, two people with the same name and the same age are still different people .
Like this, an entity is something you tell apart by its ID (the fact that it's that one) , not by its contents.
user = User . find ( 1 ) user . update! ( name : 'Suzuki' ) # Even if the name changes, it's still id: 1.β¦