ABSTRACT
It is difficult to generally compare the succinctness of declarative versus imperative programming as source code size varies. In imperative programs, basic operations have constant cost, but they tend to be more verbose than declarative programs, which increases the potential for defects. This paper presents a novel approach for a generalized comparison by transforming the problem into comparing executed code size of a benchmark imperative algorithm with a partially declarative variant of the same algorithm. This allows input size variation to substitute for source code size variation. For implementation, we use a multiparadigm language called XForms that contains both declarative XPath expressions and imperative script actions for interacting with XML data within web and office documents. A novel partially declarative variant of the quicksort is presented. Amortized analysis shows that only O(n) imperative actions are executed, so the expressive power of the declarative constructs is at least Ω(log n). In general, declarative constructs can have an order of magnitude expressive power advantage compared with only using basic imperative operations. The performance cost factor of the expressive power advantage was determined to be O(log2 n) based on a novel dynamic projection from the generalized tree structure of XML data to a height balanced binary tree.
Supplemental Material
Available for Download
Supplemental movie, appendix, image and software files for, On the Expressive Power of Declarative Constructs in Interactive Document Scripts
- Apache Software Foundation. 2014. The Apache Xalan Project. https://xalan.apache.org/;https://github.com/apache/xalan-jGoogle Scholar
- Apache Software Foundation. 2019. Apache Open Office. https://openoffice.apache.org/source.htmlGoogle Scholar
- John M. Boyer. 1998. Sorting and Searching Linked Lists in Java. Dr. Dobb's Journal 285 (May 1998), 126--129 & 137--138. http://www.drdobbs.com/database/algorithm-alley/184410565Google Scholar
- John M. Boyer (Ed.). 2009. XForms 1.1. W3C Recommendation (20 October 2009). http://www.w3.org/TR/2009/REC-xforms-20091020/Google Scholar
- John M. Boyer. 2016. Document Order Management via Binary Tree Projection. United States Patent 9411792 (Aug 2016). https://patents.google.com/patent/US9411792B2Google Scholar
- John M. Boyer. 2019. Multitasking Algorithms in XForms. In Proceedings of Balisage: The Markup Conference 2019 (Balisage Series on Markup Technologies), Vol. 22. Washington, DC, 1--16.Google ScholarCross Ref
- John M. Boyer. 2019. XForms Demo of Sorts. https://github.com/john-boyer-phd/XForms/tree/master/Samples/DemoOfSortsGoogle Scholar
- Tim Bray, Dave Hollander, Andrew Layman, Richard Tobin, and Henry S. Thompson (Eds.). 2009. Namespaces in XML 1.0 (Third Edition). W3C Recommendation (8 December 2009). https://www.w3.org/TR/2009/REC-xml-names-20091208/Google Scholar
- Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, and François Yergeau (Eds.). 2008. Extensible Markup Language (XML) 1.0 (Fifth Edition). W3C Recommendation (26 November 2008). https://www.w3.org/TR/2008/REC-xml-20081126/Google Scholar
- Frederick P. Brooks, Jr. 1995. The Mythical Man-month (Anniversary Ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.Google Scholar
- James Clark (Ed.). 1999. XSL Transformations (XSLT) Version 1.0. W3C Recommendation (16 November 1999). http://www.w3.org/TR/1999/REC-xslt-19991116Google Scholar
- James Clark and Steve DeRose (Eds.). 1999. XML Path Language (XPath) Version 1.0. W3C Recommendation (16 November 1999). https://www.w3.org/TR/1999/REC-xpath-19991116/Google Scholar
- Alain Couthures. 2018. XSLTForms. https://sourceforge.net/projects/xsltforms/Google Scholar
- Patrick Durusau and Michael Brauer (Eds.). 2011. Open Document Format for Office Applications (OpenDcoument) Version 1.2. OASIS Standard (29 September 2011). http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os.htmlGoogle Scholar
- Steve Faulkner, Arron Eicholz, Travis Leithead, Alex Danilo, and Sangwhan Moon (Eds.). 2017. HTML 5.2. W3C Recommendation (14 December 2017). https://www.w3.org/TR/2017/REC-html52-20171214/Google Scholar
- International Business Machines Corporation. 2015. IBM Forms 8.2.1. https://ibm.biz/Bd2UgwGoogle Scholar
- Donald E. Knuth. 1998. The Art of Computer Programming, Volume 3: Sorting and Searching (2nd Ed.). Addison Wesley Longman Publishing Co., Inc., Redwood City, CA, USA.Google Scholar
- Shane McCarron, Steven Pemberton, and T. V. Raman (Eds.). 2003. XML Events: An Events Syntax for XML. W3C Recommendation (23 October 2003). https://www.w3.org/TR/2003/REC-xml-events-20031014/Google Scholar
- Mozilla Foundation. 2019. gecko-dev/js/src/builtin/Array.cpp. https://github.com/mozilla/gecko-dev/blob/master/js/src/builtin/Array.cppGoogle Scholar
- Steven Pemberton. 2018. XForms 2.0: What's New. In Proceedings of Balisage: The Markup Conference 2018 (Balisage Series on Markup Technologies), Vol. 21. Washington, DC. https://doi.org/10.4242/BalisageVol21.Pemberton02Google ScholarCross Ref
- Daniel Veillard, Bjorn Reese, William Brack, Igor Zlatkovic, and Aleksey Sanin. 2019. XML Parser and Markup Toolkit. https://github.com/GNOME/libxml2Google Scholar
- Thomas Vogel, Stefan Neumann, Stephan Hildebrandt, Holger Giese, and Basil Becker. 2010. Incremental Model Synchronization for Efficient Run-Time Monitoring. In Models in Software Engineering, Sudipto Ghosh (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 124--139. https://doi.org/10.1007/978-3-642-12261-3_13Google Scholar
- Wikipedia contributors. 2018. Comparison of Programming Paradigms. https://en.wikipedia.org/wiki/Comparison_of_programming_paradigms [Online; accessed 02-March-2019].Google Scholar
- Allen Wirfs-Brock (Ed.). 2015. ECMAScript 2015 Language Specification (6th edition). European Computer Manufacturers Association (ECMA) Standard (June 2015). https://www.ecma-international.org/ecma-262/6.0/Google Scholar
Index Terms
- On the Expressive Power of Declarative Constructs in Interactive Document Scripts
Recommendations
Multi-DSL Applications with Ruby
Domain-specific languages (DSLs) are becoming a mature application development tool that developers use to express concerns. Multi-DSL applications comprise DSLs and host language code. Exploiting the Ruby programming language's built-in support for the ...
Magic Potion: Incorporating New Development Paradigms through Metaprogramming
Today's applications require mixing and matching languages, platforms, and paradigms, which increases a solution's complexity. The authors propose a lighter approach that borrows a desired paradigm and incorporates it as an integral part of a preferred ...
On the expressive power of query languages
Two main topics are addressed. First, an algebraic approach is presented to define a general notion of expressive power. Heterogeneous algebras represent information systems and morphisms represent the correspondences between the instances of databases, ...
Comments