Skip to main content

Can you find the 3 smells in "I added a Refactoring Story for the next Cleanup Sprint?"

February 7, 2017
“I added a Refactoring Story for the next Cleanup Sprint”


This is an interesting statement. Let's see how often the alarm bell rang in your head. I mean how many smells you can find in that statement...

Before you scroll down to read my answers, please count to 10 and try to find 3 issues.

 

Thinking hard by gratisography.com 

 

“I added a Refactoring Story for the next Cleanup Sprint”


What would you say?

 

 

Let's see:

 

 

1. "I"


Really? You added a new story to the backlog? Did you talk to the Product Owner about it? Is it important to him? What are his responsibilities within your team? What is he accountable for? What are your responsibilities within the team? What are you accountable for?

 

 

2. "Refactoring as a Story"


First of all, the Scrum Guide (the official source for Scrum) says nothing about "User Stories". In the Scrum Guide, Jeff and Ken talk about Product Backlog Items. Everything that adds Value in the Product should go on to the Product Backlog as a Product Backlog Item. Why is the activity of refactoring a story? Should it be a task then? Does it matter to create a task for refactoring? Should you even track it somehow? What are reasons to manage 'refactoring' work? What are your skills as a developer in your team?

 

 

3. Is "Refactoring" something of value to your stakeholders?


Does the Product Owner care about Refactoring the Product? Should he? What is the responsibility of a Developer? Is "refactoring" something that just happens as described in the Boy Scout rule? Should "refactoring" just be part of your professional way of working? In another blog post, I described the Hotel Room rule and why it doesn't work.

 

 

4. A "Cleanup Sprint"?


What is a "Cleanup Sprint"? Does that mean you don't deliver anything of value in that "Cleanup Sprint"? You just do house cleaning that you haven't done before? When is your house clean enough? When do you stop cleaning? You don't know? Doesn't look very professional to me.

 

 

5. "Next"


Are you saying you already had a Cleanup Sprint?

 

 

6. "Next Cleanup Sprint"


You manage single Sprints? Are you sure? Are you adding stuff to single Sprints or to the Product Backlog? How come you put it into a Sprint and not the Product Owner who is prioritizing Backlog items?

 

 

7. Is Refactoring a Story?


What is Refactoring again?

 

 

Refactoring is the activity of changing the inner design without changing the outer behavior of the system.


What are User Stories all about?

 

 

A User Story is a placeholder for a conversation about a User need, which is about outer behavior.


So having "Refactoring User Stories" doesn't make sense. In order to be transparent about them talk to the Product Owner about them and how you visualize those.

 

 




 

 

 

It's your job


There are quite a couple of issues we can find in that sentence. In my eyes, it is important to highlight that refactoring is your job. It is your professional behavior. You as a professional developer build quality into the product from day 1. Refactoring is part of making sure you build the right quality. If you as a team don't do it continuously, we get in trouble soon. Building quality is something that happens all the time and the development team is accountable for a high-quality product.

 

 

What should we do in this situation?


The good thing about this statement is that someone recognized a problem with code quality and wants to fix it. The thing to improve here is the behavior around it. I would start with asking the above questions. Give feedback about what you think from your perspective and ask "How did we end up in this situation?". Check whether the process, team or surrounding organization drive this behavior.

 

 

What can we change or improve to make things better in the future?


Are there more smells in that statement?
What is your approach in dealing with this situation?
Tweet a little tweet 
@peitor or leave a comment down below.

 

 

 

 

 

 

 


What did you think about this post?

Comments (18)


gazza8
07:30 pm February 9, 2017

To sum up, does it mean that 'Refactoring' should only be a (technical) task inside a story?


Garrett Baker
01:15 am February 10, 2017

My short answer: probably.

My long answer: The rule I use with my team for a new feature: if a change needed to fulfill a story requires a refactor, and that refactor needs it's own review (code, PO, UX, or otherwise) make it a task.

The article implies that this refactor may have been noticed after the fact. That's a problem of another stripe! As noted in the article, this means quality hasn't been built into the product as it should have been. In this case, a technical task isn't the answer; a discussion is.


Peter Gfader
04:57 pm February 10, 2017

Yes.
Refactoring is an activity to keep the inner quality high.
We as development team want to keep the quality high in order to be able to continuously deliver features, (that hopefully have an impact on someones life).


Peter Gfader
05:05 pm February 10, 2017

Great point about the "discussion".

As we know, "Transparency" is the foundation for Scrum Inspection and Adaption. That means that the development team should make this transparent and visible, by raising it, tracking it and discussing it.

Regarding "noticing after the fact", there are 2 things that pop in my head:
1. The development needs *courage* to bring this up. A great Scrum Master will create the safe environment where this is possible
2. The development team will constantly *learn* about technologies, practices, tools and the domain they are in, so they *might* also learn better ways how to do things.


Krystian Kaczor
07:06 pm February 10, 2017

Refactoring should be embedded in the Definition of Done. It's a good practice like TDD or CI. Doesn't a task for it. It's done within the work.


Peter Gfader
06:15 am February 13, 2017

RE: Refactoring in Definition of Done.
How would you measure "Refactoring is done?".
Is improving the inner design ever done/finished?

In my experience it works better to ensure basic code hygiene by code reviews and pair programming and tooling.
Another thing that came to my mind is that the team needs to see the value of doing this.


Krystian Kaczor
07:14 am February 13, 2017

I don't measure. Surely you can get sucked into perfection loop. :) I say "When we say PBI is done, we say we also have done refactoring if it was necessarily". Practices can not be really measured, can they?


Peter Gfader
07:53 am February 13, 2017

>> Practices can not be really measured, can they?
That's the reason for not putting it on the Definition on Done :-) #evilGrin


Krystian Kaczor
08:27 am February 13, 2017

That's they way we teach at PSM classes.
Where do you put it? It takes time. It should be transparent. Every PBI can have it. Same goes for TDD, CI, Code Review, Pair Programming.


Peter Gfader
09:53 am February 13, 2017

>> Where do you put it?
What do you refer to by "it"?


Krystian Kaczor
10:09 am February 13, 2017

Where do you put refactoring?


Peter Gfader
10:33 am February 13, 2017

Refactoring is a continuous activity of the development team.

They need to ensure that they can build a useable increment every Sprint. If they are not able to because of quality, then potentially "refactoring" and code hygiene has been forgotten.

And... Yes, for larger refactorings I suggest to make that visible via technical tasks and discussions within the team.


Krystian Kaczor
11:51 am February 13, 2017

So in case of smaller refactoring, where do you put it? :)
Something like the Boy Scout Rule? I put it in DoD.


Peter Gfader
03:25 pm February 13, 2017

I tend to make the Definition of Done measurable (S.M.A.R.T.) which the "Follow the Boy Scout Rule" isn't.

Can you share your DoD in your current project?


enginpost
05:28 pm June 29, 2020

In some PBI (Story) patterns you can slice stories along acceptance criteria, to maintain a reasonable size in order to deliver a potentially releasable element of value. I would imagine most teams spend their time writing user-center function-experience PBIs, I know that a number of forums post here feels that generalized non-functional requirements should be added to the Definition of Done (like performance or targeting certain browsers, etc.) as opposed to being stories. Some refactoring can be done directly in a story. But sometimes you hit scenarios of production dependency that reveal the need for refactoring. Would you treat that like a defect? For example, we automate a test for performance in the initial story and perform some kind of load testing. Then later another PBI makes it to production and somehow added a lot of records via the other story had an unpredicted outcome of slowing down a screen load due to a long running calculation. Since the original PBI is closed, and the DoD need for performance has not changed, would it just be a defect who's solution is the act of refactoring?


Peter Gfader
08:02 pm June 29, 2020

I would say the Product overall is not in a Done state anymore.
What can we as a team do to:
* Fix it.
* Monitor this in the future
* Prevent it from happening again
* Share the learnings in the team and organisation


Thomas Maierhofer
07:07 am November 12, 2020

From my experience developers and even POs use the terms "Refactoring" or "Cleanup" in a vague way. This includes sometimes bug fixing and adoption to new purposes. Often it has a clear customer value or at least some business value behind. If such stories drop in, it should be clearified if we really talk about "refactoring" in a sense to improve code quality or if it is something else labeled as "refactoring" or "cleanup".


Peter Gfader
07:19 am November 12, 2020

Yes, I see it the same with unexperienced teams.
And yes, bug-fixing and refactoring are 2 very different activities.
Sometimes they happen at the same time :) and I think that's warning sign, because then the team is not aware enough.

"Refactorings should always maintain existing bugs", Arlo Belshee has a great talk about that on youtube.