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.
- 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.Google Scholar
- 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.Google Scholar
- 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. Google ScholarDigital Library
- 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.Google Scholar
- Bentley, J. 1986. Programming Pearls: Little Languages. Communications of the ACM 29, 8, 711--721. Google ScholarDigital Library
- Black, A. P., Ducasse, S., Nierstrasz, O., and Pollet, D. 2009a. Pharo by Example. Square Bracket Associates.Google Scholar
- Black, A. P., Ducasse, S., Nierstrasz, O., and Pollet, D. 2009b. Squeak by Example 1st revised Ed. Square Bracket Associates. Google ScholarDigital Library
- Booch, G. 1994. Object-Oriented Analysis and Design with Applications 2nd Ed. Addison Wesley Longman, Redwood City, CA, USA. Google ScholarDigital Library
- 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.Google Scholar
- Cannon, B. and Wohlstadter, E. 2007. Controlling Access to Resources within the Python Interpreter. Proceedings of the Second EECE.Google Scholar
- Coplien, J. O. 1999. Multi-paradigm design for C++. Addison-Wesley, Boston, San Francisco, et al. Google ScholarDigital Library
- 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). Google ScholarDigital Library
- 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.Google ScholarCross Ref
- 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. Google ScholarDigital Library
- Czarnecki, K. and Eisenecker, U. W. 2000. Generative Programming: Methods, Tools, and Applications. Addison-Wesley, Boston, San Franciso et al. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- Flanagan, D. and Matsumoto, Y. 2008. The Ruby Programming Language. O-Reilly Media, Sebastopol, USA. Google ScholarDigital Library
- 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.Google Scholar
- 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.Google Scholar
- 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.Google Scholar
- 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. Google ScholarDigital Library
- 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.Google Scholar
- Haase, A. 2007. Patterns for the Definition of Programming Languages. In Proceedings of 12th European Conference on Pattern Languages of Programs (EuroPLoP).Google Scholar
- 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.Google Scholar
- 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. Google ScholarDigital Library
- 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.Google Scholar
- 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. Google ScholarDigital Library
- Landin, P. J. 1966. The Next 700 Programming Languages. Communications of the ACM 9, 3, 157--166. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- Lutz, M. 2009. Learning Python 4th Ed. O'Reilly Media, Sebastopol. Google ScholarDigital Library
- McKeeman, W. M. 1976. Programming language design. In Compiler Construction, An Advanced Course, 2nd ed. Springer-Verlag, London, UK, 514--524. Google ScholarDigital Library
- Mernik, M., Heering, J., and Sloane, A. M. 2005. When and How to Develop Domain-Specific Languages. ACM Computing Survey 37, 4, 316--344. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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.Google Scholar
- Odersky, M., Spoon, L., and Venners, B. 2008. Programming in Scala. Artima Press, Mountain View, California, USA. Google ScholarDigital Library
- Pane, J. F. 2004. Dissertation. Ph.D. thesis, Carnegie Mellon University, Computer Science Department.Google Scholar
- Perrotta, P. 2010. Metaprogramming Ruby. The Pragmatic Bookshelf, Raleigh. Google ScholarDigital Library
- Sebesta, R. W. 1999. Concepts of Programming Languages. Addison-Wesley, Reading, Harlow et al. Google ScholarDigital Library
- Sharp, A. 1997. Smalltalk by Example. McGraw-Hill Publishing Co.Google Scholar
- 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. Google ScholarDigital Library
- Spinellis, D. 2001. Notable Design Patterns for Domain-Specific Languages. Journal of Systems and Software 56, 1, 91--99. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- Tanter, É. 2008. Contextual Values. In Proceedings of the 2008 Symposium on Dynamic Languages (DLS). ACM. Google ScholarDigital Library
- Thibault, S., Marlet, R., and Consel, C. 1997. A Domain-Specific Language for Video Device Drivers: from Design to Implementation. 11--26.Google Scholar
- Thomas, D., Fowler, C., and Hunt, A. 2009. Programming Ruby 1.9 - The Pragmatic Programmers' Guide. The Pragmatic Bookshelf, Raleigh, USA. Google ScholarDigital Library
- Van Deursen, A., Klint, P., and Visser, J. 2000. Domain-Specific Languages: An Annotated Bibliography. ACM SIGPLAN Notices 35, 6, pp. 26--36. Google ScholarDigital Library
- Wampler, D. and Payne, A. 2009. Programming Scala. O'Reilly Media, Sebastopol, USA.Google Scholar
- Weinberg, G. M. 1971. The Philosophy of Programming Languages. John Wiley & Sons, New York.Google Scholar
- Withey, J. 1996. Investment Analysis of Software Assets for Product Lines. Technical Report CMU/SEI96-TR-010, Software Engineering Institute, Carnegie Mellon University, USA.Google Scholar
- 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.Google Scholar
Index Terms
- Design principles for internal domain-specific languages: a pattern catalog illustrated by Ruby
Recommendations
Development of internal domain-specific languages: design principles and design patterns
PLoP '11: Proceedings of the 18th Conference on Pattern Languages of ProgramsA great part of software development challenges can be solved by one universal tool: Abstraction. Developers solve development challenges by using expressions and concepts that abstract from too technical details. One especially supportive tool for ...
A domain-specific language for building self-optimizing AST interpreters
GPCE '14Self-optimizing AST interpreters dynamically adapt to the provided input for faster execution. This adaptation includes initial tests of the input, changes to AST nodes, and insertion of guards that ensure assumptions still hold. Such specialization ...
Untangling crosscutting concerns in domain-specific languages with domain-specific join points
DSAL '09: Proceedings of the 4th workshop on Domain-specific aspect languagesLike programs written in general-purpose languages, programs written in DSLs may also suffer from tangling and scattering in the presence of domain-specific crosscutting concerns. This paper presents an architecture that supports aspect-oriented ...
Comments