This research project consists of two related studies involving first-and second-year university students learning to write recursive programs. The first employed a micro-structure analysis that examined the psyche-social processes underlying peer-based interactions in two different computer-based collaborative learning environments: face-to-face vs. distributed context. These processes may be viewed as knowledge building activities that occur in three key collaborative situations: communication, negotiation, and consolidation. Results of this study demonstrated the two collaborative learning environments produced two distinct psyche-social behaviors manifested by the students. In the second study, 130 students were divided into four groups, three participated in collaborative learning environments; the fourth made up a control group whose members learned in isolation from one another. All the students learned to write recursive programs for designing geometric patterns. Although results indicated the four groups of students did not show significant differences in their program evaluation and completion abilities, students who had participated in three collaborative learning environments demonstrated superior program generation abilities on the posttest compared to those who had learned to solve problems individually.