Patterns/Practices for designing Web Services
Are there any good patterns/practices used while designing Services. I came across this post today:
When to Use the Decorator Pattern?
Though I didn't completely understand but it really gives a new direction to think about designing services.
Note: This question is not any technology speci开发者_如何学Pythonfic.
- Follow a REST model.
- Rigorously validate incoming data.
- Avoid SQL injection, and other code exploits.
- In general, work with large chunks of data; i.e. records instead of fields.
- Build your services on a transaction (Unit of Work) basis.
Here is my list:
- Read a book on real-life service design. For a Restful approach i recommend Restful Web Services
- Spec it: Designing a service in human code is much easier to discuss and change than implementing it and then discover it's wrong.
- Write integration (service tests) in a different language: You can be fooled into thinking that your service is real spiffy by using the same tech on both client and server. Implementing a RESTful service in Java?, then write your service tests in (J)Ruby, creating .NET SOAP service ? then write your service tests in Java.
Check SOA Patterns at http://www.soapatterns.org/
I think you can get some insight into the subject and find good ideas browsing there...
I like to divide the services in two kinds: 1.- Business services with the following layers: ddbb dal (group functionality, ddd's repository style) bll (entities, business actions) sil (DTOs, conversion from dto to entity and security)
2.- orchestration services (bpel style): it groups business services for achieving something.
I do not like REST so much, I prefer SOAP.
精彩评论