Understanding Object Oriented Programming: Utilizing Visualization Tools to Simplify the Transition from Python to Java A
Total Page:16
File Type:pdf, Size:1020Kb
UNDERSTANDING OBJECT ORIENTED PROGRAMMING: UTILIZING VISUALIZATION TOOLS TO SIMPLIFY THE TRANSITION FROM PYTHON TO JAVA A THESIS Presented to the University Honors Program California State University, Long Beach In Partial Fulfillment Of the Requirements for the University Honors Program Christian Blydt-Hansen Spring 2018 I, THE UNDERSIGNED MEMBER OF THE COMMITTEE, HAVE APPROVED THIS THESIS UNDERSTANDING OBJECT ORIENTED PROGRAMMING: UTILIZING VISUALIZATION TOOLS TO SIMPLIFY THE TRANSITION FROM PYTHON TO JAVA BY Christian Blydt-Hansen Alvaro Monge, Ph. D (Thesis Advisor) Computer Science California State University, Long Beach Spring 2018 ABSTRACT UNDERSTANDING OBJECT ORIENTED PROGRAMMING: UTILIZING VISUALIZATION TOOLS TO SIMPLIFY THE TRANSITION FROM PYTHON TO JAVA By Christian Blydt-Hansen Spring 2018 The purpose of this study is to create tools to help students transition between programming languages, specifically Python to Java. Two existing visualization tools, Python Tutor and Skulpt, were modified to work together to create a tool that helps students gain a deeper understanding of Object Oriented Programming. The degree to which students understand the Object Oriented aspects of Python is a good measure of how well they will be able to transition to Java. The modified tools let the user examine their program in depth and visualize how their programming environment changes as they step though their program line by line. A survey for California State University Long Beach Students has been created to evaluate how difficult transitioning from Python to Java was, and how well the concepts they learned in Python assisted them in learning Java. ACKNOWLEDGEMENTS I would like to acknowledge and thank the people that helped me and supported me throughout my thesis, and throughout my entire academic career. Firstly, I would like to thank my family for the continued support in pursuing my career in Computer Science, among many other things. I would also like to thank Dr. Alvaro Monge for the assistance and guidance that he provided to me as my advisor on this research. Finally, I would like to thank my friends who have grown with me throughout our time as computer science students. iii TABLE OF CONTENTS Page ACKNOWLEDGEMENTS........................................................................................................ iii LIST OF FIGURES..................................................................................................................... v CHAPTER 1. INTRODUCTION.......................................................................................................... 1 Tools to Transition Between Languages............................................................ 1 Python Tutor as a Tutoring Tool........................................................................ 2 Using Visualization Tools to Ease the Transition Between Languages............. 4 2. UTILIZING PYTHON TUTOR AND SKULPT........................................................... 6 Python Tutor....................................................................................................... 6 Stepping Tool..................................................................................................... 6 Stack Trace Visualization................................................................................... 8 Skulpt.................................................................................................................. 9 Python Tutor and Skulpt..................................................................................... 10 Modifying Python Tutor..................................................................................... 10 Integrating Skulpt into Python Tutor.................................................................. 12 For Loop Support................................................................................................ 14 Weakness............................................................................................................. 15 3. STUDENT SURVEY...................................................................................................... 16 4. CONCLUSION................................................................................................................ 18 APPENDIX.................................................................................................................................. 19 REFERENCES............................................................................................................................. 24 iv LIST OF FIGURES FIGURE Page 1. Stepping through Python code using Python Tutor....................................................... 7 2. Python Tutor stack trace visualization........................................................................... 8 3. Skulpt interactive editor................................................................................................. 9 4. Skulpt Turtle graphics.................................................................................................... 10 5. Modified Python Tutor execution trace......................................................................... 12 6. Python Tutor working with Skulpt................................................................................ 13 7. Using For Loops............................................................................................................ 15 v CHAPTER 1 INTRODUCTION Many students learning computer science at a high school and college level have trouble grasping certain topics. One topic that is difficult to grasp is the concept of Object Oriented Programming. Currently, at California State University Long Beach, students are having difficulties transitioning from Python to Java, and being able to fully understand Object Oriented Programming, methods, classes, and data structures. This challenging transition is the focus of this research. It is very common for undergraduate students to start off by learning Python as an introduction to computer science, then learn a more advanced language like Java. O'Brien (2014) talks about how this transition can be challenging for students who have never programmed in the new language. He compares the transition to an English speaker trying to learn Spanish. They are different languages, but you should try to utilize your knowledge of English to help you learn Spanish. Likewise, students should use their knowledge of Python to help them learn Java. Tools to Transition Between Languages One proposed solution to this difficult transition was to build a tutoring tool to help students by translating Python code into Java code (O’Brien, Goldman, & Miller, 2014). This tutoring tool would be in the form of an interactive website that gives students Python code and asks them to write the Java code equivalent. Their solution is then checked using JUnit testing, and students are given feedback based on the results. The process of creating sample questions 1 would be time consuming for instructors, so the tutoring tool would provide tests cases, as well as accept student written test cases to be used by all. While transitioning to Java to learn Object Oriented Programming can be difficult, Goldwasser and Letscher (2008) challenge that Python itself can be a useful way to teach Object Oriented Programming. They note that there is debate on whether students should be introduced to computer science by learning objects first, or by learning the basics in a simpler language. They agree that Object Oriented Programming is “central to modern software development and therefore integral to a computer science curriculum.” While Python is mainly viewed as a scripting language, they propose that Python is a fully object oriented language and can be used to teach object models and classes. While Goldwasser and Letscher teach their introductory courses in Python, they do so keeping in mind that students will need to transition to Java or C++ later. They believe that while transitioning, the Python concepts do not need to be forgotten, but instead built upon and slightly modified. They highlight the differences between Python, which is interpreted and dynamically typed, and Java which is compiled and statically typed. They also highlight to differences in syntax between the two languages, and use Python to help students understand instance variables. While the two languages differ in many ways, their teaching style helps to prepare students by teaching Java concepts to them while they are learning Python. Python Tutor as a Tutoring Tool The use of additional tools outside of the classroom may also greatly aid students in the transition from Python to Java. Philip J. Guo is the creator of Python Tutor, a web-based program visualization tool for Python and several other languages, including Java, JavaScript, TypeScript, and Ruby. In his paper (2013), he explains how his software helps students in 2 introductory level computer science courses gain a deeper understanding of Python by using visualization tools. From 2010-2013, over 200,000 people used Python Tutor when it was being used in many universities such as UC Berkley, MIT, the University of Washington, and the University of Waterloo for introductory computer science courses. Guo explains that the user can step through Python code while keeping track of the line of code being currently executed, step forwards and backwards through the execution, view stack frames and variables, view the contents of heap objects and pointers, view