It Will Never Work in Theory: Live!

Our next set of online lightning talks is happening April 25-26, 2023. Check out the speakers and get your ticket now!

Usability Implications of Requiring Parameters in Objects' Constructors

Reviewed by Greg Wilson / 2011-07-26
Keywords: Usability

Stylos2007 Jeffrey Stylos and Steven Clarke: "Usability Implications of Requiring Parameters in Objects' Constructors". 29th International Conference on Software Engineering (ICSE'07), 10.1109/icse.2007.92.

The usability of APIs is increasingly important to programmer productivity. Based on experience with usability studies of specific APIs, techniques were explored for studying the usability of design choices common to many APIs. A comparative study was performed to assess how professional programmers use APIs with required parameters in objects' constructors as opposed to parameterless "default" constructors. It was hypothesized that required parameters would create more usable and self-documenting APIs by guiding programmers toward the correct use of objects and preventing errors. However, in the study, it was found that, contrary to expectations, programmers strongly preferred and were more effective with APIs that did not require constructor parameters. Participants' behavior was analyzed using the cognitive dimensions framework, and revealing that required constructor parameters interfere with common learning strategies, causing undesirable premature commitment.

Programmers argue endlessly about whether language X is more "natural" or more "expressive" than language Y (see, for example, this recent post by Stephen Colbourne about C-style vs. Pascal-style variable declarations). Almost without exception, these arguments are based on personal experience and anecdote, rather than on the kind of careful empirical analysis that has become the norm among serious usability professionals.

This paper by Stylos and Clarke is a good introduction to how such analyses can be done, and the insights they yield. Their work is based on the cognitive dimensions frameowork developed by Green and Petre in the early 1990s, which Clarke has successfully applied to new APIs at Microsoft (see for example this writeup from 2004). Those interested in the area should also check out the PLATEAU workshops, which have run annually since 2009.