Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1094855.1094964acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

Arithmetic with measurements on dynamically-typed object-oriented languages

Published: 16 October 2005 Publication History

Abstract

In physics, like in other sciences, formulas are specified using explicit measurements, that is, a number with its unit. The first step to determine the validity of a physics formula's evaluation is to verify that the unit of the result corresponds with the prospective unit. In software development, physics, financial and other sciences formulas are programmed using mathematical expressions based only on numbers, being the units of these numbers implicitly given by the semantics of the program or assumed by the programmer's knowledge. Consequently, it is common that errors result from operating with values expressed in different units, e.g., dividing a quantity of years by a quantity of months, without obtaining any type of indication or objection to this error from the system. In this report, we discuss our experience designing and implementing a model that solves this problem reifying the concept of measurement, unit and their arithmetic. Our model relieves the programmer from the arduous task of verifying the validity of the arithmetic expressions regarding units, delegating that responsibility to the system, thereby, diminishing the errors introduced by the incorrect use of values expressed in different units. We also show that having implemented this model with a dynamically typed language simplified its programming and increased its reusability.

References

[1]
Allen, E., Chase, D., Luchangco, V., Maessen, J. and Steele, G. Object-Oriented Units of Measurement. Technical Report, OOPSLA 2004.
[2]
Baümer, D., Riehle, D., Siberski, W., Lilienthal, C., Mergert, D.,Sylla, K. and Züllighoven, H. Values In Objects Systems. UBILAB Thecnical Report, 1998-10-10, Zurich, Switzerland
[3]
Beck, K. Extreme Programming Explained: Embrace Change. Addison-Wesley, Reading, MA, 1999
[4]
Beck, K. Test Driven Development: By Example. Addison-Wesley, Reading, MA, 2002
[5]
Fowler, M. Analysis Patterns: Reusable Object Models. Addison-Wesley, Reading, MA, 1996
[6]
Gamma, E., Helm, R., Johnson, R. and Vlissides, J. Design Patterns: Elements of ReusableObject-Oriented Software. Addison-Wesley, 1995.
[7]
Goldberg, A. and Robson, D. Smalltalk-80: The Language and its Implementation. Addison-Wesley, Reading, MA, 1983.
[8]
Hebel, K., Johnson, R. Arithmetic and Double Dispatching in Smalltalk-80. University of Illinois at Urbana-Champaign.
[9]
Java Extension proposal JSR 108, Source Code at http://jsr-108.sourceforge.net/javadoc/javax/units/Unit.html Extension proposal at http://www.jcp.org/en/jsr/detail?id=108
[10]
Ingalls, D. Design Principles Behind Smalltalk. BYTE Magazine, August 1981. The McGraw-Hill Companies, Inc., New York, NY.
[11]
Ingalls, D. A simple technique for handling multiple polymorphism. ACM SIGPLAN Notices, 21(11):347--349, Nov. 1986
[12]
Kennedy, Andrew J. Programming Languages and Dimensions. PhD Thesis, University of Cambridge. Published as Technical Report No. 391, University of Cambridge Computer Laboratory, April 1996
[13]
Taylor, Barry. Guide for the Use of the International System of Units. National Institute of Standards and Technology, Reading, Aplil 1995
[14]
Travis Griggs, VisualWorks public repository, http://www.glorp.org/publicRepository/Measurements.html, 2004
[15]
Woolf, B. The Null Object Pattern. in Pattern Languages of Program Design (R. Martin, F. Buschmann, and D. Riehle, eds.), Reading, Massachusetts, Addison-Wesley, 1997.

Cited By

View all
  • (2018)Explicit Modelling of Physical Measures: From Event-B to JavaElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.271.5271(64-79)Online publication date: 12-May-2018
  • (2018)A point based model of the Gregorian CalendarComputer Languages, Systems and Structures10.1016/j.cl.2005.10.00132:2-3(157-183)Online publication date: 20-Dec-2018
  • (2007)A model‐driven approach to automatic conversion of physical unitsSoftware: Practice and Experience10.1002/spe.82838:4(337-359)Online publication date: 31-May-2007

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
OOPSLA '05: Companion to the 20th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
October 2005
406 pages
ISBN:1595931937
DOI:10.1145/1094855
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 16 October 2005

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. arithmetic expressions
  2. dynamic typed
  3. measurements
  4. smalltalk
  5. units

Qualifiers

  • Article

Conference

OOPSLA05
Sponsor:

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2018)Explicit Modelling of Physical Measures: From Event-B to JavaElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.271.5271(64-79)Online publication date: 12-May-2018
  • (2018)A point based model of the Gregorian CalendarComputer Languages, Systems and Structures10.1016/j.cl.2005.10.00132:2-3(157-183)Online publication date: 20-Dec-2018
  • (2007)A model‐driven approach to automatic conversion of physical unitsSoftware: Practice and Experience10.1002/spe.82838:4(337-359)Online publication date: 31-May-2007

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media