Legacy app queries into BC's database
"Ádám Sosterics [email protected] [domaindrivendesign]" <[email protected]> Wed, 12 Jul 2017 08:40:20 +0200
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAPKMXMC5sG6GOuV1CFEq=fkphzEmT33-JOwBCZ+Y2vhiNee-VQ@mail.gmail.com> |
--001a1142f6f402359405541917be
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="UTF-8"
Hey everyone,
We have a huge and old legacy system which is heavily data=
base-centric and
we have to keep it alive and even develop. We decided that=
we implement the
completely new features using DDD techniques and when we =
have the
possibility we rewrite a small part of the legacy application to e=
ventually
refactor the old system step-by-step.
This week we have finally =
managed to create a new bounded context for a new
feature. It shares the da=
tabase with the legacy application (and they're
going to stay this way for =
quite a while, that's for sure) but uses a
different schema so it=E2=80=99s=
clear who manages the new tables. We changed the
legacy system so it can p=
ublish some events in order to integrate with the
new bounded context. So f=
ar, so good.
The problem is that we have to show information from the new =
bounded
context in various places in the legacy app. One of these places is=
built
in a way that it can only show results from a SQL query (and we have=
no
capacity to change this right now). So this SQL query must use the tabl=
es
from the new bounded context=E2=80=99s schema, and we feel this violates=
the
boundary of the bounded context and creates unnecessary coupling.
Are=
we right that we shouldn=E2=80=99t allow this in general? Can we solve thi=
s
problem by creating a view that contains the necessary information for th=
e
query, and declare the view as the part of the public interface of the
bo=
unded context (until we can change the legacy component to be able to use
m=
ultiple datasources)? Or should we somehow =E2=80=9Ecopy=E2=80=9D the new t=
ables (or at
least parts of them) to the legacy schema? Or should we just l=
et the query
read the new tables and refactor later? What else can we do?
=
Thanks in advance for your replies!
Best regards,
Adam
--001a1142f6f402359405541917be
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<head>
<style type=3D"text/css">
<!--
/* start of attachment style */
.ygrp-photo-title{
clear: both;
font-size: smaller;
height: 15px;
overflow: hidden;
text-align: center;
width: 75px;
}
div.ygrp-photo{
background-position: center;
background-repeat: no-repeat;
background-color: white;
border: 1px solid black;
height: 62px;
width: 62px;
}
div.photo-title=20
a,
div.photo-title a:active,
div.photo-title a:hover,
div.photo-title a:visited {
text-decoration: none;=20
}
div.attach-table div.attach-row {
clear: both;
}
div.attach-table div.attach-row div {
float: left;
/* margin: 2px;*/
}
p {
clear: both;
padding: 15px 0 3px 0;
overflow: hidden;
}
div.ygrp-file {
width: 30px;
valign: middle;
}
div.attach-table div.attach-row div div a {
text-decoration: none;
}
div.attach-table div.attach-row div div span {
font-weight: normal;
}
div.ygrp-file-title {
font-weight: bold;
}
/* end of attachment style */
-->
</style>
</head>
<html>
<head>
<style type=3D"text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}
#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}
#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}
#ygrp-mkp #ads {
margin-bottom: 10px;
}
#ygrp-mkp .ad {
padding: 0 0;
}
#ygrp-mkp .ad p {
margin: 0;
}
#ygrp-mkp .ad a {
color: #0000ff;
text-decoration: none;
}
-->
</style>
</head>
<body>
<!-- |**|begin egp html banner|**| -->
<br><br>
<!-- |**|end egp html banner|**| -->
<div dir=3D"ltr">
<p class=3D"MsoNormal">Hey everyone,</p>
<p class=3D"MsoNormal">=C2=A0</p>
<p class=3D"MsoNormal">We have a huge and old legacy system which is heavil=
y
database-centric and we have to keep it alive and even develop. We decided =
that
we implement the completely new features using DDD techniques and when we h=
ave
the possibility we rewrite a small part of the legacy application to eventu=
ally
refactor the old system step-by-step.</p>
<p class=3D"MsoNormal">This week we have finally managed to create a new bo=
unded
context for a new feature. It shares the database with the legacy applicati=
on (and they're going to stay this way for quite a while, that's fo=
r sure)
but uses a different schema so it=E2=80=99s clear who manages the new table=
s. We
changed the legacy system so it can publish some events in order to integra=
te
with the new bounded context. So far, so good.</p>
<p class=3D"MsoNormal">The problem is that we have to show information from=
the new
bounded context in various places in the legacy app. One of these places is
built in a way that it can only show results from a SQL query (and we have =
no capacity
to change this right now). So this SQL query must use the tables from the n=
ew
bounded context=E2=80=99s schema, and we feel this violates the boundary of=
the bounded
context and creates unnecessary coupling.</p>
<p class=3D"MsoNormal">Are we right that we shouldn=E2=80=99t allow this in=
general? Can we
solve this problem by creating a view that contains the necessary informati=
on
for the query, and declare the view as the part of the public interface of =
the
bounded context (until we can change the legacy component to be able to use
multiple datasources)? Or should we somehow =E2=80=9Ecopy=E2=80=9D the new =
tables (or at least
parts of them) to the legacy schema? Or should we just let the query read t=
he
new tables and refactor later? What else can we do?</p>
<p class=3D"MsoNormal">Thanks in advance for your replies!</p>
<p class=3D"MsoNormal">=C2=A0</p>
<p class=3D"MsoNormal">Best regards,</p>
<p class=3D"MsoNormal">Adam</p>
</div>
<!-- |**|begin egp html banner|**| -->
<br>
<br>
<!-- |**|end egp html banner|**| -->
<div width=3D"1" style=3D"color: white; clear: both;"/>__._,_.___</div>
=20=20=20=20=20=20
=20=20
=20=20=20=20
<div id=3D"fromDMARC" style=3D"clear:both; margin-top: 10px;">
<hr style=3D"height:2px ; border-width:0; color:#E3E3E3; backgroun=
d-color:#E3E3E3;">
Posted by: =3D?UTF-8?B?w4Fkw6FtIFNvc3Rlcmljcw=3D=3D?=3D <soster=
[email protected]> <hr style=3D"height:2px ; border-width:0; co=
lor:#E3E3E3; background-color:#E3E3E3;">
</div>
<!-- Start Recommendations -->
<!-- End Recommendations -->
<!-- |**|begin egp html banner|**| -->
<img src=3D"http://geo.yahoo.com/serv?s=3D97476590/grpId=3D8116923/grpspI=
d=3D1705007181/msgId=3D24828/stime=3D1499875659" width=3D"1" height=3D"1"> =
<br>
<!-- |**|end egp html banner|**| -->
=20=20
<!-- |**|begin egp html banner|**| -->
<br>
=20=20=20
=20=20=20=20=20
=20
<!-- |**|begin egp html banner|**| -->
<div id=3D"ygrp-vital" style=3D"background-color: #f2f2f2; font-fam=
ily: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">
<span id=3D"vithd" style=3D"font-weight: bold; color: #333; text-tr=
ansform: uppercase; "><a href=3D"https://groups.yahoo.com/neo/groups/domain=
drivendesign/info;_ylc=3DX3oDMTJlb2hkY2hzBF9TAzk3MzU5NzE0BGdycElkAzgxMTY5Mj=
MEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5OTg3NTY1OQ--"=
style=3D"text-decoration: none;">Visit Your Group</a></span>
<ul style=3D"list-style-type: none; margin: 0; padding: 0; display: in=
line;">
<li style=3D"border-right: 1px solid #000; font-weight: 700; di=
splay: inline; padding: 0 5px; margin-left: 0;">
<span class=3D"cat"><a href=3D"https://groups.yahoo.com/neo/groups/do=
maindrivendesign/members/all;_ylc=3DX3oDMTJmNGN2bTFtBF9TAzk3MzU5NzE0BGdycEl=
kAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0OT=
k4NzU2NTk-" style=3D"text-decoration: none;">New Members</a></span>
<span class=3D"ct" style=3D"color: #ff7900;">3</span>
</li>
</ul>
</div>
<div id=3D"ft" style=3D"font-family: Arial; font-size: 11px; margin-top: 5p=
x; padding: 0 2px 0 0; clear: both;">
<a href=3D"https://groups.yahoo.com/neo;_ylc=3DX3oDMTJkcjg5ODd1BF9TAzk3ND=
c2NTkwBGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwNmdHIEc2xrA2dmcARzd=
GltZQMxNDk5ODc1NjU5" style=3D"float: left;"><img src=3D"http://l.yimg.com/r=
u/static/images/yg/img/email/new_logo/logo-groups-137x15.png" height=3D"15"=
width=3D"137" alt=3D"Yahoo! Groups" style=3D"border: 0;"/></a>
<div style=3D"color: #747575; float: right;"> • <a href=3D"https://i=
nfo.yahoo.com/privacy/us/yahoo/groups/details.html" style=3D"text-decoratio=
n: none;">Privacy</a> • <a href=3D"mailto:domaindrivendesign-unsubscri=
[email protected]?subject=3DUnsubscribe" style=3D"text-decoration: none;">=
Unsubscribe</a> • <a href=3D"https://info.yahoo.com/legal/us/yahoo/uto=
s/terms/" style=3D"text-decoration: none;">Terms of Use</a> </div>
</div>
<!-- |**|end egp html banner|**| -->
</div> <!-- ygrp-msg -->
=20=20=20
<br>
<!-- |**|end egp html banner|**| -->
<div style=3D"color: white; clear: both;"/>__,_._,___</div>
</body>
</html>
--001a1142f6f402359405541917be--