Skip to main content

The Subjective Cost of Writing Reusable Code: The Case of Functions

  • 886 Accesses

Part of the Lecture Notes in Business Information Processing book series (LNBIP,volume 349)


Functions provide substantial benefits for software development, simplifying programming through decomposition, reusability and abstraction. In a previous study, our group identified a tendency of high-school students to not use functions, even in programming tasks where functions can be a good solution strategy. The current research extends this observation to university students and aims to provide an explanation for the factors underlying this tendency. We focus on the subjective cost of the cognitive effort required for writing functions. Our experiment examined how information systems students solved a set of programming tasks, which varied by the number of repetitive questions. The results showed that most of the students avoided using functions altogether. We further found that in the subgroup of students who used functions at least once, the likelihood of using functions was positively associated with (a) the number of repetitive questions in each task, and (b) the task order, i.e., the progress of the experiment. These results indicate that the subjective cost of writing functions is taken into account when making a decision on how to solve a task at hand and is compared with the cost of repetitive work without using function, and that the former cost is updated with experience.


  • Programming
  • Functions
  • Code-reuse
  • Abstraction
  • Cognition
  • Dual-process theory
  • Subjective cost

This is a preview of subscription content, access via your institution.

Buying options

USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-030-20948-3_3
  • Chapter length: 11 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
USD   54.99
Price excludes VAT (USA)
  • ISBN: 978-3-030-20948-3
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   69.99
Price excludes VAT (USA)
Fig. 1.
Fig. 2.
Fig. 3.
Fig. 4.
Fig. 5.
Fig. 6.


  1. Brown, M.: Comfort Zone: model or metaphor? Aust. J. Outdoor Educ. 12, 3–12 (2008)

    CrossRef  Google Scholar 

  2. Chen, W.J., Krajbich, I.: Computational modeling of epiphany learning. Proc. Natl. Acad. Sci. 114, 4637–4642 (2017).

    CrossRef  Google Scholar 

  3. Green, L., Myerson, J.: A discounting framework for choice with delayed and probabilistic rewards. Psychol. Bull. 130, 769–792 (2004).

    CrossRef  Google Scholar 

  4. Hadar, I.: When intuition and logic clash: the case of the object-oriented paradigm. Sci. Comput. Program. 78, 1407–1426 (2013).

    CrossRef  Google Scholar 

  5. Hashim, K., Key, E.: A software maintainability attributes model. Malays. J. Comput. Sci. 9, 92–97 (1996)

    Google Scholar 

  6. Kable, J.W., Glimcher, P.W.: The neural correlates of subjective value during intertemporal choice. Nat. Neurosci. 10, 1625–1633 (2007).

    CrossRef  Google Scholar 

  7. Kahneman, D.: Maps of bounded rationality: a perspective on intuitive judgment and choice. Sveriges Riksbank Prize Econ. Sci. Mem. Alfred Nobel, 449–489 (2002).

    CrossRef  Google Scholar 

  8. Kool, W., McGuire, J.T., Rosen, Z.B., Botvinick, M.M.: Decision making and the avoidance of cognitive demand. J. Exp. Psychol. Gen. 139, 665–682 (2010).

    CrossRef  Google Scholar 

  9. Kramer, J.: Is abstraction the key to computing? Commun. ACM 50, 36–42 (2007).

    CrossRef  Google Scholar 

  10. Maddala, G.S.: Limited-Dependent and Qualitative Variables in Econometrics. Cambridge University Press, Cambridge (1986)

    MATH  Google Scholar 

  11. Manlove, K.: Introduction to Statistical Analysis using R commander, pp. 1–23 (2014)

    Google Scholar 

  12. Omar, A., Hadar, I., Leron, U.: Investigating the under-usage of code decomposition and reuse among high school students: the case of functions. In: Metzger, A., Persson, A. (eds.) CAiSE 2017. LNBIP, vol. 286, pp. 92–98. Springer, Cham (2017).

    CrossRef  Google Scholar 

  13. Patzelt, E.H., Kool, W., Millner, A.J., Gershman, S.J., Note, A., Patzelt, E.H.: Building N In press at Scientific Reports 4729

    Google Scholar 

  14. Simon, H.A.: Administrative behaviour. Aust. J. Public Adm. (1947).

    CrossRef  Google Scholar 

  15. Stanovich, K.E.: What Intelligence Tests Miss: The Psychology of Rational Thought. Yale University Press, New Haven (2009)

    Google Scholar 

  16. Westbrook, A., Braver, T.S.: Cognitive effort: a neuroeconomic approach. Cogn. Affect Behav. Neurosci. 15, 395–415 (2015).

    CrossRef  Google Scholar 

  17. Westbrook, A., Kester, D., Braver, T.S.: What is the subjective cost of cognitive effort? Load, trait, and aging effects revealed by economic preference. PLoS One 8, 1–8 (2013).

    CrossRef  Google Scholar 

  18. Zipf, G.K.: Human Behaviour and the Principle of Least Effort: An Introduction to Human Ecology, 588 pages. Addison-Wesley Press, Cambridge (1949)

    Google Scholar 

Download references

Author information

Authors and Affiliations


Corresponding author

Correspondence to Irit Hadar .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Verify currency and authenticity via CrossMark

Cite this paper

Lachman, I., Hadar, I., Hertz, U. (2019). The Subjective Cost of Writing Reusable Code: The Case of Functions. In: Proper, H., Stirna, J. (eds) Advanced Information Systems Engineering Workshops. CAiSE 2019. Lecture Notes in Business Information Processing, vol 349. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-20947-6

  • Online ISBN: 978-3-030-20948-3

  • eBook Packages: Computer ScienceComputer Science (R0)