# Advaced Software Engineering contributed by <[`handsomehsia`](https://github.com/handsomehsia) `J` > ### CH18 Service-oriented software engineering #### 18.1 SOA (Service-Oriented Architecture) SOA is a style of software design where services are provided to the other components by application components, through a communication protocol over a network. ![](https://i.imgur.com/M9dTiqG.png) ![](https://i.imgur.com/wehHgtW.png) --- There is 5 main HTTP methods: `GET`:The `GET` method requests a representation of the specified resource. Requests using GET should only retrieve data. `POST`:The `POST` method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server. `PUT`:The `PUT` method replaces all current representations of the target resource with the request payload. `DELETE`:The `DELETE` method deletes the specified resource. `PATCH`:The `PATCH` method is used to apply partial modifications to a resource. --- #### 18.2 RESTful services REST (Representational State Transfer) is truly a “web services” API. REST APIs are based on URIs (Uniform Resource Identifier) and the HTTP protocol, and use JSON for a data format) REST APIs can be simple to build and scale, but they can also be massive and complicated—it’s all in how they’re built, added on to, and what they’re designed to do. Reasons you may want to build an API to be RESTful include resource limitations, fewer security requirements, browser client compatibility, discoverability, data health, and scalability—things that really apply to web services. * REST is all about simplicity, thanks to HTTP protocols. * REST APIs facilitate client-server communications and architectures. If it’s RESTful, it’s built on this client-server principle, with round trips between the two passing payloads of information. * REST APIs use a single uniform interface. This simplifies how applications interact with the API by requiring they all interface in the same way, through the same portal. This has advantages and disadvantages; check with your developer to see if this will affect implementation changes down the road. * REST is optimized for the web. Using JSON as its data format makes it compatible with browsers. * REST is known for excellent performance and scalability. But, like any technology, it can get bogged down or bog down your app. That’s why languages like GraphQL have come along to address problems even REST can’t solve. ##### Comparing SOAP vs REST APIs ![](https://i.imgur.com/AjUwLp8.png) --- #### 18.3 Service engineering ![](https://i.imgur.com/K5vaACp.png) ##### 18.3.1 Service candidate identification identify possible services that might be implemented and define the service requirements. ##### 18.3.2 Service design design the logical service interface and its implementation interfaces (SOAP and/or RESTful) ##### 18.3.3 Service implementation and deployment implement and test the service and make it available foruse. --- #### 18.4 Service composition service construction by composition ![](https://i.imgur.com/vzCXQjR.png) ##### step by step explaination 1. Formulate outline workflow use the requirements for the composite service as a basis for creating an ‘ideal’ service design. 2. Discover services search service registries or catalogs to discover what services exist, who provides these services and the details of the service provision. 3. Select possible services Your selection criteria will obviously include the functionality of the services offered. They may also include the cost of the services and the quality of service (responsiveness, availability, etc.) offered. 4. Refine workflow. This involves adding detail to the abstract description and perhaps adding or removing workflow activities. 5. Create workflow program During this stage, the abstract workflow design is transformed to an executable program and the service interface is defined. 6. Test completed service or application The process of testing the completed, composite service is more complex than component testing in situations where external services are used. --- 參考資料: 1. https://medium.com/itsems-frontend/api-%E6%98%AF%E4%BB%80%E9%BA%BC-restful-api-%E5%8F%88%E6%98%AF%E4%BB%80%E9%BA%BC-a001a85ab638 2. https://www.slideshare.net/software-engineering-book/ch18-service-oriented-software-engineering 3. https://dotblogs.com.tw/marcus116/2011/08/28/34524 4. https://www.upwork.com/resources/soap-vs-rest-a-look-at-two-different-api-styles 5. https://restfulapi.net/ 6. https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods