Thanks for the writeup both. It’s always good to see how different people 
approach the same exercise. And thanks to Rob for facilitating!

Based on your post Baz I do feel compelled to jump in and defend the 
smallest-possible-change idea in the exercise. Myself and Nial did our best to 
stick within those rules and we were pretty pleased with the code we ended up 
with. There were a couple of things I think that helped keep us on track. One 
of those things: we’d do the shameless green first, but then would look for 
obvious refactorings to improve the code once we had green specs before moving 
to the next spec. Second: we didn’t necessarily follow the specific examples as 
they were written in the exercise. If the shameless-green solution felt “wrong” 
(for example because it was hardcoding some logic or values in way that would 
obviously break with more examples), we’d add a spec to break it in a way that 
forced us to address the wrongness. I think by doing those two things we were 
able to shift the code into something more sensible in small increments and 
keep with the spirit of the exercise.

That’s not to say we didn’t also struggle at times with the slow, incremental 
steps, or have to suppress a desire to introduce concepts and abstractions 
before they were strictly necessary. For example we discussed decoupling the 
price calculation/discount from the checkout itself similarly to the 
ProductPriceCalculator in your solution, but actually resisted that because the 
exercise hadn’t specified that there would be more than one type of discount to 
apply. If it had, I’m confident we’d have naturally arrived at that abstraction 
going step-by-step.

Here’s as far as we got: 
https://gist.github.com/tekin/43f67981ead8419c37d37405be4e8704

Far from a perfect solution, and we had a fair few things we wanted to improve 
(naming, etc) and also to simplify/rework the specs, but ran out of time.

It would have been great to have discuss some of this more in the session, 
shame the thirst got the better of you and Will before the end ;p

Tekin



> On 22 Nov 2024, at 10:51, Rahoul Baruah <rahoul.bar...@gmail.com> wrote:
> 
> I did a write-up on it on the train home: 
> https://theartandscienceofruby.com/test-driven-development-kata-9/ (plus a 
> quick tidy up of the final code - I'm pretty pleased with how it turned out). 
> 
> B
> 
> On Friday, 22 November 2024 at 09:53:00 UTC Darren Jones wrote:
>> Really loved the session last night, be good to do something similar again 
>> (or even a longer coding session on a weekend?) Thanks to Rob for running it!
>> 
>> This is where me and Ste got up to:
>> 
>> 
>> All the tests were passing, but we weren't happy with so much logic being in 
>> the scan method. Our next move was to move most of that logic out of the 
>> scan method, use the total method more and probably create some more methods.
>> 
>> We also weren't completely happy with how the pricing rules were presented 
>> and would probably think a bit more about that. The seemed to be described 
>> in a deliberately vague way in the kata, so getting the description right 
>> for those would help, especially to cover different types of offers.
>> 
>> The next consideration was whether or not to cache more info in the cart. 
>> Currently it just keeps track of which items have been added and in what 
>> order, but we considered keeping a running total and sub-totals for each 
>> item as well.
>> 
>> Be interesting to see what everyone else came up with!
>> 
>> DAZ
>> ps - Ste recommended this talk by Sandi Metz about refactoring the Gilded 
>> Rose Kata
>> https://www.youtube.com/watch?v=8bZh5LMaSmE
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "North West Ruby User Group (NWRUG)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to nwrug-members+unsubscr...@googlegroups.com 
> <mailto:nwrug-members+unsubscr...@googlegroups.com>.
> To view this discussion, visit 
> https://groups.google.com/d/msgid/nwrug-members/a4e87f6a-ef1e-48f0-955b-5c2318763fafn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/nwrug-members/a4e87f6a-ef1e-48f0-955b-5c2318763fafn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"North West Ruby User Group (NWRUG)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nwrug-members+unsubscr...@googlegroups.com.
To view this discussion, visit 
https://groups.google.com/d/msgid/nwrug-members/3C7C10E3-9A42-48B1-9498-A092DE76AA8E%40tekin.co.uk.

Reply via email to