In the previous chapter, we briefly discussed the simple understanding of the service layer in the architecture design, where we will continue the architecture of the service layer, in this section we will focus on distributed services. In distributed systems, the presentation layer and the business logic layer are not in the same physical deployment, so we must have distributed services, published in a contractual way in the network, our focus is on services, service-oriented programming, which exposes the available services through the combination of business logic is called service-oriented Architecture (SOA).
SOA emphasizes a loosely coupled, macro-service-based architecture that exposes service interactions that are available to service consumers through contracts. SOA is built with services as a component, with the following principles:
- Clear borders:
The service layer is the only entry into the business of the consumer interaction to the system, all our services must be able to be understood by the consumer, and it is best to handle request/response based on the message exchange RPC call, the responsibility is clear and single. And we want our service to be clear, CQS ( Command-query separation principle).
- Autonomy of the service
Service autonomy is mainly manifested in each service is independent, its system deployment, management monitoring are independent. Autonomy embodies the loosely coupled service, but not the service is an island that can consume other services through the exchange of messages.
- Use contracts (interfaces and data carriers), rather than implementing
This is also the first principle of object-oriented design. An important goal of SOA in our service design is interoperability, which enables cross-platform interoperability based on standard protocols such as soap, and possibly heterogeneous systems. So we should choose interfaces instead of language-specific classes and message-based interactions. Service for development is a combination of some column behavior, data contract is data migration object, data carrier. The contract makes us not concerned with the internal implementation of the service, but only the services that are provided, how the signature of the service is called, and so on.
- Compatibility based on policy
For the consumer, whether the service can meet his needs, which requires service semantics, semantic compatibility should also be exposed through the accessible way. Yes the service can be found.
SOA is a design principle specification that aims to provide interoperability for complex systems and to construct system logic in service-based components. Masks specific business logic and processes, exposing the set of behaviors available to the user. SOA is a principle rather than a collective technology. Wcf,webservice is a specific SOA technology. At the same time SOA is not our goal, the customer is not concerned with our adoption of SOA or not, this is just a solution to our system.
The advantage of SOA is to provide us with better code reuse, versioning, security control, extension extensibility. At the same time, the coupling of the service is reduced and the interaction must depend on the service contract and the data contract, not the internal implementation of the service. In our version upgrade, the modification process can be completely re-implemented to replace the original service, and does not affect the use of consumer programs.
Finally we have to say that the current popular restfull, usually we think this is a style, not architecture, is by Roy Thomas Fielding in his doctoral dissertation architectural Styles and the Design of network-based software architectures, the rest is the abbreviation of the English representational state transfer, and the Chinese translation is the "representational states transfer". is a web-based architecture that leverages the method of the HTTP protocol very well. Different semantic operations on resources are represented by different method. Its core is to attribute everything that is posted to the network as a resource, with each resource positioned in a resource Locator (URI). As well as stateless, cached, layered schemas. The latest WCF Resetfull,web API application framework in Microsoft. As well as WCF Ria, WCF Data Service, it is important to note that Microsoft joins the same time with its own OData protocol (Kaiyuan Data Protocol).
Last but not least: I think we have to define a contract, whether it be a service or a resetfull service, and rely on the contract, although Microsoft's technology allows us to directly host the service class, but for the extension and extension of the service, The reason for saying this is that I recently saw some resetfull architectures for direct boarding service classes.
Source: http://www.cnblogs.com/whitewolf/archive/2012/05/22/2513905.html
SOA service-oriented Architecture brief