32
Refactoring towards the ubiquitous language @JefClaes jefclaes.be

Refactoring towards the ubiquitous language

Embed Size (px)

DESCRIPTION

Slides from my Euricom Spain 2013 talk on the ubiquitous language, with an example of refactoring from an anemic model to a more rich domain model.

Citation preview

Page 1: Refactoring towards the ubiquitous language

Refactoring towards the ubiquitous language

@JefClaes – jefclaes.be

Page 2: Refactoring towards the ubiquitous language

What language?

Page 3: Refactoring towards the ubiquitous language

When a customer moves, we want to send him an email.

Page 4: Refactoring towards the ubiquitous language

UPDATE tbl_customerSET street = … WHERE id = …

Page 5: Refactoring towards the ubiquitous language
Page 6: Refactoring towards the ubiquitous language

It’s us, not them

Page 7: Refactoring towards the ubiquitous language

We have forgotten how to talk

• Database

• Framework

• ORM

• Tools

• Code generation

• UI technology

• ...

Page 8: Refactoring towards the ubiquitous language
Page 9: Refactoring towards the ubiquitous language
Page 10: Refactoring towards the ubiquitous language
Page 11: Refactoring towards the ubiquitous language
Page 12: Refactoring towards the ubiquitous language
Page 13: Refactoring towards the ubiquitous language
Page 14: Refactoring towards the ubiquitous language
Page 15: Refactoring towards the ubiquitous language

= =

Page 16: Refactoring towards the ubiquitous language

The ubiquitous language

Page 17: Refactoring towards the ubiquitous language

Better understanding

of ‘the business’

Page 18: Refactoring towards the ubiquitous language

Faster and less error-prone communication

Page 19: Refactoring towards the ubiquitous language

Less documentation!

Page 20: Refactoring towards the ubiquitous language

Code can be understood

by everyone

Page 21: Refactoring towards the ubiquitous language

Example

Our business has customers. A customer must have a customer number, an address and an

email address. A customer can move to a new address. When a customer moves, we want to

send them an email.

Page 22: Refactoring towards the ubiquitous language

Can we tell this story in code?

Page 23: Refactoring towards the ubiquitous language

Before

Page 24: Refactoring towards the ubiquitous language

After

Page 25: Refactoring towards the ubiquitous language

Before

Page 26: Refactoring towards the ubiquitous language

Before

Page 27: Refactoring towards the ubiquitous language

After

Page 28: Refactoring towards the ubiquitous language

After

Page 29: Refactoring towards the ubiquitous language

After

Page 30: Refactoring towards the ubiquitous language

Work the language,

make the implicit explicit

Page 31: Refactoring towards the ubiquitous language
Page 32: Refactoring towards the ubiquitous language

Disclaimer

CRUD can be fine too.

Learn where the value is in your system.