views:

113

answers:

4

Are there any good patterns/practices used while designing Services. I came across this post today:

http://stackoverflow.com/questions/1549743/when-to-use-the-decorator-pattern/1549771#1549771

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 specific.

+1  A: 
  1. Follow a REST model.
  2. Rigorously validate incoming data.
  3. Avoid SQL injection, and other code exploits.
  4. In general, work with large chunks of data; i.e. records instead of fields.
  5. Build your services on a transaction (Unit of Work) basis.
Robert Harvey
+1  A: 

Here is my list:

  1. Read a book on real-life service design. For a Restful approach i recommend Restful Web Services
  2. Spec it: Designing a service in human code is much easier to discuss and change than implementing it and then discover it's wrong.
  3. 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.
Lars Tackmann
+1  A: 

Check SOA Patterns at http://www.soapatterns.org/

I think you can get some insight into the subject and find good ideas browsing there...

JuanZe
A: 

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.

Pablo Castilla