Comparative Analysis of Student Struggle in Python vs. C++ for Small Coding Exercises

Slide Note
Embed
Share

An analysis conducted by Nabeel Alzahrani, Frank Vahid, Alex Edgcomb, Kevin Nguyen, and Roman Lysecky compared student struggles in Python and C++ for small coding exercises in introductory programming courses. The study explored the ease of learning Python compared to C++ and the demand for Python among non-majors. The research highlighted the similarities between C++ and Python in widely-used zyBooks and presented various coding challenge activities and submissions for comparison.


Uploaded on Aug 30, 2024 | 2 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Python Versus C++: An Analysis of Student Struggle on Small Python Versus C++: An Analysis of Student Struggle on Small Coding Exercises in Introductory Programming Courses Coding Exercises in Introductory Programming Courses Nabeel Alzahrani1, Frank Vahid1,3, Alex Edgcomb1,3, Kevin Nguyen1and Roman Lysecky2,3 1 Computer Science and Engineering, University of California, Riverside 2 Electrical and Computer Engineering, University of Arizona 3 zyBooks, Los Gatos, California nalza001@ucr.edu, vahid@cs.ucr.edu, aedgcomb@cs.ucr.edu, knguy092@ucr.edu, rlysecky@ece.arizona.edu Frank Vahid, UC Riverside, 2018 1

  2. CS 1 Before After C++ for majors + non-majors CS1 at 67 univ. Considering Python option for non-majors Easier to learn / less struggle? Demand Frank Vahid, UC Riverside, 2018 2

  3. Similar C++ and Python zyBooks, widely-used Frank Vahid, UC Riverside, 2018 3

  4. C++ Python Frank Vahid, UC Riverside, 2018 4

  5. Coding challenge activities (CAs) -- Homework Frank Vahid, UC Riverside, 2018 5

  6. Coding Challenge Activities -- CA (Homework) Frank Vahid, UC Riverside, 2018 6

  7. Frank Vahid, UC Riverside, 2018 7

  8. Raw anonymized submissions for each CA Time of submission User # Answer correct No Submitted solution 3/10/2017 1:20:44 PM 0255 while (userNum != 1){ cout << userNum << " "; userNum = userNum / 2; } ... 3/10/2017 1:24:51 PM 0255 0255 No No ... while (userNum !=0){ while (userNum != 1){ cout << userNum << " "; userNum = userNum / 2; } } cout << userNum << " "; ... 3/10/2017 1:30:18 PM 0255 0255 No Yes ... while (userNum >= 1){ cout << userNum << " "; userNum = userNum / 2; } Frank Vahid, UC Riverside, 2018 8

  9. Considered 11 ~identical CAs in C++ & Python CA # CA title Ch # Chapter Title Tree Height 2 Vars / Assgnmt 1 Basic while loop expression 4 Loops 2 Simon says 4 Loops 3 Vector iteration: Sum excess 5 Arrays / Vectors 4 Function call in expression 6 User-Def Fcts 5 Function errors: Copying one function to create another Function with loop: Shampoo. 6 User-Def Fcts 6 6 User-Def Fcts 7 Constructor overloading 7 Objs & Classes 8 Basic inheritance 10 Inheritance 9 Derived class membr override 10 Inheritance 10 Recursive function: Writing the base case 12 Recursion 11 Frank Vahid, UC Riverside, 2018 9

  10. Obtained anonymized submissions for 21 similar schools School pair Total # students in C++ Total # students in Python 1 (Research universities) 153 105 2 (Community colleges) 13 33 3 (Teaching universities) 34 23 4 (Research universities) 277 176 5 (Same community college) 21 29 6 (Teaching universities) 48 35 7 (Research universities) 121 92 8 (Community colleges) 14 165 9 (Community colleges) 15 17 10 (Research universities) 167 195 11 (Teaching universities) 194 N/A Total number of students 1057 870 Frank Vahid, UC Riverside, 2018 10

  11. Analyzed submissions for struggle rate Struggling student = ((time > 5 min.) AND (# attempts > 3) AND (time > (2 * Baseline time)) AND (# attempts > (2 * Baseline attempts))) OR (time > 15 min.) Struggle rate = # struggling students / # students In other words: Excessive time or # of submissions Frank Vahid, UC Riverside, 2018 11

  12. RESULTS RESULTS: C++ vs. Python struggle rate (21 schools, 1,927 students) Frank Vahid, UC Riverside, 2018 12

  13. No computing prerequisites Majors Non-Majors Frank Vahid, UC Riverside, 2018 13

  14. Manually examined mistakes causing struggle Simple geometry can compute the height of an object from the object's shadow length and shadow angle using the formula: tan(angleElevation) = treeHeight / shadowLength. 1. Using simple algebra, rearrange that equation to solve for treeHeight. 2. Write a statement to assign treeHeight with the height calculated from an expression using angleElevation and shadowLength. CA C++ Python Struggle % = 5 Struggle % = 9 1 treeHeight = tan(angleElevation) * shadowLength; tree_height = math.tan(angle_elev) * shadow_len Not knowing how to convert a math equation Using / instead of * Missing tan() for the angleElevation variable Mistyping variable names Not knowing how to convert a math equation Using tan() instead of math.tan() Using / instead of * Missing tan() for the angleElevation variable Mistyping variable names Wrong assignment (using two = symbols, assign to the wrong variable, reverse assignment, etc.) Frank Vahid, UC Riverside, 2018 14

  15. CA C++ Python 7 Struggle % = 27 Struggle % = 44 void PrintShampooInstructions( int numCycles) { if (numCycles < 1) { cout << "Too few." << endl; } else if (numCycles > 4) { cout << "Too many." << endl; } else { for (int N = 1; N <= numCycles; N++){ cout << N << ": Lather and rinse." << endl; } cout << "Done." << endl; } } def shampoo_instructions(num_cycles): if num_cycles < 1: print('Too few.') elif num_cycles > 4: print('Too many.') else: for N in range(1,num_cycles+1): print(N, ': Lather and rinse.') print('Done.') Missing for-loop Missing for-loop counter inside for-loop Wrong for-loop counter initial value Wrong for-loop condition Wrong for-loop location Wrong cout() argument inside for-loop Missing for-loop Wrong while-loop update (when using while-loop) Wrong for-loop condition Wrong print() argument inside for-loop Missing with for-loop condition variable inside for-loop Wrong for-loop location Frank Vahid, UC Riverside, 2018 15

  16. Results from manual examination Basic logic errors cause most struggle Similar errors in C++ and Python Just more common by Python students Frank Vahid, UC Riverside, 2018 16

  17. Conclusions Analyzed struggle for 11 same Python & C++ zyBook short coding activities across ~20 schools (~1,000 students each, at similar schools) Python struggle rate not lower; actually ~2x higher Most mistakes due to logic errors But Other reasons for switching to Python Just one of many possible analyses Student/teacher populations might differ May help CS 1 teachers decide if should switch, or influence how taught Frank Vahid, UC Riverside, 2018 17

Related