I'm leading a small subproject in my company, and I've never lead any project before in my career and this miniproject according to my manager is supposed to be an exercise on leadership.
I did a task breakdown and assigned them. One of these tasks was of the form
Develop a function/API with signature
Output functionName(Input1,Input2), the function should perform TaskX
Where TaskX was described pretty much in detail. It was pretty clear and direct and also quite self contained.
I got delivered however quite a big class where the requested API was essentially a member function of a class, the class had also data members that are not really useful for sake of the function itself (for example it has a completely useless viewer for sake of the function). I did the code review and I was trying to explain how I would've done it, including code snippets (which were like 20/30 lines of code) this also included the body of the function.
For some reason, not quite clear to me, I keep getting delivered a big class whose feature and implementation I don't think are entirely correct, but that's not the point. The point is that if I wanted to use that member function I had to instantiate quite a big object which doesn't make much sense.
So to me the goal of the task hasn't be achieved, and I've tried to talk through exactly what I want and why but somehow I still keep getting resistance. Also bear in mind given how short the function was I was expecting this to be done in at most three days (and this was an over-estimate since the function at the end was really short in terms of code) but it's been two weeks now. The reason for taking this long it's because together with the actual meat of the task I'm getting a whole class, as described, and a few scripts and a IDE project which I honestly don't need. The only thing I would physically need is one or two source files.
I've already talked about this to my line manager and essentially the only thing I got out of this conversation was that the engineer I'm currently working with has the tendency to overdo things. So my question here is what's the best way to deal with this situation in the future?
The only thing I personally thought was to sit next to him and try to walk him through the tasks I assigned to him, but often these conversations drift off to stuff not strictly related to the task (this is probably because I'm too available in giving explanations and this is doing more harm than good).
(Note: The project is very small it's like three engineers involved, including myself).
Update : So despite my code review I was provided again with bloated code. So the technique I have adopted to sort this out was kind of a mixture of a couple of answers I got from here.
First of all I explicity asked why I was given so much code given the task. I was given reasons (whether or not I agreed or not it doesn't really matter) but at the end we clarified what was necessary for the task, so at the end I got the 20 lines I thought were necessary. So this sorted out the current task.
As an exercise for him however I've assigned to give me some form of design/pseudocode whose implementation would allow to achieve goal the next task. Therefore we had a meeting where we discussed this. The discussion some times tended to drift off to other details (useful to understand but not important from coding point of view), I think this time however I managed to stay on track most of the time. At the end of this meeting I asked the explicit question "how many lines of code do you think you need to implement this?" he explained to me what he had to do in is opinion and this time sounded about right, I've also emphasized many times the minimal code required and I think I was understood this time.