usability of beginner oriented clojure error messages
play

Usability of beginner-oriented Clojure error messages Henry - PowerPoint PPT Presentation

Usability of beginner-oriented Clojure error messages Usability of beginner-oriented Clojure error messages Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova University of Minnesota, Morris 5th International Workshop on Trends


  1. Usability of beginner-oriented Clojure error messages Usability of beginner-oriented Clojure error messages Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova University of Minnesota, Morris 5th International Workshop on Trends in Functional Programming in Education, College Park, MD, June 7, 2016 Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  2. Usability of beginner-oriented Clojure error messages Table of contents 1 Overview 2 Modifying error messages 3 Usability study 4 Results 5 Conclusions and future work Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  3. Usability of beginner-oriented Clojure error messages Overview Clojure and goals of our project Clojure: A Lisp, runs on the JVM Data immutable; state is handled explicitly Support for concurrency Rich collection of data structures (lists, vectors, hashmaps, sets,...) Developed by Rich Hickey, released in 2007 Has a large community of users and developers A project at University of Minnesota, Morris (UMM) to make it possible to use Clojure as the first language for teaching beginner students. Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  4. Usability of beginner-oriented Clojure error messages Overview UMM course structure UMM current course structure: Introductory: Racket or Python Second programming course: Data Structures in Java Upper level classes use a variety of languages: Javascript (web development), C, Ruby (operating systems), R, Clojure (data processing). Seeing a functional language first is helpful (functional abstraction, higher-order functions). Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  5. Usability of beginner-oriented Clojure error messages Overview Clojure in introductory class Clojure is a promising language for an introductory class: Functional language Provides a large set of data structures (hashmaps, sets) Has a large community of developers and users: libraries, participation in open source projects, parallel data processing, etc. Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  6. Usability of beginner-oriented Clojure error messages Overview Challenges for using Clojure in introductory class Challenges: Beginner-friendly IDEs are still under development Syntax is very flexible, so errors are detected late. Example: (first ’()) returns nil , may cause null pointer exception later. Errors are Java exceptions, are phrased in terms of Java types: >(+ "hi") java.lang.ClassCastException: Cannot cast java.lang.String to java.lang.Number Our work: providing beginner-friendly error messages for Clojure. Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  7. Usability of beginner-oriented Clojure error messages Overview Our project To develop materials and setup that would make it possible to use Clojure in an introductory class. Modifying error messages Evaluating how well new error messages work: usability study comparing our error messages to standard ones and to Racket Future work: integrate our messages into an IDE Other work: graphical library that abstracts over state and objects; developing lecture notes Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  8. Usability of beginner-oriented Clojure error messages Overview Our project To develop materials and setup that would make it possible to use Clojure in an introductory class. Modifying error messages Evaluating how well new error messages work: usability study comparing our error messages to standard ones and to Racket Future work: integrate our messages into an IDE Other work: graphical library that abstracts over state and objects; developing lecture notes Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  9. Usability of beginner-oriented Clojure error messages Modifying error messages Clojure error messages: example Code: (+ 1 "hi") Standard Clojure error: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number clojure.lang.Numbers/add (Numbers.java line 128) clojure.lang.Numbers/add (Numbers.java line 3640) intro.test/eval8691 (test_standard.clj line 8) clojure.lang.Compiler/eval (Compiler.java line 6792) clojure.lang.Compiler/load (Compiler.java line 7237) clojure.lang.Compiler/loadFile (Compiler.java line 7175) clojure.lang.RT$3/invoke (RT.java line 319) intro.core/-main (core.clj line 19) ....>15 more stack trace lines.... Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  10. Usability of beginner-oriented Clojure error messages Modifying error messages Clojure error messages: example Our error message for the same code (+ 1 "hi") : Error: In function +, the second argument "hi" must be a number but is a string. Found in file C:\Users\E\Desktop\clojure-intro-class\src\intro\test.clj on, or before, line 8. corefns.corefns/+ (corefns.clj line 269) intro.test/eval8691 (test.clj line 11) intro.core/-main (core.clj line 20) Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  11. Usability of beginner-oriented Clojure error messages Modifying error messages Our approach Can’t just surround the program with try/catch: compilation errors and lazy sequences evaluation errors escape to REPL For now: load user’s code via eval , catch errors Two approaches: Overwrite core functions to add pre-conditions: + takes numbers, first takes a sequence, etc. Can print arguments that fail preconditions Catch error messages and transform them using regular expressions Filter stack trace Anecdotal evidence: this works well, catches most cases. Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  12. Usability of beginner-oriented Clojure error messages Usability study Usability study Usability study questions: 1 How do our error messages compare to standard Clojure messages? 2 How do they compare to Racket? 3 What works well, what needs improvement? Ideas for the study: Marceau et al 2011 Measuring effectiveness of Error Messages Designed for Novice Programmers , Mayer et al 2012 An empirical study of the influence of static type systems on the usability of undocumented software . Study is in progress, we are presenting preliminary results. Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  13. Usability of beginner-oriented Clojure error messages Usability study Usability study 16 program fragments with errors, each has a Racket and a Clojure version Divided into 4 levels by difficulty Each participant gets 2 Racket, 2 Clojure questions at each level Randomly assigned standard/modified Clojure error messages Overview of Racket, 8 Racket questions Overview of Clojure, 8 Clojure questions Screen capture while solving questions (21 minutes each set) A short interview at the end Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  14. Usability of beginner-oriented Clojure error messages Usability study Clojure and Racket: common elements For the study we picked a common subset of Racket and Clojure familiar to students: Numbers, booleans, lists Functions and variables definitions if, cond Structures (Racket), hashmaps (Clojure) Recursion Higher-order functions: map, filter, reduce/fold Anonymous functions Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  15. Usability of beginner-oriented Clojure error messages Usability study Clojure and Racket: differences Syntax differences in function definitions: (define (f x) (+ x 2)) ; Racket (defn f [x] (+ x 2)) ; Clojure Structures in Racket vs hashmaps in Clojure: ;; Structure in Racket (define-struct point (x y)) (define point1 (make-point 5 7)) (point-x point1) ;; Clojure hashmaps (def point1 {:x 5, :y 7}) (:x point1) fold vs reduce , nil handling, etc. Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  16. Usability of beginner-oriented Clojure error messages Usability study Clojure features not included Not included in the study: Strings Vectors, conj, into loop/recur Function literals, such as #(% + 2) Many higher-order functions Automated testing (in either language) Some code in our examples isn’t idiomatic. Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

  17. Usability of beginner-oriented Clojure error messages Usability study Racket testing environment Figure: Racket testing environment: DrRacket, intermediate w/lambda Henry Fellows, Thomas Hagen, Sean Stockholm, and Elena Machkasova Usability of beginner-oriented Clojure error messages

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend