You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by GitBox <gi...@apache.org> on 2018/10/04 14:25:51 UTC

[GitHub] skorikov opened a new pull request #27: API Refactoring: add execute operation to requests, extract SPI package

skorikov opened a new pull request #27: API Refactoring: add execute operation to requests, extract SPI package
URL: https://github.com/apache/incubator-plc4x/pull/27
 
 
   API Refactoring proposal containing the following changes. The most important changes are:
   
   **Provide an `execute()` operation on `PlcRequest`, returning `PlcResponse`**. This has already been discussed in the mailing list. The idea is to remove temporal coupling which forces the client to invoke operation in pairs: for example, creating the request off a `PlcReader` and submitting the created request back to the same `PlcReader` for execution.
   
   **Move `PlcReader`, `PlcReader`, `PlcSubscriber` away from the API into the SPI package**. Since execution of the requests will be implemented on the request itself, one level of indirection (`PlcReader`) in the chain `PlcConnection` -> `PlcReader` -> `PlcReadRequest.Builder` -> `PlcReadRequest` becomes trivial and unnecessary. However, the execution of the requests will be performed differently depending on the protocol being implemented. This variation should be encapsulated behind the `PlcReader` interface, but it should not be exposed to the client. Therefore, these interfaces are placed in the SPI package for protocol implementers.
   
   Other minor changes include:
   
   **Remove default methods from the API**. These were "workarounds" for sub-optimal API design. A public API should be as slim as possible, and default operations should be omitted.
   
   **`PlcMessageBuilder` renamed to `PlcRequstBuilder`**. It is useful for constructing requests anyway.
   
   **Reduced the amount of generics**. Many types were generic, which increased the complexity dramatically, but provided almost no benefit for the client. Wherever possible, the type parameters were removed to simplify the API.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services