Skip to main content
main-content

Über dieses Buch

Build domain specific languages (DSLs) using Java's most popular functional programming language: Scala. This book introduces the basics of Scala and DSLs using a series of practical examples. In Practical Scala DSLs, you’ll learn to create pragmatic and complete code examples that explain the actual use of DSLs with Scala: a web API and microservices; a custom language; a mobile app; a Forex system; a game; and cloud applications.
At the end of this unique book, you’ll be able to describe the differences between external and internal DSLs; understand when and how to apply DSLs; create DSLs using Scala; and even create a DSL using another programming language.
What You'll Learn
Build DSLs in Scala
Write a web API and microservices
Create a custom language
Apply DSLs to mobile apps development, a Forex trading system, game development, and more
Discover the role of DSLs in cloud development
Integrate DSLs as part of a DevOps program or structure
Build internal and external DSLs

Who This Book Is For
Experienced Java coders with at least some prior experience with Scala. You may be new to DSLs.

Inhaltsverzeichnis

Frontmatter

Chapter 1. Introduction to Scala

Abstract
Scala has grown in popularity in the last years. Some describe the Scala language as the new “golden boy” of programming languages. More large companies have begun to adopt Scala for their core business needs, thus improving the popularity of the language and, of course, the market for it.
Pierluigi Riti

Chapter 2. Introduction to DSL

Abstract
DSLs (domain specific languages) are everywhere. When, for example, we go for a pizza or a hamburger, we talk with a “specific” language to place our orders.
Pierluigi Riti

Chapter 3. Internal DSL

Abstract
In the previous chapter, you received a brief introduction to the different kinds of DSLs. In this chapter, you will see how to build an internal DSL. Some languages use the acronym DSL to indicate a subset of a language used in everyday life. As an example, we can think of software such as Chef or Puppet, in which it is possible to use “RubyDSL” to write the configuration files.
Pierluigi Riti

Chapter 4. External DSL

Abstract
External DSL is probably the most complex and, at the same time, fascinating kind of DSL. When we design an internal DSL, we establish a connection with the GPL used for defining it. With external DSLs, we define our own language. This means that we can define any kind of rules we want for the language.
Pierluigi Riti

Chapter 5. Web API and μService

Abstract
To this point, I have presented the theory behind DSLs. In this chapter, I discuss real use cases for DSLs, starting with the realization of some web APIs and microservices.
Pierluigi Riti

Chapter 6. User Recognition System

Abstract
A common problem in building IT systems is recognizing the user and assigning to him or her the correct role. Every system has this kind of functionality, and, usually, we use a database to store the data connected to the user.
Pierluigi Riti

Chapter 7. Creating a Custom Language

Abstract
So far, we have gone little by little deep inside the DSL. At this stage, we are able to create external and internal DSLs. In this chapter, we go deeper into external DSLs and begin to develop a custom language.
Pierluigi Riti

Chapter 8. Mobile Development

Abstract
Mobile development has taken on more importance in everyday development. An ever-increasing number of companies now has mobile development teams. In this chapter, you will learn the basics of mobile development and how to use Scala and DSLs to create your own applications.
Pierluigi Riti

Chapter 9. Forex Trading System

Abstract
So far, we’ve used DSLs in different areas. What you’ll see now is how to create a Forex (foreign-exchange) trading system. Today, more and more people are interested in investment, and an increasing number of developers work in finance.
Pierluigi Riti

Chapter 10. Game Development

Abstract
Games are as old as humankind and continue to be important in contemporary societies. The first electronic game was Pong. A two-dimensional sports game, it essentially involved only a ball moving from the left side of the screen and two bars trying to stop the ball from scoring points. The first iteration of an electronic game dates from 1966.
Pierluigi Riti

Chapter 11. Cloud and DevOps

Abstract
Cloud and DevOps are currently the hot tickets for many organizations. Increasingly, businesses are migrating to the cloud and adopting DevOps to meet their everyday requirements.
Pierluigi Riti

Backmatter

Weitere Informationen

Premium Partner

    Bildnachweise