Roles of Variables Home Page
U. Nikula, J. Sajaniemi, M. Tedre, S. Wray (2007)
Python and Roles of Variables in Introductory Programming: Experiences from Three Educational Institutions
Journal of Information Technology Education, 6, 199-214.
Students often find that learning to program is hard. Introductory programming courses have high drop-out rates and students do not learn to program well. This paper presents experiences from three educational institutions where introductory programming courses were improved by adopting Python as the first programming language and roles of variables as an aid in understanding program behavior. As a result of these changes, students were able to write working code from the very beginning, they found programming easy and interesting, they passed exams with good grades, and drop-out rates were low. Students became interested in programming and some of them even changed their personal study plan to include more of programming and computer science.
The high abstraction level and complexity of the concepts to be learned in current elementary programming courses is a serious impediment to students. Python is a simple but powerful programming language that supports both procedural and object-oriented programming. It makes short programs straightforward to write while at the same time facilitating rapid development of powerful applications. Python has been found to make programming more fun and thus attract students. Some of the common arguments against Python include concerns about using an interpreted language, the different syntax from C++ and Java, the use of whitespace to represent code blocks, and the lack of static type checking. However, these concerns have not caused any significant problems in practice, though it may take some effort to adapt to the syntax of other languages.
Roles of variables are stereotyped patterns of usage of a variable. For example, in the role of a stepper, a variable is assigned a succession of values that is predictable and usually known in advance as soon as the succession starts. Roles provide students with programming knowledge in a compact form, which they can then apply in authoring and understanding programs independently of the programming language used. In a classroom experiment, explicit teaching of roles has been found to result in better programming skills.
This paper also discusses the applicability of the roles to Python and notes some changes in the interpretation of individual roles required by some peculiarities of Python. In general, roles apply to Python well. However, the lack of constants in Python calls for a new role, and the use of lists in for-loops suggests a new interpretation for the stepper role. Finally, the difference between the two data structure roles, organizer and container, is smaller in Python than in other languages making their separation needless.Available at http://jite.org/documents/Vol6/JITEv6p199-214Nikula269.pdf
Back to the literature page
Last updated: May 7, 2007