Comments on: Refactoring / Design: Composed Method https://andypalmer.com/2008/02/refactoring-design-composed-method/ Views on software, technology, consulting and business process Fri, 11 Nov 2011 22:30:05 +0000 hourly 1 https://wordpress.org/?v=6.4.3 By: Lovegra https://andypalmer.com/2008/02/refactoring-design-composed-method/comment-page-1/#comment-1107 Fri, 11 Nov 2011 22:30:05 +0000 http://www.andypalmer.com/blog/?p=6#comment-1107 The stand itself is composed of two recycled plastic clips that are designed to connect to each other when not in use. The clips themselves come in either …

]]>
By: Andy https://andypalmer.com/2008/02/refactoring-design-composed-method/comment-page-1/#comment-17 Tue, 12 Aug 2008 18:58:00 +0000 http://www.andypalmer.com/blog/?p=6#comment-17 That’s looking good 🙂
The point of the post was that the first thing we should do is get to a consistent detail level.
I rolled up the “how we wash our hands” into a “what are we doing?” washHands method.
My feeling is that washing hands is nothing to do with the making of the base. The chef should make sure he washes his hands before he starts making the base, but we’ll get there eventually 🙂

]]>
By: Kris https://andypalmer.com/2008/02/refactoring-design-composed-method/comment-page-1/#comment-7 Sun, 10 Aug 2008 23:10:00 +0000 http://www.andypalmer.com/blog/?p=6#comment-7 I'm not a fan of a CheeseCake taking in a chef and a sink and instructing the chef to wash his hands, but perhaps I'm jumping ahead in your story. Anyway, I think I would rather see an initial refactoring look more like this:

public makeBase(Ingredients… ingredients) {
    chef.washHandsIn(sink);
    bowl.add(ingredients);
    chef.mixIngredientsOf(bowl);
    cake.addContents(bowl);
}

I'm not claiming this is perfect, but would be more in-line with a first phase refactoring:

1. Washing hands is a behaviour between the chef and sink. The details of which should not be exposed to the cheesecake.

2. The ingredients getting added to a bowl pushes the loop as a single operation into a single method.

3. Might as well move the construction of all the objects but allow them to be injected.

]]>