As many of you may recall, the software design and architecture style known as service-oriented architecture (SOA) emerged in the mid 1990s. Since then, we have discovered better ways to build systems, including advances in cloud-based virtualization, continuous integration and delivery, and microservices. In the process, these technologies have made SOA and all the associated benefits a reality.
In November, I delved into explaining how microservices can be introduced into a large organization with well-established legacy systems. In this post, I cover domain-driven design (DDD) and how this development philosophy can be used to represent the real world in code while being well-suited to a microservices implementation.
Cohesion is an early tenet of software design and refers to the degree of functional relatedness that exists inside a module or class. In this context, cohesion was first described in the late 1970s by Tom DeMarco and has come to mean grouping and keeping together those things that change for the same reasons and separate the functionality that changes for different reasons.
DDD provides an avenue to facilitate the development of highly cohesive systems through bounded contexts. Microservices is an implementation approach that encourages you to focus your service boundaries on the business domain boundaries. DDD and microservices can be used together as you move your organization to a service-oriented design and reap the benefits of continuous integration and delivery.
The seminal work in DDD was defined in a 2003 book by Eric Evans called Domain-Driven Design: Tackling Complexity in the Heart of Software. The overarching philosophy of DDD is to use the notion of bounded contexts which form protective layers around models that define the business domain. Bounded contexts are analogous to departments in a company—the legal department has certain specific responsibilities (contexts) that are different than the IT department and those responsibilities are enforced by rules (boundaries) for interaction and obtaining services from the departments.
This is the same for bounded contexts that you model using DDD. To facilitate a common understanding of the problem domain and translate that domain knowledge into a computer system, the business and technical team must develop a common language. In DDD this common language is called the ubiquitous language (UL). As the technical staff develops its models and code, it uses the UL to decrease the risk of misunderstanding between the business analysts and the engineering staff as the project progresses.
This also serves to provide an additional layer of documentation of the systems and enhances the organization's understanding of how a system was designed and intended to work. The analysis models that are used to understand and define the domain are tied to the code models that are used to create software by the UL.
Other key principles of DDD include:
After you have begun to understand the business problem and developed models to define it you will have to think about how to integrate bounded contexts. In their book Enterprise Integration Patterns (Addison Wesley Signature Series), Gregor Hohpe and Bobby Woolf define four integration styles: file transfer, shared database, remote procedure invocation, and messaging. In most applications of substantial size and for reasons of cohesion your DDD and technical team will most likely settle on remote procedure invocation and/or messaging for integration.
From domain-driven design to microservices, pairing these two approaches to solve large and complex problems makes good business sense.
This article is published as part of the IDG Contributor Network. Want to Join?
Source: From domain-driven design to microservices
No comments:
Post a Comment