skip to main content
10.1145/2493288.2493291acmconferencesArticle/Chapter ViewAbstractPublication PagesplopConference Proceedingsconference-collections
research-article

Design principles for internal domain-specific languages: a pattern catalog illustrated by Ruby

Published: 16 October 2010 Publication History

Abstract

Some programming languages, especially dynamic programming languages, offer suitable mechanisms for the construction of internal domain-specific languages (DSL). Internal DSLs inherit the facilities of their host language such as the availability of libraries, frameworks, tool support, and other DSLs. When developing an internal DSL, there are two challenges. First, to cope with the host language's syntactic and semantic restrictions. Careful and thoughtful extensions and modifications of the host language are crucial to overcome these restrictions without reverting to poor language design. Second, to support several design principles that are genuine for a DSL. Although there is an extensive body of knowledge about DSL design principles and desirable quality properties, it remains difficult to apply them, or to reason about whether a particular DSL exhibits specific desirable principles.
Our objective is to put the two perspectives together. We research the most important design principles of a DSL and show how different patterns can be used to support these principles. This allows us to produce an extensive pattern catalog which is the foundation of principled approach for designing internal DSLs. The patterns can be used to assess the design quality of a DSL and structure its implementation. In particular, we show a complex DSL example illustrating each principle and the corresponding patterns. While we stick to Ruby for the explanation and application of the patterns, we also name known uses in Python, Scala, and Smalltalk. Patterns are explained with their context, problem, forces, solution, and consequences. We also explain the patterns with the classical structure of intent, motivation, forces, implementation and their consequences. Finally we reflect upon the pattern utilization by discussing their strengths and weaknesses.

References

[1]
Agosta, G. and Pelosi, G. 2007. A Domain Specific Language for Cryptography. In Proceedings of the Forum on specification and Design Languages (FDL). ECSI, 159--164.
[2]
Arnold, B. R. T., Deursen, A. V., and Res, M. 1995. Algebraic Specification of a Language for describing Financial Products. In ICSE-17 Workshop on Formal Methods Application in Software Engineering. IEEE, 6--13.
[3]
Batory, D., Sarvela, J. N., and Rauschmayer, A. 2003. Scaling Step-Wise Refinement. In Proceedings of the 25th International Conference on Software Engineering (ICSE). IEEE Computer Society, Washington, 187--197.
[4]
Bennett, M., Borgen, R., Havelund, K., Ingham, M., and Wagner, D. 2008. Development of a Prototype Domain-Specific Language for Monitor and Control Systems. In Aerospace Conference. IEEE Computer Society, 1--18.
[5]
Bentley, J. 1986. Programming Pearls: Little Languages. Communications of the ACM 29, 8, 711--721.
[6]
Black, A. P., Ducasse, S., Nierstrasz, O., and Pollet, D. 2009a. Pharo by Example. Square Bracket Associates.
[7]
Black, A. P., Ducasse, S., Nierstrasz, O., and Pollet, D. 2009b. Squeak by Example 1st revised Ed. Square Bracket Associates.
[8]
Booch, G. 1994. Object-Oriented Analysis and Design with Applications 2nd Ed. Addison Wesley Longman, Redwood City, CA, USA.
[9]
Bruce, D. 1997. What makes a good Domain-Specific Language? APOSTLE, and its Approach to Parallel Discrete Event Simulation. In First ACM SIGPLAN Workshop on Domain-Specific Languages (DSL). University of Illinois Computer Science, Paris, France, 17--35.
[10]
Cannon, B. and Wohlstadter, E. 2007. Controlling Access to Resources within the Python Interpreter. Proceedings of the Second EECE.
[11]
Coplien, J. O. 1999. Multi-paradigm design for C++. Addison-Wesley, Boston, San Francisco, et al.
[12]
Correia, F. F., Ferreira, H. S., Flores, N., and Aguiar, A. Patterns for Consistent Software Documentation. In Proceedings of the 16th Conference for Pattern Langauges of Programs (PloP).
[13]
Costagliola, G., Delucia, A., Orefice, S., and Polese, G. 2002. A classification framework to support the design of visual languages. Journal of Visual Languages & Computing 13, 6, 573--600.
[14]
Cunningham, H. C. 2008. A Little Language for Surveys: Constructing an Internal DSL in Ruby. In Proceedings of the 46th Annual Southeast Regional Conference (ACM-SE). ACM, New York, 282--287.
[15]
Czarnecki, K. and Eisenecker, U. W. 2000. Generative Programming: Methods, Tools, and Applications. Addison-Wesley, Boston, San Franciso et al.
[16]
Dinkelaker, T. and Mezini, M. 2008. Dynamically Linked Domain-Specific Extensions for Advice Languages. In Proceedings of the 2008 AOSD Workshop on Domain-Specific Aspect Languages (DSAL). ACM, New York, 1--7.
[17]
Flanagan, D. and Matsumoto, Y. 2008. The Ruby Programming Language. O-Reilly Media, Sebastopol, USA.
[18]
Foote B, J. Y. 1998. Metadata and Active Object Models. In Proceedings of the 5th Conference on Pattern Languages of Programs (PLOP). Washington University Department of Computer Science, Washington, USA.
[19]
Gamma, E., Helm, R., Johnson, R., and Vlissides, J. 1997. Design Patterns - Elements of Reusable Object-Oriented Software 10th Ed. Addison-Wesley, Reading, Harlow et al.
[20]
Groote, J. F., Van Vlijmen, S. F. M., and Koorn, J. W. C. 1995. The Safety Guaranteeing System at Station Hoorn-Kersenboogerd. In Proceedings of the Tenth Annual Conference on Computer Assurance Systems Integrity, Software Safety and Process Security (COMPASS '95). IEEE, 57--68.
[21]
Guerra, E., Souza, J., and Fernandes, C. 2009. A Pattern Language for Metadata-based Frameworks. In Proceedings of the 16th Conference on Pattern Languages of Programs (PLOP). ACM.
[22]
Günther, S. 2009. Engineering Domain-Specific Languages with Ruby. In 3. Workshop des Centers for Very Large Business Applications (CVLBA), H.-K. Arndt and H. Krcmar, Eds. Shaker, Aachen, 11--21.
[23]
Haase, A. 2007. Patterns for the Definition of Programming Languages. In Proceedings of 12th European Conference on Pattern Languages of Programs (EuroPLoP).
[24]
Høst, E. W. and Østvold, B. M. 2008. The java programmer's phrase book. In Software Language Engineering. First International Conference on Software Language Engineering (SLE), 5452, 322--341.
[25]
Hudak, P. 1998. Modular Domain Specific Languages and Tools. In Proceedings of the Fifth International Conference on Software Reuse (ICSR), P. Davenbu and J. Poulin, Eds. IEEE, Washington, 134--142.
[26]
Kang, K., Cohen, S., Hess, J., Novak, W., and Peterson, A. 1990. Feature-Oriented Domain Analysis (FODA) Feasibility Study. Tech. Rep. CMU/SEI-90-TR-21, Software Engineering Institute, Carnegie Mellon University, USA.
[27]
Ladd, D. A. and Ramming, J. C. 1994. Two Application Languages in Software Production. In Proceedings of the USENIX Very High Level Languages Symposium (VHLLS). USENIX Association, Berkeley, CA, USA, 10--18.
[28]
Landin, P. J. 1966. The Next 700 Programming Languages. Communications of the ACM 9, 3, 157--166.
[29]
Latry, F., Mercadal, J., and Consel, C. 2007. Staging Telephony Service Creation: A Language Approach. In Proceedings of the 1st international conference on Principles, systems and applications of IP telecommunications (IPTComm). ACM, New York, 99--110.
[30]
Lopez-Herrejon, R. E. and Batory, D. 2001. A Standard Problem for Evaluating Productline Methodologies. In Proceedings of the 3rd International Conference on Generative and Component-Based Software Engineering (GCSE), J. Bosch, Ed. Lecture Notes in Computer Science Series, vol. 2186. Springer-Verlag, London, 10--24.
[31]
Lutz, M. 2009. Learning Python 4th Ed. O'Reilly Media, Sebastopol.
[32]
McKeeman, W. M. 1976. Programming language design. In Compiler Construction, An Advanced Course, 2nd ed. Springer-Verlag, London, UK, 514--524.
[33]
Mernik, M., Heering, J., and Sloane, A. M. 2005. When and How to Develop Domain-Specific Languages. ACM Computing Survey 37, 4, 316--344.
[34]
Moody, D. L. 2009. The "Physics" of Notations: Toward a Scientific Basis for Constructing Visual Notations in Software Engineering. IEEE Transactions on Software Engineering 35, 756--779.
[35]
Munnelly, J. and Clarke, S. 2008. A Domain-Specific Language for Ubiquitous Healthcare. In Proceedings of the 3rd International Conference on Pervasive Computing and Applications (ICSPA). IEEE, 757--762.
[36]
Odersky, M., Spoon, L., and Venners, B. 2008. Programming in Scala. Artima Press, Mountain View, California, USA.
[37]
Pane, J. F. 2004. Dissertation. Ph.D. thesis, Carnegie Mellon University, Computer Science Department.
[38]
Perrotta, P. 2010. Metaprogramming Ruby. The Pragmatic Bookshelf, Raleigh.
[39]
Sebesta, R. W. 1999. Concepts of Programming Languages. Addison-Wesley, Reading, Harlow et al.
[40]
Sharp, A. 1997. Smalltalk by Example. McGraw-Hill Publishing Co.
[41]
Spiewak, D. and Zhao, T. 2009. ScalaQL: Language-Integrated Database Queries for Scala. In Proceedings of the 2nd International Conference on Software Language Engineering (SLE), M. van den Brand, D. Gaševic, and J. Gray, Eds. Lecture Notes in Computer Science Series, vol. 5969. Springer-Verlag, Berlin, Heidelberg, 154--163.
[42]
Spinellis, D. 2001. Notable Design Patterns for Domain-Specific Languages. Journal of Systems and Software 56, 1, 91--99.
[43]
Summerfield, M. 2010. Programming in Python 3: A Complete Introduction to the Python Programming Language 2nd Ed. Addison-Wesley, Upper Saddle River, Boston et al.
[44]
Tanter, É. 2008. Contextual Values. In Proceedings of the 2008 Symposium on Dynamic Languages (DLS). ACM.
[45]
Thibault, S., Marlet, R., and Consel, C. 1997. A Domain-Specific Language for Video Device Drivers: from Design to Implementation. 11--26.
[46]
Thomas, D., Fowler, C., and Hunt, A. 2009. Programming Ruby 1.9 - The Pragmatic Programmers' Guide. The Pragmatic Bookshelf, Raleigh, USA.
[47]
Van Deursen, A., Klint, P., and Visser, J. 2000. Domain-Specific Languages: An Annotated Bibliography. ACM SIGPLAN Notices 35, 6, pp. 26--36.
[48]
Wampler, D. and Payne, A. 2009. Programming Scala. O'Reilly Media, Sebastopol, USA.
[49]
Weinberg, G. M. 1971. The Philosophy of Programming Languages. John Wiley & Sons, New York.
[50]
Withey, J. 1996. Investment Analysis of Software Assets for Product Lines. Technical Report CMU/SEI96-TR-010, Software Engineering Institute, Carnegie Mellon University, USA.
[51]
Zdun, U. and Strembeck, M. 2009. Reusable Architectural Decisions for DSL Design: Foundational Decisions in DSL Projects. In Proceedings of the 14th Annual European Conference on Pattern Languages of Programming (EuroPLoP), A. Kelly and M. Weiss, Eds. CEUR, RWTH Aachen, Aachen, Germany.

Cited By

View all
  • (2020)Remote Method Delegation: a Platform for Grid ComputingJournal of Grid Computing10.1007/s10723-020-09525-zOnline publication date: 14-Jul-2020
  • (2020)How to Integrate Formal and Informal Settings in Massive Open Online Courses Through a Transgenic Learning ApproachRadical Solutions and Learning Analytics10.1007/978-981-15-4526-9_11(173-191)Online publication date: 9-May-2020
  • (2016)Static Detection of User-specified Security Vulnerabilities in Client-side JavaScriptProceedings of the 2016 ACM Workshop on Programming Languages and Analysis for Security10.1145/2993600.2993612(3-13)Online publication date: 24-Oct-2016
  • Show More Cited By

Index Terms

  1. Design principles for internal domain-specific languages: a pattern catalog illustrated by Ruby

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    PLOP '10: Proceedings of the 17th Conference on Pattern Languages of Programs
    October 2010
    388 pages
    ISBN:9781450301077
    DOI:10.1145/2493288
    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 2010

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. design principles
    2. domain-specific languages
    3. dynamic programming languages

    Qualifiers

    • Research-article

    Funding Sources

    Conference

    PLoP '10
    Sponsor:

    Acceptance Rates

    PLOP '10 Paper Acceptance Rate 28 of 36 submissions, 78%;
    Overall Acceptance Rate 28 of 36 submissions, 78%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)8
    • Downloads (Last 6 weeks)1
    Reflects downloads up to 18 Feb 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2020)Remote Method Delegation: a Platform for Grid ComputingJournal of Grid Computing10.1007/s10723-020-09525-zOnline publication date: 14-Jul-2020
    • (2020)How to Integrate Formal and Informal Settings in Massive Open Online Courses Through a Transgenic Learning ApproachRadical Solutions and Learning Analytics10.1007/978-981-15-4526-9_11(173-191)Online publication date: 9-May-2020
    • (2016)Static Detection of User-specified Security Vulnerabilities in Client-side JavaScriptProceedings of the 2016 ACM Workshop on Programming Languages and Analysis for Security10.1145/2993600.2993612(3-13)Online publication date: 24-Oct-2016
    • (2015)Call-target-specific method argumentsProceedings of the 10th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems10.1145/2843915.2843919(1-4)Online publication date: 4-Jul-2015
    • (2015)Usage contractsScience of Computer Programming10.1016/j.scico.2015.01.004105:C(73-91)Online publication date: 1-Jul-2015
    • (2015)Reuse in model-to-model transformation languagesSoftware and Systems Modeling (SoSyM)10.1007/s10270-013-0343-714:2(537-572)Online publication date: 1-May-2015
    • (2013)Iterative and Pattern-Based Development of Internal Domain-Specific LanguagesFormal and Practical Aspects of Domain-Specific Languages10.4018/978-1-4666-2092-6.ch006(132-155)Online publication date: 2013
    • (2012)Software variabilityProceedings of the 6th International Workshop on Variability Modeling of Software-Intensive Systems10.1145/2110147.2110165(157-164)Online publication date: 25-Jan-2012
    • (2012)Type-Safe model transformation languages as internal DSLs in scalaProceedings of the 5th international conference on Theory and Practice of Model Transformations10.1007/978-3-642-30476-7_11(160-175)Online publication date: 28-May-2012

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media