Re: [testdrivendevelopment] "Find or Create" functions: a discussion
"Frank Carver via Groups.Io" <[email protected]> Mon, 25 Nov 2019 10:20:51 +0000
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CAPe_wAK4S73qcpSGTP+VeFNO3mEpJ=4XRNguLQ_pAkDCRD+Wfg@mail.gmail.com> |
--000000000000d5de940598291e73 Content-Type: text/plain; charset="UTF-8" I think there's an issue of naming and grouping here too. What we are calling findOrCreate sits in a soup of possible API actions for this sort of task. Some other common options include: - strict get - fail if not present, get if present - lazy get - default if not present, get if present - strict create - create if not present, fail if present, - - strict update - fail if not present, update if present - replace/put - create if not present, update if present, - ensure - create if not present, ignore if present - strict delete - fail if not present, remove if present - lazy delete - ignore if not present, remove if present Some of the confusion in this area comes from looking at he needs of the system though different "lenses". The CRUD view prioritises strict get, strict create, strict update, and strict delete. The REST view prioritises pure or lazy get, replace/put, and lazy delete. One of the many things I find myself explaining much too often is that REST is not CRUD. Conflating the two worldviews leads to all sorts of confusion. Frank. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#35761): https://groups.io/g/testdrivendevelopment/message/35761 Mute This Topic: https://groups.io/mt/61872506/3268755 Group Owner: [email protected] Unsubscribe: https://groups.io/g/testdrivendevelopment/leave/6156322/744556386/xyzzy [[email protected]] -=-=-=-=-=-=-=-=-=-=-=- --000000000000d5de940598291e73 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">I think there's an issue of naming and grouping here t= oo.<div><br></div><div>What we are calling findOrCreate sits in a soup of p= ossible API actions for this sort of task. Some other common options includ= e:</div><div><ul><li>strict get - fail if not present, get if present</li><= li>lazy get - default if not present, get if present</li><li>strict create = -=20 create if not present, fail if present, </li><li></li><li>strict update - = fail if not present, update if present</li><li>replace/put -=20 create if not present, update if present,<br></li><li>ensure - create if n= ot present, ignore if present</li><li>strict delete - fail if not present, = remove if present</li><li>lazy delete - ignore if not present, remove if pr= esent</li></ul><div>Some of the confusion in this area comes from looking a= t he needs of the system=C2=A0though different "lenses". The CRUD= view prioritises strict get, strict create, strict update, and strict dele= te. The REST view prioritises pure or lazy get, replace/put, and lazy delet= e.</div></div><div><br></div><div>One of the many things I find myself expl= aining much too often is that REST is not CRUD. Conflating the two worldvie= ws leads to all sorts of confusion.</div><div><br></div><div>Frank.</div><d= iv><br></div><div><br></div></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/35761">View/Reply Online (#35761)</a> | <a target=3D"_blank" href=3D"mailto:[email protected]?subj= ect=3DRe:%20Re%3A%20%5Btestdrivendevelopment%5D%20%22Find%20or%20Create%22%= 20functions%3A%20a%20discussion">Reply To Group</a> | <a target=3D"_blank" href=3D"mailto:[email protected]?subj= ect=3DPrivate:%20Re:%20Re%3A%20%5Btestdrivendevelopment%5D%20%22Find%20or%2= 0Create%22%20functions%3A%20a%20discussion">Reply To Sender</a> | <a target=3D"_blank" href=3D"https://groups.io/mt/61872506/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> --000000000000d5de940598291e73--