Learning elementary programming can be enhanced by introducing the notion of variable roles to students. This paper presents a web-based automatic role detection service that can be utilized in teaching when consolidating role knowledge. The service is based on data flow analysis techniques and uses machine learning to create flow characteristics for roles. The current version recognizes roles with 93% accuracy which is comparable to that of human role assigners. Categories and Subject Descriptors K.3.2 [Computers and Education]: Computer and Information Science Education—computer science education; D.m [Software]: Miscellaneous; F.m [Theory of Computation]: Miscellaneous General Terms Human factors Keywords Roles of variables, automatic detection of roles, role knowledge consolidation