¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date   
"Find or Create" functions: a discussion 10
Hi, folks. An old issue came back to the surface this month in consultation with clients and I'd like your opinion. It regards the old "find or create" pattern. It seems to violate Command/Query Separation (as I understand it), but it seems handy and harmless, so I'd like to find out more about what you folks think about it. Benign? Problematic? I imagine using this with the Repository pattern. Let's say we register a patient in a medical environment and so we need a UI that reduces as much as possible the number of steps. We don't want to force the user to look up a patient just to discover that the hospital has no record of them, so we allow the user to enter some basic identifying information. This information suffices to either find an existing patient or create a new one if our database doesn't know that patient. The result is something like Patient registeredPatient = patientRepository.findOrCreate(patientIdentifyingInformation); The identifying information might have basics like name, date of birth, it doesn't matter. We can guarantee that registeredPatient now represents an Entity in our system, either because we found someone that matched the identifying information or because we created one. This appears to violate CQS, but it seems like a good thing to have. Some individuals struggle with this, because they don't know whether this is an area where CQS "doesn't matter" or an area where CQS is trying to teach them something and they can't see what they're meant to learn. I haven't thought about this in depth in years, so I feel the same way right now. Drawbacks? Alternatives? I was also thinking about how to design this, and it seems to me like a special case of getOrAbsent(), so that I could implement the generic findOrCreate() algorithm with something like repository.find(identifyingInformation).orElse(T::createFromIdentifyingInformation) where find() returns Maybe TIdentifyingInformation and T has a named constructor for creating a T from a TIdentifyingInformation. I'm assuming here that TIdentifyingInformation is enough to provide all the mandatory properties of T. With this design, I don't need a single findOrCreate() function any more, because the pieces find() and orElse(T::create) communicate the idea well enough. Thoughts? I'm happy to see the discussion meander. Is this a totally-solved issue and there's one clear good way to proceed? or is it more a matter of context or preference? -- J. B. (Joe) Rainsberger :: https://tdd.training :: http://www.jbrains.ca :: http://www.thecodewhisperer.com
Started by J. B. Rainsberger @ · Most recent @
[TDD] An icon for TDD? 200x200 px. 4
There can be only one :-) Red, green, refactor. In the usual loop. Cheers Mark
Started by Mark Levison @ · Most recent @
An icon for TDD? 200x200 px.
Hey, folks. I have a cover photo for the new group, but I need an icon that represents TDD. Something square, ideally 200px square. Any suggestions? -- J. B. (Joe) Rainsberger :: https://tdd.training :: http://www.jbrains.ca :: http://www.thecodewhisperer.com
Started by J. B. Rainsberger @
[TDD] Re: Owners/Moderators: Transfering this group to groups.io
Me too ¨C still here ? Sent: 30 October 2019 19:50 To: testdrivendevelopment@... Subject: [TDD] Re: Owners/Moderators: Transfering this group to groups.io I too can hear you... didn't know I was part of this group [Non-text portions of this message have been removed]
Started by John Donaldson @
ANN: This group is moving to groups.io soon
Hi, folks. I bet you didn't even remember that you were a member of this group! We are transferring this group to groups.io. This wil happen in the next 1-2 weeks, so if you start receiving emails from groups.io, don't panic. Groups.io will allow you to continue to participate in these discussions entirely by email, so not much will change except that if you've set up any email filters, you'll need to do a little work to migrate them to groups.io. Sorry about that. I hope that we can revive some discussions here! I'm happy to pay to transfer this group so that we can rescue the content and perhaps preserve it somehow. (Groups.io has an export facility that I haven't tried yet.) I'll look into that once the excitement of racing against Yahoo!'s deadline has passed. Incidentally, we've recovered the extremeprogramming group, too, and there have even been some new discussions there. If that interests you, then visit /g/extremeprogramming Thanks! -- J. B. (Joe) Rainsberger :: https://tdd.training :: http://www.jbrains.ca :: http://www.thecodewhisperer.com
Started by J. B. Rainsberger @
[TDD] Owners/Moderators: Transfering this group to groups.io 3
Hi Joe, At least one guy is hearing you! I think it's a great idea but I don't know who the owner of this group is. Charlie
Started by Charlie Poole @ · Most recent @
[TDD] Owners/Moderators: Transfering this group to groups.io 2
FYI both messages came via Yahoo groups and not group.io Cheers Mark
Started by Mark Levison @ · Most recent @
[TDD] Re: Yahoo Groups Discontinued 2
I¡¯m all for it. Transfer away! -- Thanks, Roy Osherove http://osherove.com http://elasticleadership.com
Started by Roy Osherove @ · Most recent @
Owners/Moderators: Transfering this group to groups.io 2
Hi, folks. My recent messages are either not being delivered or are slow to be delivered, so I can't tell whether anyone is hearing me. :) Please do these two things: 1. Make me an owner of this group. 2. Invite [email protected] to this group. These will help us transfer the group to groups.io. Thanks! -- J. B. (Joe) Rainsberger :: https://tdd.training :: http://www.jbrains.ca :: http://www.thecodewhisperer.com
Started by J. B. Rainsberger @ · Most recent @
Yahoo Groups Discontinued
Please give me owner permissions for this group. I don't seem to have it already and it would make the transfer simpler for everyone. Thanks!
Started by J. B. Rainsberger @
Yahoo Groups Discontinued
Please give me owner permission if I don't already have it. Thanks!
Started by J. B. Rainsberger @
Yahoo Groups Discontinued 3
Hi All! I hear that Yahoo Groups are to be discontinued. There is work afoot over in extremeprogramming@... to move the archive the groups.io. There's a cost of $220 for a year's premium subscription which is required for the transfer, but not afterwards if the group size remains under 1GB. Is there any appetite to move this mailing list as well? Or does anybody have an accessible backup already? It would be a shame to lose a valuable resource. Thanks, Douglas.
Started by Douglas Waugh @ · Most recent @
[TDD] Re: Yahoo Groups Discontinued
Hi Carlos, Glad to have you on board! There are some instructions on how to transfer. /yahootransfer The crux of the matter is finding a moderator of this group who can make the groups.io user a moderator. Are you a moderator Carlos? Is there a moderator out there willing to help? We need to get the transfer request in by 1 December for groups.io to transfer it over, so there¡¯s a small window of opportunity for us. Thanks, Douglas
Started by Douglas Waugh @
Explore JUnit 5 in fifteen minutes!
If you have not taken the opportunity to explore JUnit 5... here is fifteen minute "QuickStart"! http://pedcentral.com/justify/justify-quickstart
Started by MarvinToll@... @
TDD on UWP apps 2
Hello group. I¡¯ve been really wanting to teach my self UWP since I comfortable with WPF. Strangely enough (to some people) the biggest hurdle for me learning is that I can¡¯t practice TDD when creating a universal windows platform app. I¡¯ve seen countless examples of people making basic math tests for either .net core or a UWP app but either the process doesn¡¯t work for me or it is too slow to be considered useful. I¡¯ve searched on Pluralsight and Youtube (out of desperation) as well as tons of blog posts on the matter but have yet to find any good information out there. For instance what about UWP architecture? If I truly can¡¯t test the UI portion of the app that¡¯s fine but then how do I add a class library that I can both unit test and consume in my UI? Does anyone have any resources or care to point me in the right direction with this? Thank you, Robert Snyder Sent from Mail for Windows 10
Started by Robert Snyder @ · Most recent @
[TDD] Long running test suite 7
Joen, What language(s) and platform are you working with? Dave...
Started by Dave Rooney @ · Most recent @
Justify: support for ¡°real¡± services
The soon to be released Justify Open Source projectsupporting rule-based CDI JUnit testing is now briefly documented for SystemEngineers at http://pedcentral.com/justify/. We appreciate any feedback that can be rendered beforethe GA release by those that give it a try. _Marvin
Started by MarvinToll@... @
[TDD] Long running test suite 6
25 minutes is ridiculously long. The old XP rule was 10 minutes and that was with 90s hardware. I start to get annoyed when it takes more than a few seconds. Likely the problem is too many of the wrong kinds of tests. What you want are what our friend Mike Hill calls microtests--small tests that exercise one behavior of one interface in isolation. What you don't want is things that emulate users poking at a real UI. Anything in between is diminishing returns. A couple integration tests will give you some confidence. A bunch of them will get so annoying that you stop paying attention ("just run it again...")
Started by Adam Sroka @ · Most recent @
[TDD] Long running test suite
A common approach is to split your tests by type (unit, integration, UI), or at least by speed (fast, slow). Then, always run the fast tests before check-in, but let the build/CI server run the slow tests (all the tests). This way, you're able to check in frequently but you still have the CI server there to catch anything your unit tests (the fast ones) miss. If you're not sure whether your tests are unit or integration tests, I wrote about the differences a while ago here: http://ardalis.com/unit-test-or-integration-test-and-why-you-should-care Steve -- Steve Smith http://Ardalis.com/ http://twitter.com/ardalis
Started by Steven Smith @
[TDD] Long running test suite
We use https://rubygems.org/gems/parallel_tests . Be sure not to run more parallel test processes than you have CPU cores available, or the tests won't run as fast as they can. -- Albert Davidson Chou
Started by Al Chou @
Current Image
Image Name
Sat 8:39am