Automatically assessed exercises with immediate feedback can be a powerful tool for enhancing the effectiveness of education. In this article, we discuss the design and implementation of a collaborative learning tool called ViLLE. The design is based on experiences gathered from a previously developed and thoroughly researched visualization tool. Based on our earlier results and current educational theories, we developed four design principles upon which ViLLE is constructed. ViLLE includes various different exercise types which were designed to assist in the learning of computer science, mathematics and other subjects. It also supports different learning and teaching methods, such as pair programming and peer review. To justify the development of a new environment, we present four diverse case studies where ViLLE was utilized successfully: programming education, high school matriculation exam, elementary school mathematics and student counseling at university level. The results obtained from the studies seem to confirm that ViLLE can be used effectively to enhance student motivation and to improve student performance in various heterogeneous educational setups.