Re: [testdrivendevelopment] "bottom-up" TDD and common behaviors

"Steve Gordon" <[email protected]> Thu, 5 Dec 2019 18:38:34 -0700
Newsgroups gmane.comp.programming.test-driven-development
Message-ID <CAF7qo6WPVkxCevmHKN4tu470FcFAKJTEXFSgA4kLd7_9p1JX+Q@mail.gmail.com>
--000000000000591ce60598ff1b0c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

We should listen to our paying customers who may have some thoughts on the
future of their company and their application.  They may not want to pay
for the extra time and effort to abstract a framework that they may have
chosen for a specific business reason,  They may prefer to be maintaining =
a
family of applications that leverage the same framework in the obvious
direct way instead of a family of applications where each team decides to
abstract that framework away in subtly different ways.

However, if I am abstracting out the database, I much
prefect employee.store() over employee-storage.store_record().  Why should
I impose "_storage" and "_record" on code that is abstracting the database
details?

On Thu, Dec 5, 2019 at 5:47 PM Daniel Olewski <[email protected]> wrote:

> All frameworks change eventually, or stop working when say OS version is
> updated. Many of us have learned that the hard way =E2=80=A6 .
>
> Inventing a new RDBMS interface =E2=80=93 that means leaking RDBMS world=
 into your
> application domain. And perhaps also implies the bigger work of covering
> all of RDBMS functionality. When we use RDBMS it=E2=80=99s just for stor=
age of data
> =E2=80=A6 today. Tomorrow it can be a blob in the cloud, next year it wi=
ll be
> something different. I do want my code to be flexible for all those. One
> way to do that is to isolate on the edge of how the app domain logic use=
s
> the storage. Think `employee_storage.store_employee()` vs
> `rdbms.insert_record()`. A nuance, but an important one IMO. Once we hav=
e
> that =E2=80=93 the app won=E2=80=99t care how the storage is implemented=
 and a simple
> =E2=80=98in-memory employee storage=E2=80=99 or =E2=80=98local-file empl=
oyee storage=E2=80=99 will suffice
> for unit or some integration testing ..
>
>
>
> *From: *<[email protected]> on behalf of Brian Marick <
> [email protected]>
> *Reply-To: *"[email protected]" <
> [email protected]>
> *Date: *Thursday, December 5, 2019 at 4:21 PM
> *To: *"[email protected]" <[email protected]=
>
> *Subject: *Re: [testdrivendevelopment] "bottom-up" TDD and common
> behaviors
>
>
>
> That raises an interesting general question.
>
>
>
> "The technology" is a web framework and its linked database framework.
>
>
>
> The risk of those changing in a way that breaks a lot of old code is
> pretty small. How much effort should we spend insulating our code agains=
t
> low-probability events?
>
>
>
> Isolating my code from Ecto would in effect mean inventing a *new*
> interface to a RDBMS. Does it really seem likely that I=E2=80=99ll do th=
at better
> than the Ecto designers?
>
>
>
> P.S. I need to spend some time thinking about how FP ideas and OO ideas
> play together. My opinion has been that, leaving aside inheritance, typi=
cal
> FP languages are not different, in practice, than OO languages. But I
> wonder if that=E2=80=99s right.
>
>
>
> On Dec 4, 2019, at 12:43 AM, Avi Kessner <[email protected]> wrote:
>
>
>
> So this is definitely required behavior and it will be your own, so it
> needs to be tested.
>
> On the other hand, it's a very specific implementation detail which coul=
d
> change when the technology changes and we don't want that to impact actu=
al
> behavior related tests about animals.
>
>
>
> What I would do is make a transformation decorator and then test sample
> data to see that it gets transformed correctly.  If Ecto ever changes, t=
hat
> transformation decorator can do nothing if needed.
>
> You basically need a map of fields that can be changed and the
> transformation needed for that field.
>
>
>
> A bit more work, but it allows for a change in Ecto or a change in
> understanding of Ecto to not impact the main test suite.
>
>
>
> On Wed, Dec 4, 2019, 01:50 Brian Marick <[email protected]> wrote:
>
> Yes.
>
>
>
> On Dec 3, 2019, at 5:31 AM, Avi Kessner <[email protected]> wrote:
>
>
>
> If I understand correctly, the code here is specifically for doing an Ec=
to
> transformation, correct? If you decide not to use Ecto the need for this
> abstraction is removed?
>
>
>
>
>
>
>
>
>
>=20
>
>

-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#35812): https://groups.io/g/testdrivendevelopment/mess=
age/35812
Mute This Topic: https://groups.io/mt/64491946/3268755
Group Owner: [email protected]
Unsubscribe: https://groups.io/g/testdrivendevelopment/leave/6156322/74455=
6386/xyzzy  [[email protected]]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-


--000000000000591ce60598ff1b0c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">We should listen to our paying customers who may have some=
 thoughts on the future of their company and their application.=C2=A0 They =
may not want to pay for the extra time and effort to abstract a framework=
=C2=A0that they may have chosen for a specific business reason,=C2=A0 They=
=
=C2=A0may prefer to be maintaining a family of applications that leverage =
the same framework in the obvious direct way instead of a family of applica=
tions where each team decides to abstract that framework away in subtly=C2=
=A0different ways.<div><br></div><div>However, if I am abstracting out the=
 database, I much prefect=C2=A0employee.store() over employee-storage.store=
_record().=C2=A0 Why should I impose &quot;_storage&quot; and &quot;_record=
&quot; on code that is abstracting the database details?</div></div><br><di=
v class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Dec 5=
, 2019 at 5:47 PM Daniel Olewski &lt;<a href=3D"mailto:[email protected]">do=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex">





<div lang=3D"EN-US">
<div class=3D"gmail-m_-8608840119811902951WordSection1">
<p class=3D"MsoNormal">All frameworks change eventually, or stop working w=
hen say OS version is updated. Many of us have learned that the hard way =
=E2=80=A6 .<u></u><u></u></p>
<p class=3D"MsoNormal">Inventing a new RDBMS interface =E2=80=93 that mean=
s leaking RDBMS world into your application domain. And perhaps also implie=
s the bigger work of covering all of RDBMS functionality. When we use RDBMS=
 it=E2=80=99s just for storage of data =E2=80=A6 today. Tomorrow
 it can be a blob in the cloud, next year it will be something different. =
I do want my code to be flexible for all those. One way to do that is to is=
olate on the edge of how the app domain logic uses the storage. Think `empl=
oyee_storage.store_employee()` vs
 `rdbms.insert_record()`. A nuance, but an important one IMO. Once we have=
 that =E2=80=93 the app won=E2=80=99t care how the storage is implemented a=
nd a simple =E2=80=98in-memory employee storage=E2=80=99 or =E2=80=98local-=
file employee storage=E2=80=99 will suffice for unit or some integration te=
sting
 .. <u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div style=3D"border-right:none;border-bottom:none;border-left:none;border=
-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class=3D"MsoNormal"><b><span style=3D"font-size:12pt;color:black">From:=
 </span></b><span style=3D"font-size:12pt;color:black">&lt;<a href=3D"mailt=
o:[email protected]" target=3D"_blank">testdrivendevelopment@=
groups.io</a>&gt; on behalf of Brian Marick &lt;<a href=3D"mailto:marick@ex=
ampler.com" target=3D"_blank">[email protected]</a>&gt;<br>
<b>Reply-To: </b>&quot;<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>&quot; &lt;<a href=3D"=
mailto:[email protected]" target=3D"_blank">testdrivendevelop=
[email protected]</a>&gt;<br>
<b>Date: </b>Thursday, December 5, 2019 at 4:21 PM<br>
<b>To: </b>&quot;<a href=3D"mailto:[email protected]" target=
=
=3D"_blank">[email protected]</a>&quot; &lt;<a href=3D"mailt=
o:[email protected]" target=3D"_blank">testdrivendevelopment@=
groups.io</a>&gt;<br>
<b>Subject: </b>Re: [testdrivendevelopment] &quot;bottom-up&quot; TDD and =
common behaviors<u></u><u></u></span></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<p class=3D"MsoNormal">That raises an interesting general question. <u></u=
><u></u></p>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">&quot;The technology&quot; is a web framework and i=
ts linked database framework.<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">The risk of those changing in a way that breaks a l=
ot of old code is pretty small. How much effort should we spend insulating =
our code against low-probability events?<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Isolating my code from Ecto would in effect mean in=
venting a *new* interface to a RDBMS. Does it really seem likely that I=E2=
=80=99ll do that better than the Ecto designers?<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">P.S. I need to spend some time thinking about how F=
P ideas and OO ideas play together. My opinion has been that, leaving aside=
 inheritance, typical FP languages are not different, in practice, than OO =
languages. But I wonder if that=E2=80=99s right.<u></u><u></u></p>
<div>
<p class=3D"MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style=3D"margin-top:5pt;margin-bottom:5pt">
<div>
<p class=3D"MsoNormal">On Dec 4, 2019, at 12:43 AM, Avi Kessner &lt;<a hre=
f=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt=
; wrote:<u></u><u></u></p>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div>
<div>
<p class=3D"MsoNormal">So this is definitely required behavior and it will=
 be your own, so it needs to be tested.
<u></u><u></u></p>
<div>
<p class=3D"MsoNormal">On the other hand, it&#39;s a very specific impleme=
ntation detail which could change when the technology changes and we don&#3=
9;t want that to impact actual behavior related tests about animals.<u></u>=
<u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">What I would do is make a transformation decorator =
and then test sample data to see that it gets transformed correctly.=C2=A0 =
If Ecto ever changes, that transformation decorator can do nothing if neede=
d.<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">You basically need a map of fields that can be chan=
ged and the transformation needed for that field.<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">A bit more work, but it allows for a change in Ecto=
 or a change in understanding of Ecto to not impact the main test suite.<u>=
</u><u></u></p>
</div>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div>
<div>
<p class=3D"MsoNormal">On Wed, Dec 4, 2019, 01:50 Brian Marick &lt;<a href=
=
=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&=
gt; wrote:<u></u><u></u></p>
</div>
<blockquote style=3D"border-top:none;border-right:none;border-bottom:none;=
border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:=
4.8pt;margin-right:0in">
<div>
<div>
<p class=3D"MsoNormal">Yes.<u></u><u></u></p>
<div>
<p class=3D"MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style=3D"margin-top:5pt;margin-bottom:5pt">
<div>
<p class=3D"MsoNormal">On Dec 3, 2019, at 5:31 AM, Avi Kessner &lt;<a href=
=
=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt=
; wrote:<u></u><u></u></p>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt;font-family:Helvetica=
">If I understand correctly, the code here is specifically=C2=A0for doing a=
n Ecto transformation, correct? If you decide not to use Ecto the need for =
this abstraction is removed?</span><u></u><u></u></p>
</div>
</blockquote>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u></p>
</div>
</div>
</div>




<p></p><p></p></blockquote></div>

<div width=3D"1" style=3D"color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>

You receive all messages sent to this group.


<p>

<a target=3D"_blank" href=3D"https://groups.io/g/testdrivendevelopment/mes=
sage/35812">View/Reply Online (#35812)</a> |


  <a target=3D"_blank" href=3D"mailto:[email protected]?subj=
ect=3DRe:%20Re%3A%20%5Btestdrivendevelopment%5D%20%22bottom-up%22%20TDD%20a=
nd%20common%20behaviors">Reply To Group</a>
  
    | <a target=3D"_blank" href=3D"mailto:[email protected]?subject=3DP=
rivate:%20Re:%20Re%3A%20%5Btestdrivendevelopment%5D%20%22bottom-up%22%20TDD=
%20and%20common%20behaviors">Reply To Sender</a>
  


|


  
    <a target=3D"_blank" href=3D"https://groups.io/mt/64491946/3268755">Mu=
te This Topic</a>
  

| <a href=3D"https://groups.io/g/testdrivendevelopment/post">New Topic</a>=
<br>



<br>

<a href=3D"https://groups.io/g/testdrivendevelopment/editsub/3268755">Your=
 Subscription</a> |
<a href=3D"mailto:[email protected]">Contact Group Own=
er</a> |

<a href=3D"https://groups.io/g/testdrivendevelopment/leave/6156322/7445563=
86/xyzzy">Unsubscribe</a>

 [[email protected]]<br>
<div width=3D"1" style=3D"color:white;clear:both">_._,_._,_</div>


--000000000000591ce60598ff1b0c--