Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Drive your dba crazy in 3 easy steps

69,193 views

Published on

It’s there, it’s always been there. And you know that if you want to do Domain Driven Design seriously, you’ll have to challenge some of the assumptions that have been around for so much time that everybody forgot we were able to deliver working software also without them.
Of course, not everybody’s going to like it. Oh well ...that’s life!

Published in: Technology

Drive your dba crazy in 3 easy steps

  1. Driving
your
DBA
crazy
 in
3
easy
steps a
scary
story
by
@ziobrando
  2. About
meIn
the
IT
field
since
ZX
SpectrumGenerally
in
large
scale
projects
(I
might
be
biased)Freelance
consultant:
NotOnlyCodeTrainer
(Freelance
&
Skills
MaBer
+
Zenika)Technical
WriterBlogger:
h?p://ziobrando.blogspot.comTwiBer:
ziobrando
My
e‐mail:
alberto.brandolini@gmail.com
  3. @avanscopertawww.avanscoperta.itavanscoperta.wordpress.comalberto.brandolini@avanscoperta.it ©
Alberto
Brandolini
2009
  4. It
started
small
  5. It
grew
  6. It
became
more
and
more
complex
  7. Somebody’s
goBa
be
 responsible
 for
that
  8. Useful
  9. but
sHll...
  10. When
it
comes
to
run
a
query
with
16
joins
you’re
 the
person
to
call...
  11. When
it
comes
to
run
a
query
with
16
joins
you’re
 the
person
to
call... You
can
say
it
 loud,
pal
  12. So
how
do
I
design
a
query
with
16
joins?
  13. I
don’t
know
  14. I
don’t
  15. I’d
rather
explore
the
domain
  16. While
Jack
works
  17. ...in
bulk
mode,
of
 course
  18. Type
1
and
Type
2
  19. int Type = 1;
  20. int Type = 1; st h is a td oe !!! W h ea n?? lin em
  21. if
Germany
is
Type
6
and
Wednesday
is
type
 A
then
type
1
should
 be
...Red
  22. So you’d use a “readable data”, ... are you a communist or a lady?
  23. Analyst Domain Expert Developer DeveloperInterviews Ubiquitous Language Whiteboard discussions Application Code Specs and Test Code documentation ©
Alberto
Brandolini
2011
  24. Analyst Domain Expert Developer DeveloperInterviews Ubiquitous Language Whiteboard discussions SQL Application Code Specs and Test Code documentation DBA ©
Alberto
Brandolini
2011
  25. So You want to speak the Ubiquitous Language, you scumbag? ©
Alberto
Brandolini
2011
  26. So You want to speak the Ubiquitous Language, you scumbag? The only ubiquitous Language is SQL! Every Database speaks it! ©
Alberto
Brandolini
2011
  27. What is a Type 1 you scumbag?!A Type 1 is a Type 1, sir! I can’t hear you!!
  28. What
is
the
complexity
 you’re
tackling?
  29. Accidental Domain
 Complexity Complexity Conventions Behaviour Primary Keys SemanHcs Joins Language Legacy encoding Conceptual
integrity Replicas Context
BoundaryStored procedures Domain
Events Triggers
  30. How
much
Hme
is
needed
for
a
newly
hired
developer
to
 start
being
really
 producHve?
  31. How
many
things
we
need
to
know
before
 contribuHng
to
the
 system?

  32. A
new
business
requirement
impacRng
 the
applicaRon
in
20
 different
points
is
an
 architecture
problem
  33. unsurprisingly,
the
more
rules
you
have,
the
harder
it
 is
to
evolve...
  34. You can give your heart to DDD,but your ass belongs to the DB!
  35. Things
you
don’t
share,
even
with
your
best
friend
  36. Your
Toothbrush
  37. Your
Comics
CollecHon Your
Database
  38. Your
Harley‐Davidson
  39. The
operaHng
room
  40. Your
Database
  41. THIS DATABASE IS MY DATABASE TRESPASSERS WILL BE SHOT SURVIVORS WILL BE SHOT AGAIN ©
Alberto
Brandolini
2011
  42. Bounded
Context‐ Context:
a
seSng
where
a
word
 Shipping appears
that
determines
its
 meaning‐ A
porRon
of
the
system
where
the
 Ubiquitous
language
is
consistent Payment ©
Alberto
Brandolini
‐
2010
  43. He’s
probably
not
going
to
like
it ©
Alberto
Brandolini
2011
  44. The
infinite
workflow
  45. add/remove Item Ready for Open finalize Closed select DeliveryAddress ShippingMode Selection select Shipping Mode Ready for Ready for Shipped ship pay Delivery Payment deliver Delivered return Returned ©
Alberto
Brandolini
2011
  46. Not
the
same
EnHty
  47. Not
the
same
 Aggregate
  48. Aggregate ©
Alberto
Brandolini
‐
2010
  49. AggregateA
group
of
objects
that
naturally
belong
togetherUnit
of
consistency
in
the
domain
modelupdated
in
the
same
transacHondeleted
togethertransferred
together ©
Alberto
Brandolini
‐
2010
  50. Aggregate <<Entity>> <<Value Object>> Order LineItem date goodsA
group
of
objects
that
 customer amount quantity notesnaturally
belong
together ... subtotal() update() ... close()Unit
of
consistency
in
the
 ship() ...domain
model <<Value Object>> <<Value Object>> Money Customer currencyupdated
in
the
same
 name amount surname address plus(Money other)transacHon minus(Money other) ...deleted
togethertransferred
together ©
Alberto
Brandolini
‐
2010
  51. Customer add/remove Item Ready for addTocart Open finalize Closed select DeliveryAddress ShippingMode Selection select Shipping Mode Ready for Ready for Shipped ship pay Delivery Payment deliverLogistics Financial Dept Delivered return Returned Customer Care ©
Alberto
Brandolini
2011
  52. Different
Domain
Experts Different
Goals Different
Language Different
ModelsDifferent
Bounded
Contexts Different
Aggregates ©
Alberto
Brandolini
‐
2010
  53. And
this
will
lead
to...
  54. DuplicaHon
  55. Dont’
Repeat
Yourself
  56. “Every
piece
of
knowledge
must
 have
a
single,
unambiguous,
 authorita;ve
representa;on
 within
a
system” Andy
Hunt
‐
The
Pragma;c
 Programmer
  57. The
duplicaHon
dogma
  58. What
does
YOU
mean?
  59. The
cost
of
avoiding
duplicaRon
increases
 with
scale
  60. What
does
within
a
 system
mean?
  61. Consider
coupling
also
  62. ...
and
by
the
way,
we’re
not
violaHng
the
 DRY
anyway... :‐)
  63. Data
DuplicaHon
!=
behavior
duplicaHon
  64. MulHple
aggregates Money currency amount plus(Money other) minus(Money other) ... <<Entity>> <<Root>> <<Value Object>> <<Entity>> <<Root>> Order LineItem Customer date goods name customer quantity surname amount notes address ... subtotal() ... update() ... updateDiscount() close() ... ship() ... shipping address <<Value Object>> CustomerData billing address name surname <<Value Object>> Address <<Value Object>> street city country zipcode ©
Alberto
Brandolini
‐
2010
  65. Tha g at’s g re M ga Y te? ...
  66. Aggregate
modeling
Hp
(from
 UDI
Dahan): Group
words
according
to
the
 conversaRons
you
use
them
in,
 inclute
aBributes,
not
only
 classes.
Different
Stakeholders/Domain
Experts
will
use
different
 words
to
fulfill
different
goals
  67. Events
and
aggregate
coordinaHon ‐ OperaRons
spanning
mulRple
 aggregates
shouldn’t
be
in
the
same
 Unit
of
Work
‐ CommunicaRon
between
aggregates
 <<Domain Event>> is
inherently
asynchronous OrderPurchased‐ Domain
Events
as
a
communicaRon
 order where mechanism when amount ‐ from
the
outside payment method ‐ among
aggregates ... ... ©
Alberto
Brandolini
‐
2010
  68. Asynchronously
responding
to
events <<Domain Event>> OrderPurchased order where when amount <<Entity>> <<Root>> payment method s u bs <<Entity>> <<Root>> s to ... cri b Order su b s c ri be e s to Customer date ... name customer surname amount address ... ... onPurchaseEvent(...) onPurchaseEvent(...) update() updateDiscount() close() ... ship() ...‐ Don’t
forget:
Business
rules
everything!!! ©
Alberto
Brandolini
‐
2010
  69. The
paper‐based
systemMany
business
pre‐date
computersTransacHons
are
oeen
NOT
a
business
concernData
might
be
stale...
accept
itASK
the
Business
  70. ! Single
source
of
truth? ©
Alberto
Brandolini
‐
2010
  71. ! Single
source
of
truth? ‐ Once
it
used
be
paper...
 ©
Alberto
Brandolini
‐
2010
  72. ! Single
source
of
truth? ‐Once
it
used
be
paper...
 ‐ now
the
best
candidate
is
Events ©
Alberto
Brandolini
‐
2010
  73. That’s
gonna
make
him
REALLY
angry ©
Alberto
Brandolini
2011
  74. ©
Alberto
Brandolini
2011
  75. ©
Alberto
Brandolini
2011
  76. Does
it
really
have
to
 end
like
that?
  77. E’
necessario
un
processo
di
 sviluppo
agile,
che
permeBa
di
 raccogliere
il
feedback
di
utenH
e
 Our
goal
is
to
establish
a
creaHve
domain
experts,
in
iterazioni
brevi. collaboraHon ©
Alberto
Brandolini
2009
  78. We
did
it
with
the
worst
Domain
Experts...
can’t
we
do
it
with
the
DBA? ©
Alberto
Brandolini
2009
  79. We
did
it
with
the
worst
Domain
Experts...
can’t
we
do
it
with
the
DBA? ©
Alberto
Brandolini
2009
  80. Humble
Tips:
  81. Personality
Rules
  82. Start
small
  83. Work
Safely
  84. Share
the
fun
  85. Behave
  86. Thank
youalberto.brandolini@avanscoperta.it hBp://ziobrando.blogspot.com twiBer:
ziobrando

×