Re: [testdrivendevelopment] "bottom-up" TDD and common behaviors
"Brian Marick" <[email protected]> Thu, 5 Dec 2019 18:21:25 -0600
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_EEB7CB2B-6565-416B-84B3-F8FD0BCB73B1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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 prett= y small. How much effort should we spend insulating our code against low-pr= obability events? Isolating my code from Ecto would in effect mean inventing a *new* interfa= ce to a RDBMS. Does it really seem likely that I=E2=80=99ll do that better = than the Ecto designers? P.S. I need to spend some time thinking about how FP ideas and OO ideas pl= ay together. My opinion has been that, leaving aside inheritance, typical F= P 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: >=20 > So this is definitely required behavior and it will be your own, so it n= eeds 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 actua= l behavior related tests about animals. >=20 > 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, that= transformation decorator can do nothing if needed. > You basically need a map of fields that can be changed and the transform= ation needed for that field. >=20 > A bit more work, but it allows for a change in Ecto or a change in under= standing of Ecto to not impact the main test suite. >=20 > On Wed, Dec 4, 2019, 01:50 Brian Marick <[email protected] <mailto:mar= [email protected]>> wrote: > Yes. >=20 >> On Dec 3, 2019, at 5:31 AM, Avi Kessner <[email protected] <mailto:ake= [email protected]>> wrote: >>=20 >> If I understand correctly, the code here is specifically for doing an E= cto transformation, correct? If you decide not to use Ecto the need for thi= s abstraction is removed? >=20 >=20 >=20 >=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 (#35810): https://groups.io/g/testdrivendevelopment/mess= age/35810 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- --Apple-Mail=_EEB7CB2B-6565-416B-84B3-F8FD0BCB73B1 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset= = =3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: = space; line-break: after-white-space;" class=3D"">That raises an interestin= g general question.<div class=3D""><br class=3D""></div><div class=3D"">"Th= e technology" is a web framework and its linked database framework.</div><d= iv class=3D""><br class=3D""></div><div class=3D"">The risk of those changi= ng in a way that breaks a lot of old code is pretty small. How much effort = should we spend insulating our code against low-probability events?</div><d= iv class=3D""><br class=3D""></div><div class=3D"">Isolating my code from E= cto would in effect mean inventing a *new* interface to a RDBMS. Does it re= ally seem likely that I=E2=80=99ll do that better than the Ecto designers?<= /div><div class=3D""><br class=3D""></div><div class=3D"">P.S. I need to sp= end some time thinking about how FP ideas and OO ideas play together. My op= inion has been that, leaving aside inheritance, typical FP languages are no= t different, in practice, than OO languages. But I wonder if that=E2=80=99s= right.<br class=3D""><div><br class=3D""><blockquote type=3D"cite" class= =3D""><div class=3D"">On Dec 4, 2019, at 12:43 AM, Avi Kessner <<a href= = =3D"mailto:[email protected]" class=3D"">[email protected]</a>> wrote= :</div><br class=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"= auto" class=3D"">So this is definitely required behavior and it will be you= r own, so it needs to be tested.<div dir=3D"auto" class=3D"">On the other h= and, it's a very specific implementation detail which could change when the= technology changes and we don't want that to impact actual behavior relate= d tests about animals.</div><div dir=3D"auto" class=3D""><br class=3D""></d= iv><div dir=3D"auto" class=3D"">What I would do is make a transformation de= corator and then test sample data to see that it gets transformed correctly= . If Ecto ever changes, that transformation decorator can do nothing = if needed.</div><div dir=3D"auto" class=3D"">You basically need a map of fi= elds that can be changed and the transformation needed for that field.</div= ><div dir=3D"auto" class=3D""><br class=3D""></div><div dir=3D"auto" class= =3D"">A bit more work, but it allows for a change in Ecto or a change in u= nderstanding of Ecto to not impact the main test suite.</div></div><br clas= s=3D""><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On = Wed, Dec 4, 2019, 01:50 Brian Marick <<a href=3D"mailto:marick@exampler.= com" class=3D"">[email protected]</a>> wrote:<br class=3D""></div><blo= ckquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #c= cc solid;padding-left:1ex"><div style=3D"word-wrap:break-word;line-break:af= ter-white-space" class=3D""><div style=3D"word-wrap:break-word;line-break:a= fter-white-space" class=3D"">Yes.<br class=3D""><div class=3D""><br class= =3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On Dec 3, 2019,= at 5:31 AM, Avi Kessner <<a href=3D"mailto:[email protected]" target= =3D"_blank" rel=3D"noreferrer" class=3D"">[email protected]</a>> wrote= :</div><br class=3D""><div class=3D""><span style=3D"font-family:Helvetica;= font-size:16px;font-style:normal;font-variant-caps:normal;font-weight:norma= l;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:non= e;white-space:normal;word-spacing:0px;text-decoration:none;float:none;displ= ay:inline!important" class=3D"">If I understand correctly, the code here is= specifically for doing an Ecto transformation, correct? 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;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" class=3D""></div></blockquote></div><br class=3D""></div></div>= <div class=3D""><br class=3D"webkit-block-placeholder"></div><div class=3D"= "><br class=3D"webkit-block-placeholder"></div></blockquote></div> </div></blockquote></div><br class=3D""></div></body></html> <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/35810">View/Reply Online (#35810)</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=3DPr= ivate:%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> --Apple-Mail=_EEB7CB2B-6565-416B-84B3-F8FD0BCB73B1--