Senior developers reframe a complex problem, juniors run into it heads-on
You are assigned the following story:
As a helpdesk manager,I want the system to automatically assign incoming tickets to available agents in a round-robin manner,so that tickets are distributed evenly and handled efficiently.
That sounds like a pretty simple task, right? Now, let’s get to implementing this. A junior developer will read this story and realize that you need to know who the available agents are and who the last assigned agent was.
Then you realize that you also need to handle more complex scenarios:
- What if you have a lot of available agents?
- What if we have two concurrent tickets at the same time?
- Where do you keep the last assigned agent?
- What if an agent goes unavailable and then becomes available again?
- How do you handle a lot of load on the system?
- What happens if we need to assign a ticket in a distributed manner?
There are answers to each one of those, mind you. It is just that it turns out that round-robin distribution is actually really hard if you want to do that properly.
A junior developer will try to implement the story as written, maybe they know enough to recognize the challenges listed above. If they are good, they will also be able to solve those issues.
A senior developer, in my eyes, would write the following instead:
from Agents
where State = 'Available'
order by random()
limit 1
In other words, instead of trying to do “proper” round-robin distribution, with all its attendant challenges, we can achieve pretty much the same thing with far less hassle.
The key difference here is that you need to challenge the requirements, because by changing what you need to do, you can greatly simplify your problem. You end up with a great solution that meets all the users’ requirements (in contrast to what was written in the user story) and introduces almost no complexity.
A good way to do this, by the way, is to reject the story outright and talk to its owner. “You say round-robin here, can I do that randomly? It ends up being the same in the end.”
There may be a reason that mandates the round-robin nature, but if there is such a reason, I can absolutely guarantee that there are additional constraints here that are not expressed in the round-robin description.
That aspect, challenging the problem itself, is a key part of what makes a senior developer more productive. Not just understanding the problem space, but reframing it to make it easier to solve while delivering the same end result.
Comments
Comment preview
Join the conversation...