DESIGN PROCESS for APPLICATION-SPECIFIC LANGUAGES: a LANGUAGE for WATER RESOURCES POLICY SPECIFICATION By
Total Page:16
File Type:pdf, Size:1020Kb
i DESIGN PROCESS FOR APPLICATION-SPECIFIC LANGUAGES: A LANGUAGE FOR WATER RESOURCES POLICY SPECIFICATION by STEPHEN C. WEHREND B.A., University of Colorado, 1984 M.S., University of Colorado, 1990 January 23, 2003 9:12 am ii January 23, 2003 9:12 am iii Application-specific languages are custom programming languages that are used within the context of a single application. They provide users with functionality that cannot be readily built into an application through other means, such as direct manipulation interfaces. Generally, application-specific languages are appropriate where the problems to be solved are not completely known in advance and require the use of complex logic or flow of control. Application-specific languages are frequently designed and developed, yet there is little literature published on their design. What is published tends to focus on the domain of the problem for which the language is needed, the language itself and how well the language addresses the problems for which it was created. There is little discussion regarding what design decisions were made and why, what alternatives were considered and what components might need to be a part of an application- specific language system. In an effort to shed light on the design of application-specific languages and to provide guidance for future designers, this dissertation presents a multi-part case study in which two application-specific languages were designed and developed. The language is used to specify policies that are part of water resources simulations. The target application, RiverWare, is a general purpose river basin modeling tool. The policies specified in the language are used by RiverWare’s simulation engine to alter the flow of water in the river basin. The users of this system and language are water resources engineers whose programming experience and abilities range from minimal to moderate. January 23, 2003 9:12 am iv Acknowledgments I would like to thank the following: • my advisor, Clayton Lewis, for his guidance, insight and patience during this research; • René Reitsma, for his assistance during this research and his input on the design of the language; • Terry Fulp, for his sponsorship of the language and his input throughout the process; • Liz Jessup and Amer Diwan, for their help in guiding this research; • Edie Zagona, for her leadership of the RiverWare project and her support and input; • Brad Vickers and Bruce Williams, for providing target problems and input that were critical to the design of the language; • Patrick Lynn and Alan Eliasen, for their assistance with the development of the second language and their insights and feedback on its design; • Bill Oakley, for the significant contributions he has made to RiverWare; and • Jennifer, Jonathan and Benjamin, for their patience, support and encouragement throughout the entire process. January 23, 2003 9:12 am Table of Contents 1. Introduction . 1 1.1. Application-specific Languages . 1 1.2. General Purpose and Domain-specific Languages . 2 1.3. Thesis . 3 1.4. Methodology . 4 2. Background for Application-specific Languages in Water Resources . 6 2.1. CADSWES . 6 2.2. Domain . 7 2.2.1. River Systems . 7 2.2.2. Water Quantity . 9 2.2.3. Water Quality . 10 2.3. USBR . 11 2.3.1. Regions . 11 2.3.2. Users . 12 2.3.3. Policies . 13 2.4. Application . 15 2.4.1. CRSS . 15 2.4.2. RSS . 16 2.4.2.1. LISP . 16 2.4.2.2. C++ . 17 2.4.2.3. RSS’s Rule Language . 18 2.4.3. RiverWare . 21 2.4.3.1. Simple Simulation . 22 2.4.3.2. Rule-based Simulation . 26 2.5. Motivation for New Language . 33 3. Case Study 1 . 34 3.1. Introduction . 34 3.2. Participants . 35 3.2.1. Initial Users . 35 3.2.2. End Users . 36 3.3. Target Problems . 36 ii 3.3.1. Programming Language . 37 3.3.2. Programming Environment . 38 3.3.3. Language Processor . 38 3.4. Design Context . 39 3.4.1. RiverWare . 39 3.4.2. Real-world Constraints . 40 3.5. Design Process . 41 3.5.1. Getting Started . 42 3.5.2. Problem Descriptions . 44 3.5.2.1. Programming Language . 44 3.5.2.2. Programming Environment . 49 3.5.2.3. Language Processor . 53 3.5.3. RSS’s Rule System . 53 3.5.3.1. Programming Language . 54 3.5.3.2. Programming Environment . 55 3.5.3.3. Language Processor . 55 3.5.4. Expert Systems . 57 3.5.4.1. General Literature . 57 3.5.4.2. CLIPS . 58 3.5.5. Deadlines and Goals . 59 3.5.6. Options Considered . 61 3.5.6.1. Tcl . 61 3.5.6.2. Perl . 64 3.5.6.3. Python . 65 3.5.6.4. Java . 66 3.5.6.5. CLIPS . 66 3.5.7. Option Selected: Tcl . ..