2

Whenever I do temporary fix I want it to really be temporary. However, there is no way to come back to it later, as the fix might be a part of a bigger issue.

Let's imagine that we have for some reason incomplete data in DB. When we fetch it, we get an exception.

Temporary fix would be something like: if I didn't receive that data I will substitute it with default value.

I would like to remove that fix after the first problem is fixed (missing data). But I might not be the one that will work on that bug and the other person might not be aware of that temporary fix. Maybe this is silly, but I think that we should have some way of tracking that fix and be aware of it.

Do you know any methodology, good practices or anything that is battle tested?

3
  • Could it be as simple as adding a task to the backlog? Commented Apr 19, 2021 at 8:40
  • Damn, that was quick. But what that task should include? Class name? Line of code? Explain what was the fix? Commit id? What if the main issue is not defined or we simply don't know that there is a bigger issue. In that scenario: we don't know that data in DB is corrupted. Commented Apr 19, 2021 at 8:45
  • @RandomGuy: There is no rule that tells you how you must describe a problem and how it (allegedly) will be understood by any and all future readers. Some issues require little explanation, others require a great amount of detail. This is way too contextual to answer. (That being said, I do think your original question is meaningful, just not the questions in comment). Commented Apr 19, 2021 at 9:21

3 Answers 3

4

Code comment
Some people write a //TODO: or //FIXME: comment in their code.
The good thing: The documentation is right in the code. So if someone reads the code he/she gets the information that its just a workaround.
The bad thing: The information is only in the code and is not represented in the Backlog-Items, therefor its likely that they get forgotten. Also it may clutter the code with comments AND its quite sure that sometimes even after an issue was solved, not all comments gets cleaned up.

Backlog Item Some people add it as a backlog item in their projekt backlog.
The good thing: Its now part of the backlog, like a regular feature request. That allows for good tracking and planning.
The bad thing: Its not in the code, therefore developer will add work based on the workaround without realizing that they build on instabil underground.

Talking to people Just inform the colleagues about that workaround in the next Meeting The good thing: It allows for questions and everybody is (at least for some time) aware of it.
The bad thing: After some time the knowledge about the workaround evaporates. Also if the amount of people which has to be informed is quite big, than this active communication is cumbersome.

Project priorities are key
In all cases, even if you combine those approaches, the whole thing lives or dies with how such workarounds are treated in a project. If it is allowed that workarounds may live for 2-3 months, then its very likely that they will never be touched at all.
If a project adds a workaround, but then treats the reafactoring as a priorized task (with a higher priority than nearly all feature requests), then the documentation is less important, because a workaround will only live a very short live. And in that short livespan all developers are aware of that ugly thing.

Documentation type In my experience its nearly impossible to create a "template" for such documentation. I would try to explain the problem. Mention the code parts that are relevant (combination out of reference to the real code and copied code examples, so that its visible if anything has changed). Explain your thoughts why you choose this workaround. And your thoughts how you would have liked to implement it correclty.

2
  • For the comment section, note that some tools have automated ticket creation rules, and specific comments can be one of those rules (we set it up in Jira on an old project I worked on). So any // TODO comment (on master) would become a ticket on the backlog with a default deadline. Not everyone likes this approach (from experience) but it is a valid option. Commented Apr 19, 2021 at 9:10
  • 1
    You can also add a unit test that keeps track of the issue and reminds you. Most test frameworks offer an option to highlight a passed test in some way, so you don't need to add a failing test for this. This also has the advantage that you have a candidate to produce a proper fix. Commented Apr 19, 2021 at 11:36
4

"Temporary" implies that the existence of this implementation has a deadline (even if you don't know the precise end today). If there was no end expected, it wouldn't be a temporary change. Therefore, you use the same tool that you use for your planned work: your sprints and/or backlog.

Changing an implementation is a planned task just as much as creating an implementation is. Sometimes the creation of the task implies you could start on it immediately, but in this case you simply create the task so that you can start on it in the future. Some tools specifically allow a start date to be added to tasks for this very purpose.

Unscheduled backlog tasks are often tasks that have been deferred for a particular reason. Unless that reason is easy to enshrine in the task description or globally understood, this means that someone has to periodically check if the criteria for starting the task have been met by now.
This is ideal for your fix. Once in a while, people can check if the missing data is still an issue, and if it isn't, put the task on the next sprint planning.

If the act of checking was less than trivial, you could write a specific integration test for this, comment it out, and in the backlog task itself refer to that test with the instruction that when that test passes/fails, that means that this task can be started. Obviously, deleting that test then also becomes part of the task's execution.


For much more informally planned tasks (e.g. homebrew projects or non-developer-controlled sprint planning), a comment can help a lot too, though it's less ideal for formal tasks that need to be coordinated with a team/PM/PO.

// TODO comments get treated differently by Visual Studio, they are added to the Task List view automatically. If your IDE doesn't do that, you can still just do a Find All (commonly Ctrl+Shift+F) on "// TODO" to quickly list them anyway (and then you can even pick your own keywords, e.g. I use // TEMPFIX or // REFACTOR in my personal projects.

When working in team, if a specific developer is expected to handle this and other developers don't need to pick it up, add the name. I often do this when I write a quick and dirty implementation to get a proof of concept, add some // TODO MYNAME comments, and before I merge my branch back to master, make sure all those pending comments have been addressed.

Just like checking in on the backlog, developers should regularly check in on these comments specifically marked as TODO. Not that they drop what they're doing and immediately fix all of them, but someone should keep active tabs on which ones can be addressed at some point and pick them up at an appropriate time, so that it doesn't decay into a codebase riddled with technical debt.

3

Add a backlog item in the issue tracker and add a code comment in the appropriate place to explain the issue and refer to the issue ID.

  // Temporary fix until the foobar is fluxumated, see issue #467291

Why both? Because if someone in the future is refactoring the code, they should be made aware of the issue by reading the comment. But if nobody refactors the code for other reasons, the issue should be in the tracker so you fix it eventually.

1
  • If issue is just more complex you move all that dependency (parent-child) to the backlog of project? In my scenario I create a task to remove that fix after data issue is resolved? So I have a bug - 'Data in table x is missing' and add task to it - 'remove that temp fix'. If later someone finds out that the data is just a result of some service we create parent of that bug and so on? (I imagine that the system is huge and 1 person is not responsible for every part of it, so you need a backlog to communicate between teams) Commented Apr 20, 2021 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.