Chapter 5. Integrating DSLs into your applications

 

In this chapter

  • Structuring and managing DSL integration
  • Reusing DSL scripts
  • Performance considerations
  • Separating the DSL from the application

We’ve covered a lot of ground, but only at the micro level so far. We’ve talked about how to build a DSL, how to ensure you have a good language, what the design parameters are, and so on. But we haven’t yet touched on the macro level: how to take a DSL and integrate it into an application. Chapter 4 covered this at the micro level (building the languages themselves), but in this chapter we’re going to discuss all that surrounds a DSL in an application. We’ll talk about when and where to integrate a DSL, how to handle errors, how to handle dependencies between scripts, and how to set up a DSL structure that will be easy to work with.

5.1. Exploring DSL integration

The first thing we’ll do is explore a DSL-integrated application to see what it looks like. That will give you an idea of the things you need to handle.

Figure 5.1 shows the DSLs integrated into our online shop example. We explored some of those DSLs in chapter 4 from the language-building perspective. Now we’ll explore them from the application-integration perspective. This will be somewhat easier, because you’ve already seen how to make the calls to the DSL scripts. But in chapter 4 we were focusing on the language, and the integration approaches we used were trivial.

Figure 5.1. The integrated DSLs in our online shop example

5.2. Naming conventions

5.3. Ordering the execution of scripts

5.4. Managing reuse and dependencies

5.5. Performance considerations when using a DSL

5.6. Segregating the DSL from the application

5.7. Handling DSL errors

5.8. Administrating DSL integration

5.9. Summary

sitemap