There is another way to approach this sort of problem, but it requires that you have the authority or power to modify the basic structure of the course.
I actually prefer to structure a course in such a way that this sort of problem can't arise. To do this requires that you encourage or even require students to work together, either in pairs or in larger teams. Work is submitted by the team. A naive approach to this won't work, of course.
A weaker proposal is to let students help one another pretty freely, but require that all collaborators be named in any submission. A subtle form of this is to let students collaborate, but not share code. However, you need a strong and well written Code of Conduct for this to work.
The issue, as I implied in my earlier answer to this question, is that learning must take place. Some problems given to students have a crux point and seeing it allows the student to have an A Ha moment that can be very powerful. The Dutch National Flag exercise has such a crux with a key insight that can broaden the education of any student. It is a shame to deny this moment to any student, which is one of the reasons we often require our students to work alone. However, if the student doesn't arrive at the denouement in a timely manner her/his learning may be slowed. And students often panic in the face of deadlines.
When I was much younger and teaching mathematics, I really believed that students should work strictly alone so that they could have such insights. I believed that, even though, at that time it was becoming increasingly common for working mathematicians to work in groups rather than alone. In fact, one of the reasons that I left math for CS is that I was teaching at a place at which there was no opportunity for local collaboration and the synergy it brings. This was before the internet of course (but we had left stone tools behind, thankfully).
There is a dilemma here, of course. We want each student to learn. We need to permit them to advance. Insight is good and aids this. Getting "stuck" inhibits it. In my view the way to cut the Gordian Knot here is:
Teach in such a way that there are more opportunities for a ha moments.
If there are many many opportunities, then the fact that student A helps B get through the crux on one such doesn't deny B the opportunity on the next one. There is evidence in the Pair Programming community (Agile Addicts) that pairing aids synergy, and doesn't leave anyone behind. Different people can contribute different things at different times and all advance.
Some additional points:
First, teamwork is a valuable, even required, skill for most employment. It doesn't come naturally to many any more or less than programming in a functional style (for example) does. It can be taught and needs to be practiced.
Also, knowing who the collaborators are, by design, lets you assign marks fairly. But you should arrange it so that people don't always work with the same partners. Students then learn less about teamwork and you have a harder time knowing who is shining and who needs a bit more polishing.
If you do this sort of thing, it is also useful, perhaps required, that you let the students give some sort of evaluation of their team-mates. Students are reluctant to do this of course, but it can be arranged if you make it positive for them. If you ask "How did your buddy do?" you are likely to not get useful information. However you can do the following:
If students are paired have them fill out an evaluation with two questions
* What was your partners chief contribution?
* What was your own chief contribution?
Make this a part of every paired assignment. If you have a student who answers "nothing" to the first question you learn something. If you have a student who always answers this way you learn something else. Both likely require a response from you.
In larger groups, have each student fill out a questionnaire at the end with questions like, supposing a group of five, for example,
* Who were the three most valuable members of your team, possibly including yourself?
* What was the main contribution of each of the people named above?
* What was your own main contribution.
Make sure the students know about this, including the questions themselves, before the first group assignment.
If you allow collaboration, as in my "weaker" proposal at the top of this, you can also have collaborators fill out such an evaluation and submit it with the work. It doesn't add much to your work, as such submissions are usually short, but it does give you a better picture of individual progress.
An anecdote is instructive. I once had a group of students in a class and one of them seemed to be slacking. He didn't contribute much to discussions and didn't have great responses. However, on a fairly large project, he was the one named by every other member as the key to getting the work done. Since their work was done outside my view, I'd have missed this entirely. He got a big boost, of course, as he had earned it.