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

"Avi Kessner" <[email protected]> Fri, 6 Dec 2019 08:35:56 +0200
Newsgroups gmane.comp.programming.test-driven-development
Message-ID <CAGEhWpHUWXm44=28TbG8Je+czB8MfohNxbXXPJYwQ8Mp63U-sA@mail.gmail.com>
--000000000000d4cd180599034282
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

My team recently had to switch from Hapi to Express (or from Hapi 14 to the
new version of Hapi which has some major breaking changes) because Express
has a better security update policy for us.

The change was pretty simple because we wrapped all our calls to the
framework in an isolated layer.

I wouldn't say we made our own framework, we just made wrappers for the
subset of the framework that we directly use.

On Fri, Dec 6, 2019, 02:21 Brian Marick <[email protected]> wrote:

> 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
>> Ecto transformation, correct? If you decide not to use Ecto the need fo=
r
>> 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 (#35815): https://groups.io/g/testdrivendevelopment/mess=
age/35815
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-


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

<div dir=3D"auto">My team recently had to switch from Hapi to Express (or f=
rom Hapi 14 to the new version of Hapi which has some major breaking change=
s) because Express has a better security update policy for us.<div dir=3D"a=
uto"><br></div><div dir=3D"auto">The change was pretty simple because we wr=
apped all our calls to the framework in an isolated layer.</div><div dir=3D=
"auto"><br></div><div dir=3D"auto">I wouldn&#39;t say we made our own frame=
work, we just made wrappers for the subset of the framework that we directl=
y use.</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"=
gmail_attr">On Fri, Dec 6, 2019, 02:21 Brian Marick &lt;<a href=3D"mailto:m=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex"><div style=3D"word-wrap:break-word;line-break:after-whi=
te-space">That raises an interesting general question.<div><br></div><div>&=
quot;The technology&quot; is a web framework and its linked database framew=
ork.</div><div><br></div><div>The risk of those changing in a way that brea=
ks a lot of old code is pretty small. How much effort should we spend insul=
ating our code against low-probability events?</div><div><br></div><div>Iso=
lating my code from Ecto would in effect mean inventing a *new* interface t=
o a RDBMS. Does it really seem likely that I=E2=80=99ll do that better than=
 the Ecto designers?</div><div><br></div><div>P.S. I need to spend some tim=
e thinking about how FP ideas and OO ideas play together. My opinion has be=
en that, leaving aside inheritance, typical FP languages are not different,=
 in practice, than OO languages. But I wonder if that=E2=80=99s right.<br><=
div><br><blockquote type=3D"cite"><div>On Dec 4, 2019, at 12:43 AM, Avi Kes=
sner &lt;<a href=3D"mailto:[email protected]" target=3D"_blank" rel=3D"nor=
eferrer">[email protected]</a>&gt; wrote:</div><br><div><div dir=3D"auto">=
So this is definitely required behavior and it will be your own, so it need=
s to be tested.<div dir=3D"auto">On the other hand, it&#39;s a very specifi=
c implementation detail which could change when the technology changes and =
we don&#39;t want that to impact actual behavior related tests about animal=
s.</div><div dir=3D"auto"><br></div><div dir=3D"auto">What I would do is ma=
ke a transformation decorator and then test sample data to see that it gets=
 transformed correctly.=C2=A0 If Ecto ever changes, that transformation dec=
orator can do nothing if needed.</div><div dir=3D"auto">You basically need =
a map of fields that can be changed and the transformation needed for that =
field.</div><div dir=3D"auto"><br></div><div dir=3D"auto">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.</div></div><br><div class=3D"gmail_quote"><=
div dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 4, 2019, 01:50 Brian Maric=
k &lt;<a href=3D"mailto:[email protected]" target=3D"_blank" rel=3D"noref=
errer">[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex"><div style=3D"word-wrap:break-word;line-break:after-white-space"><di=
v style=3D"word-wrap:break-word;line-break:after-white-space">Yes.<br><div>=
<br><blockquote type=3D"cite"><div>On Dec 3, 2019, at 5:31 AM, Avi Kessner =
&lt;<a href=3D"mailto:[email protected]" rel=3D"noreferrer noreferrer" tar=
get=3D"_blank">[email protected]</a>&gt; wrote:</div><br><div><span style=
=3D"font-family:Helvetica;font-size:16px;font-style:normal;font-variant-ca=
ps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-in=
dent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decor=
ation:none;float:none;display:inline!important">If I understand correctly, =
the code here is specifically=C2=A0for doing an Ecto transformation, correc=
t? If you decide not to use Ecto the need for this abstraction is removed?<=
/span><br style=3D"font-family:Helvetica;font-size:16px;font-style:normal;f=
ont-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align=
:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:=
0px;text-decoration:none"></div></blockquote></div><br></div></div><div><br=
></div><div><br></div></blockquote></div>



</div></blockquote></div><br></div></div>



</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/35815">View/Reply Online (#35815)</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=3DPri=
vate:%20Re:%20Re%3A%20%5Btestdrivendevelopment%5D%20%22bottom-up%22%20TDD%2=
0and%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>


--000000000000d4cd180599034282--