Interface Definitions
摘要
Having examined how API design can be supported by DDD, we take a look in this chapter at how interfaces need to be defined. Interfaces are essential to modularize the software so that individual modules can be developed independently by different teams or even a single developer, as we already discussed in Chapter 5 , “API Design Supported by Domain-Driven Design.” The mobile application example discussed in Chapter 2 , “Communication Categories,” shows different kinds of Application Programming Interface. As we saw, we want to concentrate in this book on interfaces using different network communication channels. Therefore, in this chapter we will look at how we can define these interfaces. We will first look at the different components of an interface definition (section “Components of an Interface Definition”), then go over the different data types and schemas that we will use, as well as their benefits and drawbacks (section “Data Formats and Their Schemas”). Then the API definition languages will be discussed for synchronous (section “Definition of Synchronous Interfaces”) and asynchronous APIs (section “Definition of Asynchronous Interfaces”). We will conclude the chapter with a comparison of the different protocols in combination with the different data schemas (section “Advantages and Disadvantages of Different Schemas and Protocols”), antipatterns, and counter options (section “Typical Antipatterns”) and how artificial intelligence (AI) can help in the process (section “AI Generation of API Definitions: Chances and Limitations”).