Teaching Roles of Variables in Elementary Programming Courses
Context/background. To learn computer programming is difficult for many students. One reason is that programs deal with abstract entities - formal looping constructs, pointers going through arrays etc. - that have little in common with everyday issues. These entities concern both the programming language in general and the way programming language constructs are assembled to produce meaningful combinations of actions in individual programs.
One of the abstract entities dealt in programming is a variable. Variables are not used in programs in a random or ad-hoc way but there are several standard use patterns that occur over and over again. In programming textbooks, two patterns are typically described: the counter and the temporary. The role of a variable [3] captures this kind of behavior by characterizing the dynamic nature of a variable: the sequence of its successive values as related to other variables and external events. The way the value of a variable is used has no effect on the role.
The paper presents roles of variables as a new concept that can be used to assist in learning computer programming and gives detailed instructions on techniques to present roles to novices. These techniques are based on current learning theories and they have been used in a classroom experiment comparing traditional teaching with role-based teaching.
So, the approach of the paper is to introduce a new programming concept and use it in teaching novice programmers. This approach differs from the traditional ones: most studies report effects of new teaching methods and new ways of presenting teaching materials.
Theoretical framework. The paper is based on two theoretical frameworks: constructivism and roles of variables. According to constructivistic approach (e.g., [2, 6]) it is necessary that new knowledge is actively built on the top of existing knowledge. Constructivistic approach emphasizes that learning should be focused on understanding the essential, instead of mechanical learning by heart, and that the same issue can be interpreted and understood in different ways.
Roles of variables [3, 4] describe stereotypic usages of variables that occur in programs over and over again. Only eleven roles are needed to cover 99 % of all variables in novice-level programming, and they can be described in a compact and easily understandable way. Ben-Ari and Sajaniemi [1] have shown that in one hour's work, computer science educators can learn roles and assign them successfully in normal cases. The set of roles is so small that it can be covered in full during an introductory programming course.
Methodology. We have conducted a classroom experiment during an introductory Pascal programming course using teaching methods described in the paper. A more thorough description of the experiment and its results can be found elsewhere [5]; here we concentrate on how roles can be introduced to novices and why it should be done.
Findings. The results of the classroom experiment suggest that the introduction of roles provides students a new conceptual framework that enables them to mentally process program information in a way similar to that of good code comprehenders. The use of role-based animation seemed to assist in the adoption of role knowledge and expert-like programming skill. The changes in instruction when adding roles to traditional teaching were minimal. Based on the results we recommend the introduction of the roles in elementary programming courses.
Recommendations. While teaching, each role can be introduced when it is encountered for the first time in some example program during lectures. It is important that the introduction of a new role is built on the top of existing information and that the distinction between the roles is explained properly.
The presentation of a role should consist of its informal definition together with additional examples of its use. Moreover, the teacher may mention special cases covered by the exact definition of the role. It is essential that the distinctive features of the new role (as compared to the already known roles) are made clear. It is also important to explain how a specific variable expresses the role behavior since this is a meaningful new example of the role. Furthermore, to elaborate students' memory, role names must reappear repeatedly in new meaningful contexts.
Bibliography
[1] M. Ben-Ari and J. Sajaniemi. Roles of variables as seen by CS educators. SIGCSE Bulletin, 36(3):52-56, 2004. [2] C. Bereiter. Constructivism, socioculturalism and Popper's world. Educational Researcher, 23(7):21-23, 1994. [3] J. Sajaniemi. An empirical analysis of roles of variables in novice-level procedural programs. In Proceedings of IEEE 2002 Symposia on Human Centric Computing Languages and Environments (HCC'02), pages 37-39. IEEE Computer Society, 2002. [4] J. Sajaniemi. Roles of variables home page. http://www.cs.joensuu.fi/~saja/var_roles/. [5] J. Sajaniemi and M. Kuittinen. An experiment on using roles of variables in teaching introductory programming. Computer Science Education, 15(1):59-82, 2005. [6] E. von Glasersfeld. A constructivist approach to teaching. In P. Steffe and J. Gale, editors, Constructivism in Education, pages 3-15. Lawrence Erlbaum Associates, Hillsdale (NJ), 1995.
Author 1: Marja Kuittinen Marja.Kuittinen@cs.joensuu.fi
Author 2: Jorma Sajaniemi Jorma.Sajaniemi@cs.joensuu.fi
Article Link:
http://portal.acm.org/citation.cfm?id=1008014&coll=portal&dl=ACM&CFID=9122936&CFTOKEN=32438184
}}}
[https://stemedhub.org/groups/cleerhub/wiki/issue:1334 : Back to 2009 Spring/Summer Issue Vol. 4, No. 3]
[[Include(issues:footer)]]