Demographics in Programming Teams in Early CS Courses I frequently teach CS1 and CS1-and-a-half in a very diverse, working-class,  commuter public sector college. I have my students to work in small groups (2 or 3) on their larger homework programming projects. The students rarely know each other from outside class, and I take it upon myself to assign them to the groups. With the best of intentions and considerable misgivings I use demographics and to-date academic performance to construct the teams: same gender, different ethnic background, similar academic performance. This seems to "work" but maybe that sense is merely expectation-fullfillment.

Do others use these criteria, or opposite ones? I'm curious to learn of others' experiences and possibly perspectives I haven't considered.
I avoid using protected characteristics for any kind of group/class allocation. Personally, I apply a similar approach that I use in experimental research: the randomized block design. Typically, I use levels of prior relevant experience, either self-reported by the students at their point of admission or their grade for their pre-requisite class, as the blocks.