David's organization didn't fully understand why you bring interns into a company. The purpose of an internship is to provide an educational opportunity and resume line-item to someone looking to enter the industry, and possibly recruit said intern after they graduate, getting a new-hire that is more ready for your team than average. It's good for the intern, it's good for the overall health of the industry, it's good for the company building its network of professional relationships and recruiting opportunities.

The purpose of an internship is not to just throw tickets at an intern, and let them commit code to your main branch, unsupervised. Unfortunately for David, and for the poor interns that preceded him, that is what the company had done.

foreach (BusinessObject unit in listA)
{
	listB.Add(unit.STRUCTURAL_UNIT);
}

foreach (int objectId in listB)
{
	foreach (BusinessObject object in listA)
	{
		if (object.objectId == objectId)
			listC.Add(object);
	}
}

foreach (BusinessObject object in listC)
{
	BusinessObject objectTemp = new BusinessObject();
	objectTemp.objectId = object.objectId;
	objectTemp.description = object.description + " (" + object.objectId.ToString() + ")";
	listD.Add(objectTemp);
}

So we have a helpfully named listA of business objects. We take their structural unit and add it into a similarly helpfully named listB, this time of integers. Then, for every integer in listB, we compare it to every entry in listA, and if the object ID of the object in listA matches one of the IDs in listB- a list *generated from the entries in listA- we put it in listC.

Then we iterate over listC, construct an entirely new business object, update its description with its object ID, and put it in listD. Only the gods know what happens to listD.

The end result of this block, though, is a list of business objects where their ID and their description have been specifically initialized, based on another list of business objects, and somehow this has turned into an O(n^2) operation. Maybe this intern was smarter than we think, and was intentionally building a speed-up loop, but more likely someone without experience was thrown in to a problem over their head and given no guidance or supervision, and this was the result.

Interns are there to learn. Trying to get free (or cheap) labor out of an intern is just going to cost you a lot more in the long run.

[Advertisement] ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.