mercredi 1 février 2017

Request and Response Objects in Lower Layers

In some API's you can make a call to one of its methods with a Request object as the parameter and you receive back a Response object after it finishes. If we take this same approach, can we just apply it everywhere?

For example, let's look at it from the API's side.

  1. The endpoint has a method named InsertData that takes in a InsertDataRequest's. It's endpoint consumes these requests and sends them over to their coordinator layer.
  2. From the coordinator layer, we start handling this request but need to call private class A at some point to use its FindData() method.

So my question: Is it considered bad design if we have FindData have a method signature of public FindDataResponse FindData(FindDataRequest request)? The coordinator layer at this point would have to make a FindDataRequest object to make the request to the class A and would just parse its response. Are there advantages/disadvantages to this? Am I breaking design principles?

Aucun commentaire:

Enregistrer un commentaire