Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Domain-Driven Design with Golang

You're reading from   Domain-Driven Design with Golang Use Golang to create simple, maintainable systems to solve complex business problems

Arrow left icon
Product type Paperback
Published in Dec 2022
Publisher Packt
ISBN-13 9781804613450
Length 204 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Matthew Boyle Matthew Boyle
Author Profile Icon Matthew Boyle
Matthew Boyle
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Part 1: Introduction to Domain-Driven Design
2. Chapter 1: A Brief History of Domain-Driven Design FREE CHAPTER 3. Chapter 2: Understanding Domains, Ubiquitous Language, and Bounded Contexts 4. Chapter 3: Entities, Value Objects, and Aggregates 5. Chapter 4: Exploring Factories, Repositories, and Services 6. Part 2: Real -World Domain-Driven Design with Golang
7. Chapter 5: Applying Domain-Driven Design to a Monolithic Application 8. Chapter 6: Building a Microservice Using DDD 9. Chapter 7: DDD for Distributed Systems 10. Chapter 8: TDD, BDD, and DDD 11. Index 12. Other Books You May Enjoy

Working with entities

In domain-driven design, entities are defined by their identity. Their attributes do not define them, and it is expected that although their attributes may change over time, their identity will not. While the entity may change so much that it is indistinguishable from where it started, it retains the same identity, and we treat it as the same object. Let’s look at an example. On ebay.com, you can sign up as a user. If you choose to sell something, you become a seller. You can also choose to bid on items. A naïve model of this might look as follows:

Figure 3.1 – A simple domain model for an auction site

Some actions that could take place in our system are as follows:

  • A user updates their address
  • A user updates their email address
  • An auction end time is updated

These actions do not change the identity of our entity. We are still referencing the same ID, but some attributes may have changed.

...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime