Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand it right, you want to wrap the functionality of an HTTP server in your own service, implementing the <code>IOAdapter</code> interface. I think that this is not "beautiful" in the way the <code>interface IOAdapter</code> is written and used in the <code>MyService</code> class. This is because even if you write a <code>MyHTTPAdapter</code> the <code>adapter.read</code> method cannot be implemented using HTTP. </p> <p>In HTTP we have <strong>two entities</strong> communicating. The <strong>client</strong> sends and the <strong>server responds</strong>. This cannot be modelled using this interface you propose, since you model only one entity and have only one method for exchanging data, method <code>read</code>. You have to alter the interface design, focusing on a client-server design, then you could wrap an HTTP communication.</p> <p>EDIT: Integrating the two paradigms of communication (console communication and HTTP communication) is not a trivial task. I would propose a design imposed by this <code>interface</code>, following the client-server architecture imposed by HTTP, supposing that a console application could implement it too:</p> <pre><code>//This should be implemented by either the HTTP or the console server Adapter interface IOAdapter { IOResponse serveRequest(IORequest request); } //This interface should be implemented by both models of IOAdapter //For example, a subclass of string could also implement this interface in //order to unify the two models interface IORequest { } //This interface should be implemented by both models of IOAdapter //For example, a subclass of string could also implement this interface in //order to unify the two models interface IOResponse { } </code></pre> <p>Hope I helped!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload